Fix generators for not exist models
@@ -1063,38 +1063,23 @@ def gen_daal4py(daalroot, outdir, version, warn_all=False,
pyx_gettree = f.read()
pyx_gbt_model_builder = ''
+ pyx_gbt_generators = ''
pyx_log_reg_model_builder = ''
- if any(
- [
- all(
- [
- 'algorithms::gbt::classification' in iface.namespace_dict,
- 'ModelBuilder' in iface.namespace_dict[
- 'algorithms::gbt::classification'
- ].classes,
- ]
- ),
- all(
- [
- 'algorithms::gbt::regression' in iface.namespace_dict,
- 'ModelBuilder' in iface.namespace_dict[
- 'algorithms::gbt::regression'
- ].classes,
- ]
- )
- ]
- ):
+ pyx_gettree = ''
+ if 'algorithms::gbt::classification' in iface.namespace_dict and 'ModelBuilder' in \
+ iface.namespace_dict['algorithms::gbt::classification'].classes:
with open(jp('src', 'gbt_model_builder.pyx'), 'r') as f:
pyx_gbt_model_builder = f.read()
- if iface.version[0] >= 2021 and iface.version[1] >= 1 and \
- iface.version[3] != 'None' and iface.version[3] >= '"P"' and \
- 'algorithms::logistic_regression' in iface.namespace_dict and \
- 'ModelBuilder' in iface.namespace_dict['algorithms::logistic_regression'].classes:
- with open(jp('src', 'log_reg_model_builder.pyx'), 'r') as f:
- pyx_log_reg_model_builder = f.read()
- pyx_gbt_generators = ''
with open(jp('src', 'gbt_convertors.pyx'), 'r') as f:
pyx_gbt_generators = f.read()
+ if 'algorithms::logistic_regression' in iface.namespace_dict and 'ModelBuilder' in \
+ iface.namespace_dict['algorithms::logistic_regression'].classes:
+ with open(jp('src', 'log_reg_model_builder.pyx'), 'r') as f:
+ pyx_log_reg_model_builder = f.read()
+ if 'algorithms::tree_utils' in iface.namespace_dict:
+ with open(jp('src', 'gettree.pyx'), 'r') as f:
+ pyx_gettree = f.read()
+
with open(jp(outdir, 'daal4py_cy.pyx'), 'w') as f:
f.write(pyx_file)
f.write(pyx_gettree)
