Skip to main content

Welcome to bun-scikit

A scikit-learn-inspired machine learning library for Bun and TypeScript, with native Zig acceleration for core training paths.

Quick Start

Get up and running with your first model in minutes

Installation

Install bun-scikit and configure native acceleration

API Reference

Browse the complete API documentation

Examples

Explore real-world use cases and code samples

Why bun-scikit?

Fast

Native Zig acceleration delivers 2-6x faster training compared to scikit-learn

Familiar API

Drop-in replacement for scikit-learn with the same patterns and methods

Type-Safe

Full TypeScript support with comprehensive type definitions

Performance Highlights

These benchmarks are from the heart disease dataset (1025 samples, 13 features) comparing bun-scikit to scikit-learn.
  • Regression: 2.2x faster fit, 2.4x faster predict
  • Classification: 2.5x faster fit, 2.6x faster predict
  • Random Forest: 6.4x faster fit, 3.9x faster predict
  • Decision Tree: 1.6x faster fit, 4.4x faster predict
With Zig backend enabled, Random Forest achieves 2.7x speedup over the JavaScript implementation.

Comprehensive ML Toolkit

bun-scikit provides a complete machine learning ecosystem:

Supervised Learning

  • Linear Models: LinearRegression, LogisticRegression, Ridge, Lasso, ElasticNet, SGDClassifier, SGDRegressor
  • Tree-Based: DecisionTreeClassifier, DecisionTreeRegressor, RandomForestClassifier, RandomForestRegressor
  • Ensemble Methods: AdaBoostClassifier, GradientBoostingClassifier, HistGradientBoostingClassifier, VotingClassifier, StackingClassifier, BaggingClassifier
  • Neighbors: KNeighborsClassifier, KNeighborsRegressor, RadiusNeighborsClassifier
  • SVM: SVC, SVR, LinearSVC, NuSVC, NuSVR, OneClassSVM
  • Naive Bayes: GaussianNB
  • Neural Networks: MLPClassifier, MLPRegressor

Unsupervised Learning

  • Clustering: KMeans, DBSCAN, AgglomerativeClustering, SpectralClustering, Birch, OPTICS
  • Dimensionality Reduction: PCA, TruncatedSVD, FastICA, NMF, KernelPCA, SparsePCA
  • Manifold Learning: TSNE, Isomap, LocallyLinearEmbedding, MDS
  • Anomaly Detection: IsolationForest, LocalOutlierFactor, OneClassSVM

Preprocessing & Feature Engineering

  • Scalers: StandardScaler, MinMaxScaler, RobustScaler, MaxAbsScaler, Normalizer, QuantileTransformer, PowerTransformer
  • Encoders: LabelEncoder, OneHotEncoder, OrdinalEncoder
  • Feature Selection: VarianceThreshold, SelectKBest, SelectPercentile, RFE, RFECV
  • Imputation: SimpleImputer, KNNImputer, IterativeImputer
  • Transformers: PolynomialFeatures, Binarizer, KBinsDiscretizer

Model Selection & Evaluation

  • Cross-Validation: crossValScore, crossValidate, crossValPredict, KFold, StratifiedKFold, GroupKFold
  • Hyperparameter Tuning: GridSearchCV, RandomizedSearchCV
  • Metrics: Comprehensive regression, classification, and clustering metrics
  • Pipelines: Pipeline, ColumnTransformer, FeatureUnion

Native Acceleration

bun-scikit includes prebuilt Zig binaries for:
Prebuilt binaries included for linux-x64
No additional build steps or bun pm trust required for standard installations.

Get Started

Ready to build your first model? Head over to the Quick Start guide to train your first model in under 5 minutes.
bun add bun-scikit

Build docs developers (and LLMs) love