Skip to content
torml edited this page Sep 25, 2026 · 4 revisions

torml Wiki

torml is a scikit-learn-style machine learning library implemented from scratch with PyTorch (torch.Tensor, torch.linalg) as its numerical backend, instead of NumPy/SciPy.

Install

pip install -e .
pip install -e ".[test]"   # pytest
pip install -e ".[doc]"    # sphinx docs

With uv:

uv sync --extra dev --extra test
uv run pytest
uv run pre-commit run --all-files

Quickstart

import torch
from torml.linear_model import LinearRegression

X = torch.randn(50, 3)
y = X @ torch.tensor([1.0, 2.0, -1.0]) + 0.1

model = LinearRegression().fit(X, y)
model.predict(X[:5])

Modules

Module Status Contents
torml.base done (Phase 1) BaseEstimator, clone, mixins, check_estimator
torml.utils done (Phase 1) validation, random state, tags, masks
torml.metrics done (Phase 2) accuracy_score, mean_squared_error, r2_score
torml.linear_model done (Phase 2) LinearRegression, LogisticRegression
torml.model_selection done (Phase 2) train_test_split, KFold, cross_val_score
torml.preprocessing done (Phase 2) StandardScaler, MinMaxScaler, LabelEncoder, OneHotEncoder
torml.neighbors done KNeighborsClassifier, KNeighborsRegressor
torml.naive_bayes done GaussianNB
torml.cluster done KMeans, DBSCAN
torml.tree done DecisionTreeClassifier, DecisionTreeRegressor
torml.decomposition done PCA
torml.ensemble done VotingClassifier/Regressor, BaggingClassifier/Regressor, RandomForestClassifier/Regressor
torml.svm done LinearSVC, LinearSVR
torml.pipelines done Pipeline, FeatureUnion, ColumnTransformer
torml.manifold done MDS
torml.gaussian_process done GaussianProcessRegressor
torml.mixture done GaussianMixture
torml.multiclass done OneVsRestClassifier
torml.semi_supervised done LabelPropagation
torml.covariance done EmpiricalCovariance
torml.cross_decomposition done PLSRegression
torml.feature_extraction done DictVectorizer
torml.feature_selection done SelectKBest, f_classif
torml.random_projection done GaussianRandomProjection
torml.discriminant_analysis done LinearDiscriminantAnalysis
torml.multivariate done MultiOutputRegressor, MultiOutputClassifier

285 tests, CI + Tests green on main. Release v0.1.0.

Branches

  • main — integration (CI green, v0.1.0 released).
  • Phase0 — repo scaffold milestone (frozen).
  • Phase1 — base + utils milestone (frozen).
  • Phase2 — first vertical slice milestone (frozen).
  • Phase3 — full backlog milestone (merged to main).

Each phase builds on the previous one: Phase0 ⊂ Phase1 ⊂ Phase2 ⊂ Phase3.

Each phase builds on the previous one: Phase0 ⊂ Phase1 ⊂ Phase2 ⊂ Phase3.

Pages

Clone this wiki locally