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-1/

Streaming Classifier

Design a small module that performs streaming classification on numeric feature vectors, supporting mini-batch updates and the ability to continue training without losing learned weights.

Capabilities

Incremental batch training

  • Processes an initial labeled batch to establish the supported classes so later batches with the same labels do not fail. @test
  • Applying a second labeled batch accumulates knowledge instead of resetting; accuracy on an easy validation set improves or stays at least as good as after the first batch (expected >=0.85 on a separable toy dataset). @test

Resumable epochs

  • Running a resume-style training call for extra epochs on previously seen data starts from the current model state (not from scratch) and yields higher validation accuracy than before the resume call. @test

Predictions and scoring

  • Predicting after incremental updates returns labels drawn from the provided class list; scoring returns the fraction of correct predictions on a provided evaluation set. @test

Implementation

@generates

API

from typing import Iterable, Sequence

class StreamingClassifier:
    def __init__(self, classes: Sequence[str], *, batch_size: int = 64):
        ...

    def partial_train(self, features: Sequence[Sequence[float]], labels: Sequence[str]) -> None:
        """
        Incrementally update the model with one batch of feature rows and matching labels.
        """
        ...

    def resume_training(self, features: Sequence[Sequence[float]], labels: Sequence[str], epochs: int = 1) -> None:
        """
        Continue training for one or more additional passes over the provided data without reinitializing learned parameters.
        """
        ...

    def predict(self, features: Sequence[Sequence[float]]) -> list[str]:
        """
        Predict labels for feature rows using the current model state.
        """
        ...

    def score(self, features: Sequence[Sequence[float]], labels: Sequence[str]) -> float:
        """
        Return accuracy as the proportion of correct predictions on the given evaluation set.
        """
        ...

Dependencies { .dependencies }

scikit-learn { .dependency }

Provides incremental-learning estimators and utilities for streaming classification.

Install with Tessl CLI

npx tessl i tessl/pypi-scikit-learn

tile.json