Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
("test_relation", test_relation, [str], False)])
if not(cursor):
cursor = read_auto_connect().cursor()
else:
check_cursor(cursor)
try:
cursor.execute("SELECT GET_MODEL_ATTRIBUTE (USING PARAMETERS model_name = '" + name + "', attr_name = 'call_string')")
info = cursor.fetchone()[0].replace('\n', ' ')
except:
try:
cursor.execute("SELECT GET_MODEL_SUMMARY (USING PARAMETERS model_name = '" + name + "')")
info = cursor.fetchone()[0].replace('\n', ' ')
info = "kmeans(" + info.split("kmeans(")[1]
except:
from verticapy.learn.preprocessing import Normalizer
model = Normalizer(name, cursor)
model.param = to_tablesample(query = "SELECT GET_MODEL_ATTRIBUTE(USING PARAMETERS model_name = '{}', attr_name = 'details')".format(name.replace("'", "''")), cursor = cursor)
model.param.table_info = False
model.X = ['"' + item + '"' for item in model.param.values["column_name"]]
if ("avg" in model.param.values):
model.method = "zscore"
elif ("max" in model.param.values):
model.method = "minmax"
else:
model.method = "robust_zscore"
return model
try:
info = info.split("SELECT ")[1].split("(")
except:
info = info.split("(")
model_type = info[0].lower()
info = info[1].split(")")[0].replace(" ", '').split("USINGPARAMETERS")