CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-scikit-learn

A comprehensive machine learning library providing supervised and unsupervised learning algorithms with consistent APIs and extensive tools for data preprocessing, model evaluation, and deployment.

87

0.98x
Overview
Eval results
Files

task.mdevals/scenario-4/

Anomaly Analysis Toolkit

Build a module that learns unsupervised detectors for global and local anomalies, estimates robust covariance distances, and discovers biclusters in a rectangular dataset.

Capabilities

Global anomaly scoring

  • Fitting on 2D numeric data that mixes a tight cluster with two faraway points produces boolean predictions that flag the distant points and keep the cluster points as normal @test

Local neighborhood detection

  • After training on points that mostly share similar nearest neighbors plus a single remote point, the local anomaly score for the remote point is strictly higher than every inlier score @test

Robust covariance distances

  • Computing robust Mahalanobis-style distances from a fitted covariance model yields a markedly larger distance for an outlier point than for a typical cluster point @test

Bicluster segmentation

  • Fitting biclusters on a matrix containing a high-valued block distinct from its surroundings returns row and column labels that separate that block from the remaining rows and columns @test

Implementation

@generates

API

import numpy as np
from typing import Tuple

class AnomalySuite:
    def fit_global(self, samples: np.ndarray, contamination: float = 0.1) -> "AnomalySuite":
        """Fit a global anomaly detector on 2D numeric samples."""

    def predict_global(self, samples: np.ndarray) -> np.ndarray:
        """Return a boolean array marking anomalies in the provided samples."""

    def fit_local(self, samples: np.ndarray, neighbors: int = 20) -> "AnomalySuite":
        """Fit a neighborhood-sensitive anomaly detector."""

    def score_local(self, samples: np.ndarray) -> np.ndarray:
        """Return anomaly scores where higher values indicate stronger outlierness."""

    def fit_covariance(self, samples: np.ndarray) -> "AnomalySuite":
        """Estimate a robust covariance model from the samples."""

    def mahalanobis_distance(self, samples: np.ndarray) -> np.ndarray:
        """Compute robust Mahalanobis-style distances for each sample."""

    def fit_biclusters(self, matrix: np.ndarray, n_clusters: int) -> "AnomalySuite":
        """Fit biclusters on a 2D matrix representing feature-by-sample signals."""

    def bicluster_assignments(self) -> Tuple[np.ndarray, np.ndarray]:
        """Return row and column cluster labels from the last biclustering fit."""

Dependencies { .dependencies }

scikit-learn { .dependency }

Provides unsupervised anomaly detection, covariance estimation, and biclustering utilities.

Install with Tessl CLI

npx tessl i tessl/pypi-scikit-learn

tile.json