SklearnModel

class mastml.models.SklearnModel(model, **kwargs)[source]

Bases: BaseEstimator, TransformerMixin

Class to wrap any sklearn estimator, and provide some new dataframe functionality

Args:

model: (str), string denoting the name of an sklearn estimator object, e.g. KernelRidge

kwargs: keyword pairs of values to include for model, e.g. for KernelRidge can specify kernel, alpha, gamma values

Methods:
fit: method that fits the model parameters to the provided training data
Args:

X: (pd.DataFrame), dataframe of X features

y: (pd.Series), series of y target data

Returns:

fitted model

predict: method that evaluates model on new data to give predictions
Args:

X: (pd.DataFrame), dataframe of X features

as_frame: (bool), whether to return data as pandas dataframe (else numpy array)

Returns:

series or array of predicted values

help: method to output key information on class use, e.g. methods and parameters
Args:

None

Returns:

None, but outputs help to screen

Methods Summary

fit(X, y)

get_params([deep])

Get parameters for this estimator.

help()

predict(X[, as_frame])

Methods Documentation

fit(X, y)[source]
get_params(deep=True)[source]

Get parameters for this estimator.

Parameters

deepbool, default=True

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns

paramsdict

Parameter names mapped to their values.

help()[source]
predict(X, as_frame=True)[source]