{"id":37079779,"url":"https://github.com/shotahorii/bareml","last_synced_at":"2026-01-14T09:39:12.725Z","repository":{"id":57413959,"uuid":"266615314","full_name":"shotahorii/bareml","owner":"shotahorii","description":"Machine learning \u0026 deep learning implementation from scratch, depending only on numpy.","archived":false,"fork":false,"pushed_at":"2020-12-02T00:21:05.000Z","size":19323,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-02T23:21:47.366Z","etag":null,"topics":["data-science","deep-learning","deep-neural-networks","machine-learning","machine-learning-algorithms","machine-learning-from-scratch","statistical-models"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shotahorii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-24T20:00:49.000Z","updated_at":"2024-07-10T21:06:13.000Z","dependencies_parsed_at":"2022-08-29T15:22:47.119Z","dependency_job_id":null,"html_url":"https://github.com/shotahorii/bareml","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shotahorii/bareml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shotahorii%2Fbareml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shotahorii%2Fbareml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shotahorii%2Fbareml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shotahorii%2Fbareml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shotahorii","download_url":"https://codeload.github.com/shotahorii/bareml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shotahorii%2Fbareml/sbom","scorecard":{"id":820775,"data":{"date":"2025-08-11","repo":{"name":"github.com/shotahorii/bareml","commit":"10fe8c9d5811bfcb9ee303aba2087524574681e6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: containerImage not pinned by hash: Dockerfile:3: pin your Docker image by updating jupyter/scipy-notebook to jupyter/scipy-notebook@sha256:fca4bcc9cbd49d9a15e0e4df6c666adf17776c950da9fa94a4f0a045d5c4ad33","Warn: pipCommand not pinned by hash: Dockerfile:13","Warn: pipCommand not pinned by hash: Dockerfile:14","Warn: pipCommand not pinned by hash: Dockerfile:15","Info:   0 out of   1 containerImage dependencies pinned","Info:   0 out of   3 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":3,"reason":"7 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2018-34 / GHSA-2fc2-6r4j-p65h","Warn: Project is vulnerable to: PYSEC-2021-856 / GHSA-5545-2q6w-2gh6","Warn: Project is vulnerable to: PYSEC-2019-108 / GHSA-9fq2-x9r6-wfmf","Warn: Project is vulnerable to: PYSEC-2018-33 / GHSA-cw6w-4rcx-xphc","Warn: Project is vulnerable to: PYSEC-2021-857 / GHSA-f7c7-j99h-c22f","Warn: Project is vulnerable to: GHSA-fpfv-jqm9-f5jm","Warn: Project is vulnerable to: PYSEC-2017-1 / GHSA-frgw-fgh6-9g52"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T15:29:51.238Z","repository_id":57413959,"created_at":"2025-08-23T15:29:51.238Z","updated_at":"2025-08-23T15:29:51.238Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28416120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-science","deep-learning","deep-neural-networks","machine-learning","machine-learning-algorithms","machine-learning-from-scratch","statistical-models"],"created_at":"2026-01-14T09:39:12.108Z","updated_at":"2026-01-14T09:39:12.715Z","avatar_url":"https://github.com/shotahorii.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/shotahorii/bareml.svg?branch=master)](https://travis-ci.org/shotahorii/bareml)\n[![PyPI version](https://badge.fury.io/py/bareml.svg)](https://badge.fury.io/py/bareml)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/bareml)\n\n![Logo](/images/logo.png)\n\n**bareml** is a set of \"bare\" implementations of machine learning / deep learning algorithms from scratch (only depending on numpy) in Python. \"bare\" means to aim at:\n1. Code as a direct translation of the algorithm / formula\n2. With minimum error handling and efficiency gain tricks\n\nTo maximise understandability of the code, interface of modules in `bareml/machinelearning/` is aligned to *Scikit-learn*, and interface of modules in `bareml/deeplearning/` is aligned to *PyTorch*, as seen in below 2 examples.\n\nExample1: \n```\nfrom bareml.machinelearning.utils.model_selection import train_test_split\nfrom bareml.machinelearning.supervised import KernelRidge\n\n# assume the data X, y are defined\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=0)\n\nreg = KernelRidge(alpha=1, kernel='rbf')\nreg.fit(X_train, y_train)\ny_pred = reg.predict(X_test)\nprint(reg.score(X_test, y_test))\n```\n\nExample2:\n```\nfrom bareml.deeplearning import layers as nn\nfrom bareml.deeplearning import functions as F\n\nclass Net(nn.Module):\n    def __init__(self):\n        super().__init__()\n        self.conv1 = nn.Conv2d(in_channels=1, out_channels=32, kernel_size=3, stride=1)\n        self.conv2 = nn.Conv2d(in_channels=32, out_channels=64, kernel_size=3, stride=1)\n        self.dropout1 = nn.Dropout(p=0.25)\n        self.dropout2 = nn.Dropout(p=0.5)\n        self.fc1 = nn.Linear(in_features=33856, out_features=128)\n        self.fc2 = nn.Linear(in_features=128, out_features=10)\n\n    def forward(self, x):\n        x = self.conv1(x)\n        x = F.relu(x)\n        x = self.conv2(x)\n        x = F.relu(x)\n        x = F.max_pool2d(x, 2)\n        x = self.dropout1(x)\n        x = x.flatten()\n        x = self.fc1(x)\n        x = F.relu(x)\n        x = self.dropout2(x)\n        x = self.fc2(x)\n        return x\n```\n\n## Installation \n```\n$ pip install bareml\n```\nor\n```\n$ git clone https://github.com/shotahorii/bareml.git\n$ cd bareml\n$ python setup.py install\n```\n\n## Dependencies \n\n**Mandatory**\n- numpy  \n\n**Optional**\n- cupy\n- PIL\n- matplotlib\n- graphviz\n\n## Examples\n#### Generating handwriting digits by GAN\n[[Google Colab]](https://github.com/shotahorii/bareml/blob/master/examples/GAN.ipynb)\n\n![gif](https://media.giphy.com/media/FaQuqE6Otws0EL8RQ5/giphy.gif)\n\n#### Word embeddings by word2vec (CBoW) \n[[Google Colab]](https://github.com/shotahorii/bareml/blob/master/examples/word2vec.ipynb)\n\n![img](/images/word2vec_example.png)\n\n#### Cart Pole Problem with Q-Learning\n[[Notebook]](https://github.com/shotahorii/bareml/blob/master/examples/q_learning.ipynb)\n\n![gif](https://media.giphy.com/media/0YSkWnyRmFdLth4YMg/giphy.gif)\n\n#### Clustering by DBSCAN\n[[Notebook]](https://github.com/shotahorii/bareml/blob/master/examples/DBSCAN.ipynb)\n\n![gif](https://media.giphy.com/media/KUAzkpSBJ4QmPsX9Kp/giphy.gif)\n\n#### Fitting Sin function with Polynomial Linear Regression\n[[Notebook]](https://github.com/shotahorii/bareml/blob/master/examples/PolynomialLinearRegression.ipynb)\n\n![gif](https://media.giphy.com/media/x5QYnmM7asaoT9sCmr/giphy.gif)\n\n## Implementations \n\n### Deep Learning\n- [Pytorch-like Deep Learning Framework](https://github.com/shotahorii/bareml/blob/master/bareml/deeplearning/)\n\n### Supervised Learning\n- [Bernoulli Naive Bayes](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/supervised/naive_bayes.py)\n- [Decision Trees](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/supervised/decision_trees.py)\n- [Elastic Net](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/supervised/linear_regression.py)\n- [Gaussian Naive Bayes](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/supervised/naive_bayes.py)\n- [Generalised Linear Model](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/supervised/glm.py)\n- [K Nearest Neighbors](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/supervised/knn.py)\n- [Kernel Ridge Regression](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/supervised/kernel_regression.py)\n- [Lasso Regression](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/supervised/linear_regression.py)\n- [Linear Regression](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/supervised/linear_regression.py)\n- [Logistic Regression](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/supervised/logistic_regression.py)\n- [Perceptron](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/supervised/perceptron.py)\n- [Poisson Regression](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/supervised/glm.py)\n- [Ridge Regression](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/supervised/linear_regression.py)\n\n### Unsupervised Learning\n- [KMeans (KMeans++)](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/unsupervised/kmeans.py)\n- [DBSCAN](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/unsupervised/dbscan.py)\n\n### Ensemble Learning \n- [AdaBoost](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/ensemble/adaboost.py)\n- [AdaBoost M1](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/ensemble/adaboost.py)\n- [AdaBoost Samme](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/ensemble/adaboost.py)\n- [AdaBoost RT](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/ensemble/adaboost.py)\n- [AdaBoost R2](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/ensemble/adaboost.py)\n- [Bagging](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/ensemble/baggings.py)\n- [Gradient Boosting](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/ensemble/gradient_boosting.py)\n- [Random Forest](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/ensemble/baggings.py)\n- [Stacking](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/ensemble/stacking.py)\n- Voting\n- [XGBoost](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/ensemble/xgboost.py)\n\n### Utilities\n- [Preprocessing (Scaler, Encoder etc)](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/utils/preprocessing.py)\n- [Metrics](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/utils/metrics.py)\n- [Kernel functions](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/utils/kernels.py)\n- [Probability Distributions](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/utils/probabilities.py)\n- [Model Selection (KFold etc)](https://github.com/shotahorii/bareml/blob/master/bareml/machinelearning/utils/model_selection.py)\n\n\n## References \n- Deep learning programs are based on O'Reilly Japan's book \"Deep learning from scratch 3\" (Koki Saitoh) and its implementation [Dezero](https://github.com/oreilly-japan/deep-learning-from-scratch-3).\n- References of machine learning programs are documented in each source file, but mostly based on original papers, \"Pattern Recognition and Machine Learning\" (Christopher M. Bishop) and/or \"Machine Learning: A Probabilistic Perspective\" (Kevin P. Murphy).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshotahorii%2Fbareml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshotahorii%2Fbareml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshotahorii%2Fbareml/lists"}