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

betas

returns:

An array with the estimated parameters of the trained model

diagnostics

If the OLS model was trained specifying spatial weights then we can retrieve spatial diagnostics.

k

returns:

The number of variables for which coefficients are estimated (including the

model_type

returns:

The regression model defined

predy

returns:

An array with the predictions for the training data

summary

returns:

The summary of the trained model

u

returns:

An array with the residuals of the trained model