EnsembleModel

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

Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin

Class used to construct ensemble models with a particular number and type of weak learner (base model). The ensemble model is compatible with most scikit-learn regressor models and KerasRegressor models

Args:

model: (str), string name denoting the name of the model type to use as the base model

n_estimators: (int), the number of base models to include in the ensemble

kwargs: keyword arguments for the base model parameter names and 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
get_params: method to output key model parameters
Args:
deep: (bool), determines the extent of information returned, default True
Returns:
information on model parameters

Methods Summary

fit(X, y)
get_params([deep]) Get parameters for this estimator.
predict(X[, as_frame])

Methods Documentation

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

Get parameters for this estimator.

deep : bool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators.
params : dict
Parameter names mapped to their values.
predict(X, as_frame=True)[source]