src.utils.ptransf.receptive_field
Classes
|
- class src.utils.ptransf.receptive_field.ReceptiveField(**kwargs)
- Author:
Alberto M. Esmoris Pena
Interface representing a receptive field. Any class must realize this interface if it aims to provide receptive field-like transformations.
- __init__(**kwargs)
- abstractmethod fit(X, x, structure_float_type=<class 'numpy.float64'>, id=None)
Fit the receptive field to represent the given points.
- Parameters:
X (
np.ndarray) – The input matrix of m points in an n-dimensional space.x (
np.ndarray) – The center point used to define the origin of the receptive field.structure_float_type (
np.dtype) – The decimal type for the structure space.id (int or str) – Either an integer or a string identifying the receptive field that is being fit. Alternatively it can be None. Note that this argument is meant to be used only for certain purposes, but it is not fundamental for the receptive field. An example can be identifying the current receptive field to name an output report (see
ReceptiveFieldOversamplingReport,ReceptiveFieldFPS.fit(), andReceptiveFieldFPS.compute_fps_on_3D_pcloud()).
- Returns:
The fit receptive field itself (for fluent programming).
- Return type:
- abstractmethod centroids_from_points(X)
Compute the centroids, i.e., the points representing the original point cloud in the receptive field space. The points do not need to be actual centroids. The name comes from typical rectangular-cells which are represented by computing the cell-wise centroid considering all points inside a given cell.
- Parameters:
X (
np.ndarray) – The matrix of input points- Returns:
A matrix which rows are the points representing the centroids.
- Return type:
np.ndarray
- abstractmethod propagate_values(v)
Propagate given values, so they are associated to the points in the original space preceding the receptive field. In other words, the values v in the domain of the receptive field are transformed back to the original domain before the receptive field was computed.
- Parameters:
v (list) – The values to be propagated from the receptive field back to the original domain.
- Returns:
The output as a matrix when there are more than two values per point or the output as a vector when there is one value per point.
- Return type:
np.ndarray
- abstractmethod reduce_values(X, v, reduce_f=<function mean>)
Reduce given values so there is one per centroid in the receptive field at most.
- Parameters:
X (
np.ndarray) – The matrix of coordinates representing the centroids of the receptive field.v (
np.ndarray) – The vector of values to be reduced.reduce_f (callable) – The function to reduce many values to a single one. By default, it is the mean.
- Returns:
The reduced vector.
- Return type:
np.ndarray
- canibalize(rf)
Take the values from given receptive field.
- Parameters:
rf – Receptive field whose attributes will be canibalized.