swiftemulator.mean_models.linear module

A basic linear model based on the scikit-learn multidimensional mean model.

class swiftemulator.mean_models.linear.LinearMeanModel(lasso_model_alpha: float = 0.0)[source]

Bases: swiftemulator.mean_models.base.MeanModel

A linear mean model; fits a linear model to the multidimensional parameter space.

Under the hood, this uses the sklearn.linear_model.lm.

Parameters

lasso_model_alpha (float, optional) – alpha for the Lasso model. If this is zero (the default) we fit a basic linear regression model is used for performance reasons.

lasso_model_alpha: float
model: Optional[Union[sklearn.linear_model._base.LinearRegression, sklearn.linear_model._coordinate_descent.Lasso]] = None
train(independent: numpy.ndarray, dependent: numpy.ndarray) None[source]

Train the model. See MeanModel for more information.

predict(independent: numpy.ndarray) numpy.ndarray[source]

Predict using the model. See MeanModel for more information.