Trainstation: Convenient Linear Model Training

1.2 · active · verified Fri Apr 17

Trainstation is a lightweight Python library designed for convenient training and evaluation of linear models. It acts as a simplified wrapper around `scikit-learn`'s linear models, streamlining common workflows. As of version 1.2, it focuses on ease of use for basic linear regression tasks, offering a straightforward API. It has an active release cadence, with minor enhancements and bug fixes.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize `LinearModel`, fit it to training data, make predictions, and evaluate its performance using `sklearn`'s `make_regression` dataset. It covers the core workflow for using `trainstation`.

from trainstation import LinearModel
from sklearn.datasets import make_regression
from sklearn.model_selection import train_test_split

# Generate synthetic data
X, y = make_regression(n_samples=1000, n_features=10, random_state=42)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Initialize and train the model
model = LinearModel()
model.fit(X_train, y_train)

# Make predictions and evaluate
predictions = model.predict(X_test)
score = model.evaluate(X_test, y_test)

print(f"Model score: {score:.4f}")

view raw JSON →