Skip to content

Neighborhoods🍋

MaxPerCategoryNeighborhood 🍋

Bases: 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(points, reference=np.zeros(3)) 🍋

Neighborhood selection function.

Parameters:

Name Type Description Default
points np.ndarray

A numpy matrix where each row is a vector in the Euclidean Space.

required
reference np.ndarray

A numpy vector indicating the position (center of the ball).

np.zeros(3)

Returns:

Type Description
np.ndarray

This function returns the indixes of the N rows of x

np.ndarray

which are the closest to the vector p according to the distance

MinMaxPointsNeighborhood 🍋

Bases: 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(points, reference=np.zeros(3)) 🍋

Neighborhood selection function.

Parameters:

Name Type Description Default
points np.ndarray

A numpy matrix where each row is a vector in the Euclidean Space.

required
reference np.ndarray

A numpy vector indicating the position (center of the ball).

np.zeros(3)

Returns:

Type Description
np.ndarray

This function returns the indixes of the N rows of x

np.ndarray

which are the closest to the vector p according to the distance.

Neighborhood 🍋

Bases: Entity

Base class for unique neighborhood. Sub-class it to have a custom selection mechanism.

select(points, reference=np.zeros(3)) 🍋

Neighborhood selection function.

Parameters:

Name Type Description Default
points np.ndarray

A numpy matrix where each row is a vector in the Euclidean Space.

required
reference np.ndarray

A numpy vector indicating the position (center of the ball).

np.zeros(3)

Returns:

Type Description
np.ndarray

This function returns the indixes of the N rows of x

np.ndarray

which are the closest to the vector p according to the distance.

which_in_ball(points, reference=np.zeros(3), 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 np.ndarray

A numpy matrix whose rows represent vectors in the Euclidean space.

required
reference np.ndarray

Position vector indicating the center of the ball.

np.zeros(3)
radius float

Radius of the ball.

1.0
metric Metric

A metric object.

Metric()

Returns:

Type Description
np.ndarray

A numpy arrray containing indices of point x to keep.

which_nearest_in_ball(points, reference=np.zeros(3), 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 np.ndarray

A numpy matrix where each row is a vector in the Euclidean Space.

required
reference np.ndarray

A numpy vector indicating the position (center of the ball).

np.zeros(3)
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
np.ndarray

A numpy array. This function returns the indixes of the N rows of x

np.ndarray

which are the closest to the vector p according to the distance

np.ndarray

Metric and which are in the ball of center p and radius r (according

np.ndarray

to that distance). If there is less points in the ball than N, the

np.ndarray

indexes of all those points are returned. Points returned are ordered

np.ndarray

by ascending distance.

which_nearest_in_ball_with_max_per_category(points, reference=np.zeros(3), 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 np.ndarray

A numpy matrix where each row is a vector in the Euclidean Space.

required
reference np.ndarray

A numpy vector indicating the position (center of the ball).

np.zeros(3)
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 Optional[int]

Maximum number of neighors for each category.

None
category Optional[np.ndarray]

Attribute to determine uniqueness of each category.

None

Returns:

Type Description
np.ndarray

A numpy array. This function returns the indixes of the N rows of x

np.ndarray

which are the closest to the vector p according to the distance

np.ndarray

Metric and which are in the ball of center p and radius r (according

np.ndarray

to that distance). If there is less points in the ball than N, the

np.ndarray

indexes of all those points are returned. Points returned are ordered

np.ndarray

by ascending distance.