genestboost.weak_learners package

genestboost.weak_learners module.

class genestboost.weak_learners.SimplePLS(max_vars=1, filter_threshold=None)[source]

Bases: object

Implementation for SimplePLS, a partial-PLS component regression model.

__init__(max_vars=1, filter_threshold=None)[source]

Class SimplePLS initializer.

Parameters
  • max_vars (int, optional (default=1)) – The maximum number of variables to use in the regression. The default value is 1, which is the special case of simple one-variable least squares regression. If None, then max_vars will be set to the number of variables in the X model matrix during the fitting process.

  • filter_threshold (float, optional (default=None)) – The correlation filter threshold to use. If the ratio of the absolute value of the correlation coefficient for a predictor to the absolute value of the maximum correlation coefficient of all predictors is less than the filter threshold value, then the predictor will be excluded from the regression. The default value is None, in which case the filter threshold will be set equal to 0.0.

coef_

The estimated coefficients for the regression problem

Type

numpy.ndarray, shape (n_predictors,)

intercept_

The estimated intercept (bias) for the regression problem

Type

float

fit(X, y, weights=None)[source]

Fit a linear regression according to the specified initializer arguments.

The fit process will result in several instance attributes being populated, including the public attributes housing the coefficients and intercept.

Parameters
  • X (numpy.ndarray, shape (n_samples, n_predictors)) – The input model matrix. Should be of dtype float.

  • y (numpy.ndarray, shape (n_samples, )) – The target vector

  • weights (numpy.ndarray, optional (default=None)) – A value of weights to use for the linear regression fit. The default value is None, which results in equal weighting for all observations. If a value is provided, it should have the same dimensions as the target vector, y. The weights are applied to the correlation calculation only. They are not used during standardization of the X and y fitted arrays at model initialization.

Returns

model – Instance of self.

Return type

SimplePLS

predict(X)[source]

Compute model predictions for the given model matrix, X.

Parameters

X (numpy.ndarray, shape (n_samples, n_predictors)) – The input model matrix. Should be of dtype float. The number of columns should be the same number of columns as the X argument that was used to fit the model.

Returns

A vector of predictions of dtype float

Return type

numpy.ndarray, shape (n_samples, )