Neighborhoods🍋
MaxPerCategoryNeighborhood (MinMaxPointsNeighborhood)
🍋
Min Max Per Category Neighbors model.
Neighborhood based on minimum and maximum number of closest points to be selected and maximum per category.
Warning
categories must be defined in consecutive groups, like drillhole.
Attributes:
Name | Type | Description |
---|---|---|
dimension |
int |
Neighborhood dimensions. |
metric |
Metric |
Metric. |
max_per_category |
int |
Maximum number of neighors for each category. |
category |
np.ndarray |
Attribute to determine uniqueness of each category. |
select(self, points, reference=array([0., 0., 0.]))
🍋
Neighborhood selection function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points |
ndarray |
A numpy matrix where each row is a vector in the Euclidean Space. |
required |
reference |
ndarray |
A numpy vector indicating the position (center of the ball). |
array([0., 0., 0.]) |
Returns:
Type | Description |
---|---|
ndarray |
This function returns the indixes of the N rows of x which are the closest to the vector p according to the distance |
MinMaxPointsNeighborhood (Neighborhood)
🍋
MimMax Neighborhs model.
Attributes:
Name | Type | Description |
---|---|---|
dimension |
int |
Neighborhood dimension. |
metric |
Metric |
Metric. |
min_n |
int |
Minimum number of closest points in ball. |
max_n |
int |
Maximum number of closest points in ball. |
select(self, points, reference=array([0., 0., 0.]))
🍋
Neighborhood selection function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points |
ndarray |
A numpy matrix where each row is a vector in the Euclidean Space. |
required |
reference |
ndarray |
A numpy vector indicating the position (center of the ball). |
array([0., 0., 0.]) |
Returns:
Type | Description |
---|---|
ndarray |
This function returns the indixes of the N rows of x which are the closest to the vector p according to the distance. |
Neighborhood (Entity)
🍋
Base class for unique neighborhood. Sub-class it to have a custom selection mechanism.
select(self, points, reference=array([0., 0., 0.]))
🍋
Neighborhood selection function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points |
ndarray |
A numpy matrix where each row is a vector in the Euclidean Space. |
required |
reference |
ndarray |
A numpy vector indicating the position (center of the ball). |
array([0., 0., 0.]) |
Returns:
Type | Description |
---|---|
ndarray |
This function returns the indixes of the N rows of x which are the closest to the vector p according to the distance. |
which_in_ball(points, reference=array([0., 0., 0.]), radius=1.0, metric=Metric)
🍋
Function to return the indexes of the points which are in a (closed) ball in the Euclidean space.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points |
ndarray |
A numpy matrix whose rows represent vectors in the Euclidean space. |
required |
reference |
ndarray |
Position vector indicating the center of the ball. |
array([0., 0., 0.]) |
radius |
float |
Radius of the ball. |
1.0 |
metric |
Metric |
A metric object. |
Metric |
Returns:
Type | Description |
---|---|
ndarray |
A numpy arrray containing indices of point x to keep. |
which_nearest_in_ball(points, reference=array([0., 0., 0.]), radius=1.0, metric=Metric, min_n=1, max_n=100)
🍋
Function to obtain the N closest points of a set of points to the center of a ball which are on that ball.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points |
ndarray |
A numpy matrix where each row is a vector in the Euclidean Space. |
required |
reference |
ndarray |
A numpy vector indicating the position (center of the ball). |
array([0., 0., 0.]) |
radius |
float |
Radius of the ball. |
1.0 |
metric |
Metric |
Metric object defining the ball. |
Metric |
min_n |
int |
Minimum number of points in the ball to be considered otherwise returns no points. |
1 |
max_n |
int |
Maximum number of points in the ball to be considered (the N closest). |
100 |
Returns:
Type | Description |
---|---|
ndarray |
A numpy array. This function returns the indixes of the N rows of x which are the closest to the vector p according to the distance Metric and which are in the ball of center p and radius r (according to that distance). If there is less points in the ball than N, the indexes of all those points are returned. Points returned are ordered by ascending distance. |
which_nearest_in_ball_with_max_per_category(points, reference=array([0., 0., 0.]), radius=1.0, metric=Metric, min_n=1, max_n=100, max_per_category=None, category=None)
🍋
Function to obtain the N closest points of a set of points to the center of a ball which are on that ball with a maximum per category.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points |
ndarray |
A numpy matrix where each row is a vector in the Euclidean Space. |
required |
reference |
ndarray |
A numpy vector indicating the position (center of the ball). |
array([0., 0., 0.]) |
radius |
float |
Radius of the ball. |
1.0 |
metric |
Metric |
Metric object defining the ball. |
Metric |
min_n |
int |
Minimum number of points in the ball to be considered otherwise returns no points. |
1 |
max_n |
int |
Maximum number of points in the ball to be considered (the N closest). |
100 |
max_per_category |
int |
Maximum number of neighors for each category. |
None |
category |
ndarray |
Attribute to determine uniqueness of each category. |
None |
Returns:
Type | Description |
---|---|
ndarray |
A numpy array. This function returns the indixes of the N rows of x which are the closest to the vector p according to the distance Metric and which are in the ball of center p and radius r (according to that distance). If there is less points in the ball than N, the indexes of all those points are returned. Points returned are ordered by ascending distance. |