def _train(self, matrix_store, class_path, parameters):
"""Fit a model to a training set. Works on any modeling class that
is available in this package's environment and implements .fit
Args:
class_path (string) A full classpath to the model class
parameters (dict) hyperparameters to give to the model constructor
Returns:
tuple of (fitted model, list of column names without label)
"""
module_name, class_name = class_path.rsplit(".", 1)
module = importlib.import_module(module_name)
cls = getattr(module, class_name)
instance = cls(**parameters)
y = matrix_store.labels()
return instance.fit(matrix_store.matrix, y), matrix_store.matrix.columns
评论列表
文章目录