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.

Parameters:
  • original_grid (geology.Grid) – Original grid.

  • new_grid (geology.Grid) – New grid.

  • n_neighbors (int, optional) – number of neighbors to use, by default 5.

  • normalize_vector (list, optional) – vector to normalize distance, by default [1, 1, 1].

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.

Parameters:

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:

params – Parameter names mapped to their values.

Return type:

dict

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 (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

  • 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 in fit.

  • new_grid (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for new_grid parameter in fit.

  • normalize_vector (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for normalize_vector parameter in fit.

  • original_grid (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for original_grid parameter in fit.

Returns:

self – The updated object.

Return type:

object

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 (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • 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:
  • aggr (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for aggr parameter in predict.

  • original_properties (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for original_properties parameter in predict.

Returns:

self – The updated object.

Return type:

object