oraclesai.classification.GeographicalClassifier
- class GeographicalClassifier(global_model=None, model_cls=None, spatial_weights_definition=None, bandwidth=None, fixed=True, local_weight=0.25, **kwargs)
Geographical classification algorithm. It uses a global model and multiple local models to perform classification.
- 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. These criteria are 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, ...])Trains a geographical classification model.
get_params
([deep])Get parameters for this estimator.
predict
(X[, y, geometries, crs])Predict the target class for
X
using the global model and the local models that are closer to geometries.predict_proba
(X[, y, geometries, crs])Predict the probability of each class for
X
using the global model and the local models that are closer to geometries.score
(X, y[, geometries, crs])Compute the F1 score on the given test data and labels.
set_fit_input
(X[, geometries, y, ...])set_params
(**params)Set the parameters of this estimator.
Attributes
metrics_info
predict_input_info
predict_output_info