oraclesai.regression.GeographicalRegressor
- class GeographicalRegressor(global_model=None, model_cls=None, spatial_weights_definition=None, bandwidth=None, fixed=True, local_weight=0.25, **kwargs)
Geographical regression algotithm. It uses a global model and several local models to perform regression.
- Parameters:
global_model – A scikit-learn estimator instance, default=None. A trained model used as global model. Local models will be of the same type as this model. Required when
model_cls
is None.model_cls – Class of scikit-learn estimator, default=None. Type of the global model and local models. When
model_cls
is provided (instead ofglobal_model
), a global model will be trained. Required whenglobal_model=None
.model_cls
creation parameters are specified askwargs
.spatial_weights_definition – SpatialWeightsDefinition, default=None. Spatial relationship specification. This criteria is used to group data into neighborhoods and train local models.
bandwidth – int or float, default=None. Distance (fixed=True) or number of nearest neighbors (fixed=False). bandwidth + fixed is another way to set the spatial relationship specification. It is ignored if
spatial_weights_definition
was set.fixed – bool, default=True. True if bandwidth represents a distance. False for number of nearest neighbors.
local_weight – float (0.0 to 1.0), default=0.25. Weight associated to the local models predictions.
kwargs – Additional parameters for the inner models created with parameter
model_cls.
Methods
__init__
([global_model, model_cls, ...])add_metric_info
(metric_name, result[, ...])fit
(X, y[, geometries, crs, ...])Train a geographical regression model.
get_params
([deep])Get parameters for this estimator.
predict
(X[, y, geometries, crs])Predict the target value for X using the global model and the local models that are closer to geometries.
score
(X, y[, geometries, sample_weight, crs])Returns the value of the regression score function or R-Squared.
set_fit_input
(X[, geometries, y, ...])set_params
(**params)Set the parameters of this estimator.
Attributes
metrics_info
predict_input_info
predict_output_info