uniqed.models package¶
Submodules¶
uniqed.models.tof module¶
- class uniqed.models.tof.TOF(cutoff_n=1.0, k=None, q=2, centrality_func=<function mean>)¶
Bases:
sklearn.base.BaseEstimator,sklearn.base.ClassifierMixin,sklearn.base.OutlierMixin- fit(X, y=None)¶
Fits the model
- Parameters
X – data (n_dataponts, d) shape
y – None
- Returns
self
- predict(X)¶
Classify the points
- Parameters
X (numpy.ndarray) – data (n_dataponts, d) shape
- Returns
class labels (-1 and 1)
- Return type
numpy.ndarray
- _get_outliers_inds(outliers_bool)¶
Returns outlier inds from Boolean array
- Parameters
outliers_bool (numpy.ndarray of bool) – array with truth-values of outlierness
- Returns
indices
- Return type
numpy.ndarray of int
- _find_nearest_neighbors(X, k=None)¶
Finds k-nearest neighbor distances and indices by using the cKDTree class
- Parameters
X (np.ndarray of float) – points
k (int) – number of neighbors (default: k=None)
- Returns
neighbor distances and indices
- Return type
(numpy.ndarray of float, numpy.ndarray of int)
- _compute_cutoff(cutoff_n)¶
Computes cutoff threshold for the outlier-score
- Parameters
cutoff_n (int) – the length of
- Returns
cutoff threshold value
- Return type
float
- _compute_p_value(outlier_score)¶
- _compute_outlier_score(X, k=None)¶
Computes 1/TOF for X
- Parameters
X (numpy.ndarray) – dataset
k (int) – number of neighbors
- Returns
1/TOF outlier score
- _compute_tof(nearest_indicis, indicis)¶
Computes TOF score from nearest neighbor indices and the indice list of the actual moment
- Parameters
nearest_indicis – indices of nearestneighbors
indicis – the actual moment
- Returns
- _compute_perc_cutoff(cutoff_n)¶
Computes threshold for cutoff value given in per cent
- Parameters
cutoff_n (int) – per cent value (between 0 and 100)
- Returns
threshold value
- Return type
float