or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/scikit-learn@1.7.x
tile.json

tessl/pypi-scikit-learn

tessl install tessl/pypi-scikit-learn@1.7.0

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

Agent Success

Agent success rate when using this tile

87%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.99x

Baseline

Agent success rate without this tile

88%

task.mdevals/scenario-4/

Binary Training Utility

A small library for training and evaluating binary classifiers with two selectable algorithm families.

Capabilities

Configurable training

  • Training with algorithm "linear" on features [[0, 0], [0, 1], [1, 0], [1, 1]] and labels [0, 0, 0, 1] produces a fitted model whose label predictions match the labels on the same points when using predict_labels. @test
  • Training with algorithm "ensemble" on features [[0, 0], [0, 1], [1, 0], [1, 1]] and labels [0, 1, 1, 0] produces a fitted model whose label predictions match [0, 1, 1, 0] on the same points when using predict_labels. @test
  • Passing any algorithm string other than "linear" or "ensemble" raises a ValueError. @test

Predictions

  • predict_probabilities returns an array shaped (n_samples, 2) where column 0 corresponds to label 0, column 1 corresponds to label 1, each row sums to 1.0, and the largest probability in each row corresponds to the label returned by predict_labels for the same input. @test

Evaluation

  • evaluate_model trains using the chosen algorithm and returns an accuracy score between 0.0 and 1.0; on the [[0, 0], [0, 1], [1, 0], [1, 1]] and [0, 0, 0, 1] training data with identical test data it returns 1.0 when using the "linear" algorithm. @test

Implementation

@generates

API

from typing import Any, Literal
import numpy as np

Algorithm = Literal["linear", "ensemble"]

def train_model(features: np.ndarray, labels: np.ndarray, algorithm: Algorithm, random_state: int | None = None) -> Any:
    """Train a binary classifier using the selected algorithm and return the fitted model."""


def predict_labels(model: Any, features: np.ndarray) -> np.ndarray:
    """Return integer label predictions for each row in features."""


def predict_probabilities(model: Any, features: np.ndarray) -> np.ndarray:
    """Return probability estimates for class 0 then class 1, shaped (n_samples, 2)."""


def evaluate_model(
    train_features: np.ndarray,
    train_labels: np.ndarray,
    test_features: np.ndarray,
    test_labels: np.ndarray,
    algorithm: Algorithm,
    random_state: int | None = None,
) -> float:
    """Train on provided training data and report accuracy on provided test data."""

Dependencies { .dependencies }

scikit-learn { .dependency }

Provides supervised learning estimators, preprocessing utilities, and evaluation helpers.