Home / Libraries / Docs
ML4T Libraries
Documentation
Skip to content

Installation

Base Installation

pip install ml4t-models

ml4t-models keeps the base dependency set small. The default install gives you:

  • typed batch and result contracts
  • closed-form and NumPy-based model families
  • pipeline composition utilities
  • frame adapters that do not require heavy optional dependencies

Optional Extras

Neural Models

Install torch-backed models:

pip install ml4t-models[deep]

This extra is required for:

  • CAEModel
  • SAEModel
  • StochasticDiscountFactorModel
  • LSTMPortfolioModel
  • DeepPortfolioModel

Cross-Library Integration

Install tabular and spec helpers:

pip install ml4t-models[integration]

This extra is useful when you want:

  • ResultsFrame.to_polars()
  • parquet writing via write_backtest_frames
  • ml4t-specs-aware schema resolution

Documentation

Build the docs locally:

pip install ml4t-models[docs]

Everything

pip install ml4t-models[all]

Python Version

ml4t-models currently targets:

  • Python >=3.12,<3.14

Development Setup

Using uv:

git clone https://github.com/ml4t/models.git
cd ml4t-models
uv sync --all-extras

Run the quality gates:

uv run ruff check src/ tests/
uv run ty check
uv run pytest tests/ -q
uv build

Build the docs:

uv run --extra docs mkdocs build

ml4t-models is designed to integrate at boundaries with the rest of the ML4T stack:

  • ml4t-data for dataset loading and canonical schema metadata
  • ml4t-engineer for feature generation and labels
  • ml4t-diagnostic for IC, validation, and report generation
  • ml4t-backtest for execution and backtest state transitions