lir.algorithms.percentile_rank module
- class lir.algorithms.percentile_rank.PercentileRankTransformer[source]
Bases:
TransformerMixinCompute the percentile rankings of a dataset, relative to another dataset.
Rankings are in range [0, 1]. Handling ties: the maximum of the ranks that would have been assigned to all the tied values is assigned to each value.
To compute the ranks of dataset
Zrelative to datasetX,fit()will create a ranking function for each feature usingX.transform()then applies those per-feature ranking functions toZ.Both
fit()andtransform()accept an arrayXwith one row per instance, i.e. shape(n_samples, n_features). The number of features must match betweenfit()andtransform().If
Xcontains paired measurements per instance (shape(n_samples, n_features, 2)), ranking is fitted and applied independently to the first and second measurement in the pair.- fit(X: ndarray, y: ndarray | None = None) PercentileRankTransformer[source]
Fit the transformer model on the data.
- Parameters:
X (np.ndarray) – Input array with shape
(n_samples, n_features)or(n_samples, n_features, 2).y (np.ndarray | None, optional) – Ignored; present for scikit-learn API compatibility.
- Returns:
Fitted transformer.
- Return type: