Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
parameters_dict = {}
for item in parameters:
parameters_dict[item[0]] = item[1]
info = info[0]
for elem in parameters_dict:
if type(parameters_dict[elem]) == str:
parameters_dict[elem] = parameters_dict[elem].replace("'", "")
if (model_type == "rf_regressor"):
from verticapy.learn.ensemble import RandomForestRegressor
model = RandomForestRegressor(name, cursor, int(parameters_dict['ntree']), int(parameters_dict['mtry']), int(parameters_dict['max_breadth']), float(parameters_dict['sampling_size']), int(parameters_dict['max_depth']), int(parameters_dict['min_leaf_size']), float(parameters_dict['min_info_gain']), int(parameters_dict['nbins']))
elif (model_type == "rf_classifier"):
from verticapy.learn.ensemble import RandomForestClassifier
model = RandomForestClassifier(name, cursor, int(parameters_dict['ntree']), int(parameters_dict['mtry']), int(parameters_dict['max_breadth']), float(parameters_dict['sampling_size']), int(parameters_dict['max_depth']), int(parameters_dict['min_leaf_size']), float(parameters_dict['min_info_gain']), int(parameters_dict['nbins']))
elif (model_type == "logistic_reg"):
from verticapy.learn.linear_model import LogisticRegression
model = LogisticRegression(name, cursor, parameters_dict['regularization'], float(parameters_dict['epsilon']), float(parameters_dict['lambda']), int(parameters_dict['max_iterations']), parameters_dict['optimizer'], float(parameters_dict['alpha']))
elif (model_type == "linear_reg"):
from verticapy.learn.linear_model import ElasticNet
model = ElasticNet(name, cursor, parameters_dict['regularization'], float(parameters_dict['epsilon']), float(parameters_dict['lambda']), int(parameters_dict['max_iterations']), parameters_dict['optimizer'], float(parameters_dict['alpha']))
elif (model_type == "naive_bayes"):
from verticapy.learn.naive_bayes import MultinomialNB
model = MultinomialNB(name, cursor, float(parameters_dict['alpha']))
elif (model_type == "svm_regressor"):
from verticapy.learn.svm import LinearSVR
model = LinearSVR(name, cursor, float(parameters_dict['epsilon']), float(parameters_dict['C']), True, float(parameters_dict['intercept_scaling']), parameters_dict['intercept_mode'], float(parameters_dict['error_tolerance']), int(parameters_dict['max_iterations']))
elif (model_type == "svm_classifier"):
from verticapy.learn.svm import LinearSVC
model = LinearSVC(name, cursor, float(parameters_dict['epsilon']), float(parameters_dict['C']), True, float(parameters_dict['intercept_scaling']), parameters_dict['intercept_mode'], [float(item) for item in parameters_dict['class_weights'].split(",")], int(parameters_dict['max_iterations']))
elif (model_type == "kmeans"):
from verticapy.learn.cluster import KMeans
model = KMeans(name, cursor, -1, parameters_dict['init_method'], int(parameters_dict['max_iterations']), float(parameters_dict['epsilon']))
elif (model_type == "pca"):