GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - kVeyra/sklearn-java: Java reimplementation of Python's scikit-learn with behavioral compatibility, numerical accuracy, and idiomatic Java design

BranchesTags
Open more actions menu

Latest commit

 

History

22 Commits
22 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
cluster
cluster
 
 
config
config
 
 
core
core
 
 
covariance
covariance
 
 
datasets
datasets
 
 
decomposition
decomposition
 
 
dummy
dummy
 
 
ensemble
ensemble
 
 
feature_selection
feature_selection
 
 
gradle/wrapper
gradle/wrapper
 
 
impute
impute
 
 
isotonic
isotonic
 
 
linear_model
linear_model
 
 
math
math
 
 
metrics
metrics
 
 
model_selection
model_selection
 
 
multiclass
multiclass
 
 
naive_bayes
naive_bayes
 
 
neighbors
neighbors
 
 
neural_network
neural_network
 
 
pipeline
pipeline
 
 
preprocessing
preprocessing
 
 
semi_supervised
semi_supervised
 
 
svm
svm
 
 
tree
tree
 
 
utils
utils
 
 
.gitignore
.gitignore
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
COVERAGE_PLAN.md
COVERAGE_PLAN.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

sklearn-java

Build Coverage Javadoc Java License GitHub Discussions GitHub stars

A production-quality Java reimplementation of Python's scikit-learn. Covers the core ML API surface (in progress) with behavioral compatibility, numerical accuracy to 1e-8, and pure Java — no Python, JNI, or NumPy.

Why sklearn-java?

  • Drop-in replacement mindset — API mirrors sklearn exactly: .fit(), .predict(), .transform(), .score()
  • Numerical accuracy — every algorithm validated against Python sklearn with 1e-8 tolerance
  • Pure Java — zero Python dependencies, zero JNI, zero external native libs
  • Modern Java — Java 21, sealed interfaces, records, pattern matching
  • 100% coverage goal — targeting 400+ public classes matching sklearn's API surface

Modules

Module Status Coverage
math ✅ Complete Vectors, dense matrices, random generators
core ✅ Complete Estimator/Predictor/Transformer interfaces, Pipeline
preprocessing ✅ Complete StandardScaler, MinMaxScaler, Normalizer, RobustScaler, MaxAbsScaler, OneHotEncoder, LabelEncoder, OrdinalEncoder, PolynomialFeatures, Binarizer, KBinsDiscretizer, FunctionTransformer
linear_model ✅ Complete LinearRegression, Ridge, Lasso, ElasticNet, LogisticRegression, SGDClassifier, SGDRegressor, RidgeCV, BayesianRidge, HuberRegressor, Perceptron, PassiveAggressiveClassifier/Regressor, LassoCV, ElasticNetCV, RidgeClassifier, RidgeClassifierCV
tree ✅ Complete DecisionTreeClassifier/Regressor, ExtraTreeClassifier/Regressor (random thresholds)
ensemble ✅ Complete RandomForest, AdaBoost, GradientBoosting, Bagging, Voting, Stacking, IsolationForest, ExtraTrees, ExtraTreesEmbedding, HistGradientBoosting
svm ✅ Complete SVC (one-vs-one), SVR, LinearSVC, linear/poly/RBF/sigmoid kernels
naive_bayes ✅ Complete GaussianNB, MultinomialNB, BernoulliNB
neighbors ✅ Complete KNeighborsClassifier, KNeighborsRegressor, NearestNeighbors, RadiusNeighborsClassifier/Regressor, LocalOutlierFactor, KernelDensity
cluster ✅ Complete KMeans (Lloyd's + k-means++), DBSCAN
feature_selection ✅ Complete VarianceThreshold, SelectKBest, SelectPercentile, GenericUnivariateSelect, RFE, SelectFromModel, FScoring (f_classif, f_regression, r_regression)
neural_network ✅ Complete MLPClassifier, MLPRegressor (ReLU/tanh/logistic, SGD/Adam, backprop)
dummy ✅ Complete DummyClassifier, DummyRegressor
impute ✅ Complete SimpleImputer (mean/median/most_frequent/constant)
decomposition ✅ Complete PCA
metrics ✅ Complete ClassificationMetrics, RegressionMetrics, RankingMetrics, PairwiseMetrics, ClusteringMetrics
model_selection ✅ Complete KFold, StratifiedKFold, LeaveOneOut, RepeatedKFold, CrossValidation, GridSearchCV, TrainTestSplit
pipeline ✅ Complete Pipeline, FeatureUnion, make_pipeline
utils ✅ Complete Validation, matrix/vector utilities
datasets ❌ Not started Toy datasets will be added in Phase C

Quick Start

// Standardize features
StandardScaler scaler = new StandardScaler();
Matrix X_scaled = scaler.fitTransform(X_train);

// Train a classifier
RandomForestClassifier rf = new RandomForestClassifier(100, 5);
rf.fit(X_scaled, y_train);

// Predict & evaluate
Vector preds = rf.predict(scaler.transform(X_test));
double acc = ClassificationMetrics.accuracy(y_test, preds);
// Grid search with cross-validation
GridSearchCV grid = new GridSearchCV(
    new SVC(),
    Map.of("C", new double[]{0.1, 1.0, 10.0}, "kernel", new String[]{"rbf", "linear"}),
    5
);
grid.fit(X_train, y_train);
System.out.println("Best params: " + grid.bestParams());
// Neural network classifier
MLPClassifier mlp = new MLPClassifier(new int[]{64, 32}, "relu", "adam", 200);
mlp.fit(X_train, y_train);
Vector preds = mlp.predict(X_test);
double acc = ClassificationMetrics.accuracy(y_test, preds);

Building

export JAVA_HOME=/opt/homebrew/opt/openjdk@21
./gradlew build

Testing

./gradlew test
./gradlew jacocoTestReport  # coverage report at build/reports/

Contributing

We welcome contributions! See CONTRIBUTING.md for:

  • Branch strategy (feature branches → develop → main)
  • Coding standards (Java 21, Google Java Format)
  • Validation requirements (1e-8 tolerance against sklearn)
  • PR checklist

Looking for good first issues? Check the issue tracker and the COVERAGE_PLAN.md for remaining algorithms.

Roadmap

Phase Focus Status
Phase A1 Metrics + Model Selection ✅ Complete
Phase A2 Ensemble Methods ✅ Complete
Phase A3 Linear Models (SGD, RidgeCV, Bayesian, Huber, Perceptron, PA, CV variants) ✅ Complete
Phase A4 Naive Bayes + Neighbors (full: Multinomial/Bernoulli, NearestNeighbors, RadiusNeighbors, LOF, KernelDensity) ✅ Complete
Phase A5 Neural Network (MLP) + Feature Selection (SelectKBest, RFE, SelectFromModel) 🔜 Written, testing pending
Phase B Manifold, Impute, Pipeline (full) 📋 Planned
Phase C Decomposition, Covariance, Cross-decomposition 📋 Planned
Phase D Semi-supervised, Multi-output, Niche estimators 📋 Planned

See COVERAGE_PLAN.md for full 400+ item breakdown.

License

Apache 2.0 — see LICENSE.

Stats

Alt

About

Java reimplementation of Python's scikit-learn with behavioral compatibility, numerical accuracy, and idiomatic Java design

github.com/kVeyra/sklearn-java

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing
Activity
Custom properties

Stars

7 stars

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.