SimpleRegressor

class pyoptex.analysis.estimators.simple_model.SimpleRegressor(factors=(), Y2X=<function identityY2X>, random_effects=(), conditional=False)[source]

A simple linear regressor implementing the RegressionMixin and ConditionalRegressionMixin interfaces.

Permits to fit a simple model provided in Y2X with optionally random effects.

Note

It includes all parameters and attributes from RegressionMixin and ConditionalRegressionMixin

__init__(factors=(), Y2X=<function identityY2X>, random_effects=(), conditional=False)[source]

Simple regression model.

Parameters

factorslist(Factor)

A list of factors to be used during fitting. It contains the categorical encoding, continuous normalization, etc.

Y2Xfunc(Y)

The function to transform a design matrix Y to a model matrix X.

random_effectslist(str)

The names of any random effect columns. Every random effect is interpreted as a string column and encoded using effect encoding.

conditionalbool

Whether to create a conditional model or not.

Methods

SimpleRegressor.fit(X, y)

Fits the data.

SimpleRegressor.formula([labels])

Creates the prediction formula of the fit for the encoded and normalized data.

SimpleRegressor.get_metadata_routing()

Get metadata routing of this object.

SimpleRegressor.get_params([deep])

Get parameters for this estimator.

SimpleRegressor.model_formula(model)

Creates the prediction formula of the fit for the encoded and normalized data.

SimpleRegressor.pred_var(X)

Prediction variances for the new values specified in X.

SimpleRegressor.predict(X)

Predict on new data after fitting.

SimpleRegressor.preprocess_fit(X, y)

Preprocesses before fitting the data.

SimpleRegressor.preprocess_predict(X)

Preprocessing the incoming data before prediction.

SimpleRegressor.score(X, y[, sample_weight])

Return coefficient of determination on test data.

SimpleRegressor.set_params(**params)

Set the parameters of this estimator.

SimpleRegressor.set_score_request(*[, ...])

Configure whether metadata should be requested to be passed to the score method.

SimpleRegressor.summary()

Generates a summary of the fit in case it was stored during training in the fit_ attribute.

Attributes

SimpleRegressor.M_

Alias for information_matrix

SimpleRegressor.Minv_

Alias for inv_information_matrix

SimpleRegressor.V_

Alias for obs_cov

SimpleRegressor.Vinv_

Alias for inv_obs_cov

SimpleRegressor.information_matrix

The information matrix of the fitted data.

SimpleRegressor.inv_information_matrix

The inverse of the information matrix.

SimpleRegressor.inv_obs_cov

The inverse of the observation covariance matrix.

SimpleRegressor.is_fitted

Checks whether the regressor has been fitted.

SimpleRegressor.obs_cov

The observation covariance matrix \(V = var(Y)\).

SimpleRegressor.total_var

The total variance on the normalized y-values.