millwright 2.3.1

A unified ML framework for Rust — proven Rust crates, assembled into one machine.
Documentation
from collections.abc import Mapping, Sequence
from typing import Any

Rows = Sequence[Sequence[float]]
FrameLike = Frame | Table | Rows

def version() -> str: ...

class Frame:
    @staticmethod
    def from_rows(rows: Rows, columns: Sequence[str] | None = ...) -> Frame: ...
    @staticmethod
    def from_numpy(array: Any) -> Frame: ...
    @staticmethod
    def from_pandas(df: Any) -> Frame: ...
    def columns(self) -> list[str]: ...
    @property
    def shape(self) -> tuple[int, int]: ...
    def __len__(self) -> int: ...

class Table:
    @staticmethod
    def from_csv(path: str) -> Table: ...
    @staticmethod
    def from_parquet(path: str) -> Table: ...
    @staticmethod
    def from_frame(frame: Frame) -> Table: ...
    def to_frame(self) -> Frame: ...
    @property
    def shape(self) -> tuple[int, int]: ...
    def __len__(self) -> int: ...

class Profile:
    @staticmethod
    def of(data: Frame | Table) -> Profile: ...
    @staticmethod
    def of_with_target(data: Frame | Table, target: str) -> Profile: ...
    def to_html(self, path: str) -> None: ...

class StandardScaler: ...
class MinMaxScaler: ...
class OneHotEncoder: ...
class SimpleImputer:
    def __init__(self, strategy: str | None = ...) -> None: ...
    @staticmethod
    def median() -> SimpleImputer: ...
    @staticmethod
    def mean() -> SimpleImputer: ...
class RandomForest:
    def __init__(self, n_trees: int = ..., max_depth: int | None = ...) -> None: ...
class LogisticRegression:
    def __init__(self, learning_rate: float = ..., epochs: int = ..., l2: float = ...) -> None: ...
class LinearRegression: ...
class Knn:
    def __init__(self, k: int = ...) -> None: ...
class Svc:
    def __init__(self, c: float = ..., gamma: float | None = ...) -> None: ...
    @staticmethod
    def rbf(gamma: float = ..., c: float = ...) -> Svc: ...
class NaiveBayes: ...
class OnnxModel:
    # device: "auto" (best accelerator, CPU fallback), "gpu" (require a GPU,
    # error if none), or "cpu". Any non-CPU device requires a millwright built
    # with the "gpu-inference" feature.
    def __init__(self, path: str, device: str | None = ...) -> None: ...

class Explainer:
    @staticmethod
    def kernel() -> Explainer: ...
    def nsamples(self, n: int) -> Explainer: ...
    def background(self, n: int) -> Explainer: ...

class Pipeline:
    def step(self, name: str, transformer: object) -> Pipeline: ...
    def estimator(self, name: str, estimator: object) -> Pipeline: ...
    def fit(self, data: FrameLike, labels: Sequence[float]) -> None: ...
    def predict(self, data: FrameLike) -> list[float]: ...
    def predict_proba(self, data: FrameLike) -> Frame: ...
    def evaluate(self, data: FrameLike, labels: Sequence[float]) -> dict[str, float]: ...
    def steps(self) -> list[str]: ...
    def explain(self, data: FrameLike, explainer: Explainer) -> list[tuple[str, float]]: ...
    def export_onnx(self, path: str) -> None: ...

class KFold:
    def __init__(self, k: int) -> None: ...
class StratifiedKFold:
    def __init__(self, k: int) -> None: ...
class GridSearch:
    def __init__(self, pipeline: Pipeline, params: Mapping[str, Sequence[int | float | bool]], *, cv: KFold | StratifiedKFold | None = ..., scoring: str = ...) -> None: ...
    def fit(self, data: FrameLike, labels: Sequence[float]) -> SearchResult: ...
class SearchResult:
    @property
    def best_score(self) -> float: ...
    def best_params(self) -> dict[str, int | float | bool]: ...
    def predict(self, data: FrameLike) -> list[float]: ...

class Voting:
    def __init__(self, kind: str = ..., task: str = ...) -> None: ...
    def add(self, name: str, pipeline: Pipeline) -> Voting: ...
    def fit(self, data: FrameLike, labels: Sequence[float]) -> None: ...
    def predict(self, data: FrameLike) -> list[float]: ...
    def predict_proba(self, data: FrameLike) -> Frame: ...
    def export_onnx(self, path: str) -> None: ...

class Bagging:
    def __init__(self, base: Pipeline, n_estimators: int = ..., seed: int = ..., task: str = ...) -> None: ...
    def fit(self, data: FrameLike, labels: Sequence[float]) -> None: ...
    def predict(self, data: FrameLike) -> list[float]: ...
    def export_onnx(self, path: str) -> None: ...

class Boosting:
    def __init__(self, base: Pipeline, n_estimators: int = ..., learning_rate: float = ..., seed: int = ...) -> None: ...
    def fit(self, data: FrameLike, labels: Sequence[float]) -> None: ...
    def predict(self, data: FrameLike) -> list[float]: ...
    def export_onnx(self, path: str) -> None: ...

class Stacking:
    def __init__(self, meta: Pipeline, cv: KFold | StratifiedKFold | int | None = ...) -> None: ...
    def base(self, name: str, pipeline: Pipeline) -> Stacking: ...
    def fit(self, data: FrameLike, labels: Sequence[float]) -> None: ...
    def predict(self, data: FrameLike) -> list[float]: ...
    def export_onnx(self, path: str) -> None: ...

class AutoML:
    @staticmethod
    def classifier() -> AutoML: ...
    @staticmethod
    def regressor() -> AutoML: ...
    def budget_trials(self, trials: int) -> AutoML: ...
    def budget_minutes(self, minutes: float) -> AutoML: ...
    def scoring(self, metric: str) -> AutoML: ...
    def cv(self, cv: KFold | StratifiedKFold | int) -> AutoML: ...
    def seed(self, seed: int) -> AutoML: ...
    def no_ensemble(self) -> AutoML: ...
    def ensemble_size(self, size: int) -> AutoML: ...
    def ensemble_kinds(self, kinds: Sequence[str]) -> AutoML: ...
    def prefer_ensemble_on_tie(self) -> AutoML: ...
    def parallel(self) -> AutoML: ...
    def deployability(self, policy: str) -> AutoML: ...
    def fit(self, data: FrameLike, labels: Sequence[float]) -> AutoMLResult: ...

class AutoMLResult:
    @property
    def best_label(self) -> str: ...
    @property
    def best_score(self) -> float: ...
    @property
    def is_ensemble(self) -> bool: ...
    def leaderboard(self) -> str: ...
    def leaderboard_entries(self) -> list[tuple[str, float]]: ...
    def candidate_failures(self) -> list[tuple[str, str]]: ...
    def ensemble_failures(self) -> list[tuple[str, str]]: ...
    def refit_failures(self) -> list[tuple[str, str]]: ...
    @property
    def elapsed_seconds(self) -> float: ...
    @property
    def attempted_trials(self) -> int: ...
    @property
    def completed_trials(self) -> int: ...
    @property
    def attempted_ensemble_trials(self) -> int: ...
    @property
    def completed_ensemble_trials(self) -> int: ...
    @property
    def budget_exhausted(self) -> bool: ...
    @property
    def ensemble_search_skipped_by_budget(self) -> bool: ...
    @property
    def supports_proba(self) -> bool: ...
    def best_pipeline(self) -> Pipeline | None: ...
    def best_model(self) -> FittedModel: ...
    def predict(self, data: FrameLike) -> list[float]: ...
    def predict_proba(self, data: FrameLike) -> Frame: ...
    def export_onnx(self, path: str) -> None: ...

class FittedModel:
    def predict(self, data: FrameLike) -> list[float]: ...
    def predict_proba(self, data: FrameLike) -> Frame: ...
    def export_onnx(self, path: str) -> None: ...