Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
classes, fields = get_data_information(pmml)
if args:
classes = get_data_information(pmml)[0]
fields = args[0]
if func_name == 'regression':
model = DecisionTreeRegressor()
else:
model = DecisionTreeClassifier()
model.n_features = len(fields)
model.n_features_ = len(fields)
model.n_outputs_ = 1
model.n_outputs = 1
model.classes_ = np.array(classes)
model.n_classes_ = len(classes)
model._estimator_type = 'classifier' if len(classes) > 0 else 'regressor'
tree = Tree(fields, classes)
tree.get_node_info(all_node)
tree.build_tree()
model.tree_ = tree
return model
classes, fields = get_data_information(pmml)
if args:
classes = get_data_information(pmml)[0]
fields = args[0]
if func_name == 'regression':
model = DecisionTreeRegressor()
else:
model = DecisionTreeClassifier()
model.n_features = len(fields)
model.n_features_ = len(fields)
model.n_outputs_ = 1
model.n_outputs = 1
model.classes_ = np.array(classes)
model.n_classes_ = len(classes)
model._estimator_type = 'classifier' if len(classes) > 0 else 'regressor'
tree = Tree(fields, classes)
tree.get_node_info(all_node)
tree.build_tree()
model.tree_ = tree
return model
model = DecisionTreeRegressor()
model.n_features = len(fields)
model.n_features_ = len(fields)
model.n_outputs_ = 1
model.n_outputs = 1
model.classes_ = np.array(classes)
model.tree_ = tt
tree_inner.append(model)
trees.append(tree_inner)
else:
main_node = tree_model.get_Node()
all_node = main_node.get_Node()
if len(all_node) == 0:
continue
operator = all_node[0].get_SimplePredicate().get_operator()
tt = Tree(fields, classes, operator)
tt.get_node_info(all_node)
tt.build_tree()
model = DecisionTreeClassifier()
model.n_features = len(fields)
model.n_features_ = len(fields)
model.n_outputs_ = 1
model.n_outputs = 1
model.classes_ = np.array(classes)
model._estimator_type = 'classifier' if len(classes) > 0 else 'regressor'
model.tree_ = tt
trees.append(model)
return trees
def get_tree_objects(self, tree_models, fields, classes):
trees = list()
for i, tree_model in enumerate(tree_models):
if 'list' in str(type(tree_model)):
tree_inner = list()
for tree_mod in tree_model:
main_node = tree_mod.get_Node()
all_node = main_node.get_Node()
if len(all_node) == 0:
continue
operator = all_node[0].get_SimplePredicate().get_operator()
tt = Tree(fields, [1], operator)
tt.get_node_info(all_node)
tt.build_tree()
model = DecisionTreeRegressor()
model.n_features = len(fields)
model.n_features_ = len(fields)
model.n_outputs_ = 1
model.n_outputs = 1
model.classes_ = np.array(classes)
model.tree_ = tt
tree_inner.append(model)
trees.append(tree_inner)
else:
main_node = tree_model.get_Node()
all_node = main_node.get_Node()
if len(all_node) == 0:
continue