def prepare_fit_model_for_factors(model_type, x_train, y_train):
"""
Given a model type, train and test data
Args:
model_type (str): 'classification' or 'regression'
x_train:
y_train:
Returns:
(sklearn.base.BaseEstimator): A fit model.
"""
if model_type == 'classification':
algorithm = LogisticRegression()
elif model_type == 'regression':
algorithm = LinearRegression()
else:
algorithm = None
if algorithm is not None:
algorithm.fit(x_train, y_train)
return algorithm
评论列表
文章目录