PropertiesTransfer¶
- class PropertiesTransfer[source]¶
Model to transfer rock properties using Nearest Neighbors algorithm.
- dump(path)[source]¶
Dump to a file (*.npz).
- Parameters:
path (str or pathlib.Path) – Path to file,
.npz
extension will be appended to the file name if it is not already there.
- fit(original_grid, new_grid, n_neighbors=5, normalize_vector=(1, 1, 1))[source]¶
Fit Nearest Neighbors model.
- get_metadata_routing()¶
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:
routing – A
MetadataRequest
encapsulating routing information.- Return type:
MetadataRequest
- get_params(deep=True)¶
Get parameters for this estimator.
- load(path)[source]¶
Load from file.
- Parameters:
path (str or pathlib.Path) – File path.
- predict(original_properties, aggr=<function PropertiesTransfer.<lambda>>)[source]¶
Transfer property values to the new grid.
- Parameters:
original_properties (numpy.ndarray) – Properties on original grid.
aggr (Callable, optional) – Function to aggregate nearest neighbors values, by default weighted average.
- Returns:
array – New values.
- Return type:
ndarray
- set_fit_request(*, n_neighbors: bool | None | str = '$UNCHANGED$', new_grid: bool | None | str = '$UNCHANGED$', normalize_vector: bool | None | str = '$UNCHANGED$', original_grid: bool | None | str = '$UNCHANGED$') PropertiesTransfer ¶
Request metadata passed to the
fit
method.Note that this method is only relevant if
enable_metadata_routing=True
(seesklearn.set_config()
). Please see User Guide on how the routing mechanism works.The options for each parameter are:
True
: metadata is requested, and passed tofit
if provided. The request is ignored if metadata is not provided.False
: metadata is not requested and the meta-estimator will not pass it tofit
.None
: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str
: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED
) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
Note
This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a
Pipeline
. Otherwise it has no effect.- Parameters:
n_neighbors (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
n_neighbors
parameter infit
.new_grid (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
new_grid
parameter infit
.normalize_vector (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
normalize_vector
parameter infit
.original_grid (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for
original_grid
parameter infit
.
- Returns:
self – The updated object.
- Return type:
- set_params(**params)¶
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as
Pipeline
). The latter have parameters of the form<component>__<parameter>
so that it’s possible to update each component of a nested object.- Parameters:
**params (dict) – Estimator parameters.
- Returns:
self – Estimator instance.
- Return type:
estimator instance
- set_predict_request(*, aggr: bool | None | str = '$UNCHANGED$', original_properties: bool | None | str = '$UNCHANGED$') PropertiesTransfer ¶
Request metadata passed to the
predict
method.Note that this method is only relevant if
enable_metadata_routing=True
(seesklearn.set_config()
). Please see User Guide on how the routing mechanism works.The options for each parameter are:
True
: metadata is requested, and passed topredict
if provided. The request is ignored if metadata is not provided.False
: metadata is not requested and the meta-estimator will not pass it topredict
.None
: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str
: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED
) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
Note
This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a
Pipeline
. Otherwise it has no effect.- Parameters:
- Returns:
self – The updated object.
- Return type: