oraclesai.regression.OLSRegressor
- class OLSRegressor(spatial_weights_definition=None)
The Ordinary Least Square (OLS) algorithm fits a line that minimizes the Mean Squared Error (MSE) from the training set to predict new values. By defining the parameter
spatial_weights_definition
, it is possible to get spatial statistics after training the model; these statistics help identify the presence of spatial dependence or spatial heterogeneity- Parameters:
spatial_weights_definition – SpatialWeightsDefinition, default=None. Specifies the spatial relationship among neighbors. If defined it will include Spatial diagnostics, such as the Lagrange Multiplier tests and Moran’s I.
Methods
__init__
([spatial_weights_definition])fit
(X, y[, geometries, crs, ...])Trains the model using the training dataset.
get_params
([deep])Get parameters for this estimator.
predict
(X[, geometries])Estimates the target variable for the given data.
score
(X, y[, sample_weight, geometries])Returns the value of the regression score function or R-Squared.
set_params
(**params)Set the parameters of this estimator.
Attributes
- returns:
An array with the estimated parameters of the trained model
If the OLS model was trained specifying spatial weights then we can retrieve spatial diagnostics.
- returns:
The number of variables for which coefficients are estimated (including the
- returns:
The regression model defined
- returns:
An array with the predictions for the training data
- returns:
The summary of the trained model
- returns:
An array with the residuals of the trained model