cblearn.preprocessing.triplets_from_mostcentral#

cblearn.preprocessing.triplets_from_mostcentral(X, y=None)[source]#

Calculates triplets from most-central queries.

The most-central query consists of k objects, of which one is most similar to all others.

Note

For this transformation, we are assuming that the objects respect the triangle inequality. This might not always be a given and is not checked by this function.

Parameters:
  • X (ndarray) – Array of most-central queries (n_query, n_choices)

  • y (ndarray | None) – Optional list of indices, that indicate the central choice per query. If omitted, the first entry is assumed to be the odd object.

Returns:

Array of triplet queries (n_query * (n_choices - 2) * (n_choices - 1), 3)

Return type:

triplets