{"id":42327351,"url":"https://github.com/proin/nodeml","last_synced_at":"2026-01-27T13:14:14.994Z","repository":{"id":71722468,"uuid":"73388822","full_name":"proin/nodeml","owner":"proin","description":"machine learning framework for node.js","archived":false,"fork":false,"pushed_at":"2017-04-23T10:53:16.000Z","size":8010,"stargazers_count":31,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-28T06:16:44.721Z","etag":null,"topics":["bayes","cnn","collaborative-filtering","kmeans","knn","machine-learning","ndcg","precision","recall","recommendation-engine"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/proin.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-10T14:19:43.000Z","updated_at":"2025-08-28T03:57:26.000Z","dependencies_parsed_at":"2023-02-28T22:01:10.114Z","dependency_job_id":null,"html_url":"https://github.com/proin/nodeml","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/proin/nodeml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proin%2Fnodeml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proin%2Fnodeml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proin%2Fnodeml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proin%2Fnodeml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/proin","download_url":"https://codeload.github.com/proin/nodeml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proin%2Fnodeml/sbom","scorecard":{"id":746261,"data":{"date":"2025-08-11","repo":{"name":"github.com/proin/nodeml","commit":"0c39872a651f87cc229fde4685963df3a80552fc"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/18 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":"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":"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":"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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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"}}]},"last_synced_at":"2025-08-22T18:51:04.251Z","repository_id":71722468,"created_at":"2025-08-22T18:51:04.252Z","updated_at":"2025-08-22T18:51:04.252Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28813345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T12:25:15.069Z","status":"ssl_error","status_checked_at":"2026-01-27T12:25:05.297Z","response_time":168,"last_error":"SSL_read: 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":["bayes","cnn","collaborative-filtering","kmeans","knn","machine-learning","ndcg","precision","recall","recommendation-engine"],"created_at":"2026-01-27T13:14:14.260Z","updated_at":"2026-01-27T13:14:14.989Z","avatar_url":"https://github.com/proin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nodeml\n\n\u003e Machine Learning Framework for Node\n\n## Summary\n\n- Feature Selection\n\t- `nodeml.feature.tfidf`: [tfidf](https://github.com/proin/nodeml/blob/master/example/tfidf.js)\n- Classification\n    - `nodeml.Bayes`: [Bayes](https://github.com/proin/nodeml/blob/master/example/nodeml.bayes.js)\n    - `nodeml.kNN`: [k-Nearest Neighbor](https://github.com/proin/nodeml/blob/master/example/nodeml.knn.js)\n    - `nodeml.CNN`: [Convolutional Neural Network (CNN)](https://github.com/proin/nodeml/blob/master/example/nodeml.cnn.js)\n- Clustering\n    - `nodeml.kMeans`: [k-Means](https://github.com/proin/nodeml/blob/master/example/nodeml.kmeans.js)\n- Recommendation\n    - `nodeml.CF`: [User based Collaborative Filtering](https://github.com/proin/nodeml/blob/master/example/nodeml.cf.js)\n- Evaluation\n    - `nodeml.accuracy`: Precision, Recall, F-Measure, Accuracy\n    - `nodeml.ndcg`: NDCG\n\n## Todo\n\n- DBSCAN\n- Support Vector Machine\n- LSTM\n- Logistic Regression\n\n## Installation\n\ninstallation on your project\n\n```sh\nnpm install --save nodeml\n```\n\nuse example\n\n```js\nconst {Bayes} = require('nodeml');\nlet bayes = new Bayes();\n\nbayes.train({'fun': 3, 'couple': 1}, 'comedy');\nbayes.train({'couple': 1, 'fast': 1, 'fun': 3}, 'comedy');\nbayes.train({'fast': 3, 'furious': 2, 'shoot': 2}, 'action');\nbayes.train({'furious': 2, 'shoot': 4, 'fun': 1}, 'action');\nbayes.train({'fly': 2, 'fast': 3, 'shoot': 2, 'love': 1}, 'action');\n\nlet result = bayes.test({'fun': 3, 'fast': 3, 'shoot': 2});\nconsole.log(result); // this print {answer: , score: }\n```\n\n## Document\n\n### nodeml.sample\n\nSample dataset for test\n\n```js\nconst {sample} = require('nodeml');\n\n// bbc: Function() =\u003e { dataset: [ {} , ... ], labels: [ ... ] }\n// bbc news dataset, sparse matrix\nconst bbc = sample.bbc();\n\n// yeast: Function() =\u003e { dataset: [ [] , ... ], labels: [ ... ] }\n// yeast dataset, array data\nconst yeast = sample.yeast();\n\n// iris: Function() =\u003e { dataset: [ [] , ... ], labels: [ ... ] }\n// iris dataset, array data\nconst iris = sample.iris();\n\n// movie: Function() =\u003e [{ movie_id: '1', user_id: '97', rating: '5', like: '17' }, ...]\n// movie dataset, array data\nconst movie = sample.movie();\n```\n---\n\n### nodeml.Bayes\n\nNaive Bayes classifier\n\n```js\nconst {Bayes} = require('nodeml');\nlet bayes = new Bayes(); // this is bayes classfier\n```\n\n#### train: Function(data, label) =\u003e model\n\ntraining bayes classifier\n\n```js\nbayes.train([0.2, 0.5, 0.7, 0.4], 1);       \nbayes.train({ 'my': 20, 'home': 30 }, 1);   \n\n// training bulk\nbayes.train([[2, 5,], [2, 1,]], [1, 2]);    \nbayes.train([{}, {}], [1, 2]);              \n```\n\n#### test: Function(data) =\u003e { answer: string, score: {} }\n\nclassify document\n\n```js\nlet result = bayes.test([2, 5, 1, 4]);\nlet result = bayes.test({'fun': 3, 'fast': 3, 'shoot': 2});\n```\n\n#### getModel: Function () =\u003e model\n\nget trained result\n\n```js\nlet model = bayes.getModel();\nlet str = JSON.stringify(model);\n```\n\n#### setModel: Function (model)\n\nset pre-trained\n\n```js\nbayes.setModel(JSON.parse(str));\n```\n\n---\n\n### nodeml.kNN\n\nk-Nearest Neighbor Classifier\n\n```js\nconst {kNN} = require('nodeml');\nlet knn = new kNN();\n```\n\n#### train: Function(dataset, labels) =\u003e model\n\ntraining\n\n```js\nknn.train([0.2, 0.5, 0.7, 0.4], 1);       \nknn.train({ 'my': 20, 'home': 30 }, 1);   \n\n// training bulk\nknn.train([[2, 5,], [2, 1,]], [1, 2]);    \nknn.train([{ 'my': 20, 'home': 30 }, { 'my': 5, 'home': 10 }], [1, 2]);              \n```\n\n#### test: Function(dataset, k) =\u003e [ class1, class2, class1 ]\n\nclassify document (default k is 3)\n\n```js\nlet result = knn.test([2, 5, 1, 4]);\nlet result = knn.test({'fun': 3, 'fast': 3, 'shoot': 2}, 5);\n```\n\n#### getModel: Function () =\u003e model\n\nget trained result\n\n```js\nlet model = knn.getModel();\nlet str = JSON.stringify(model);\n```\n\n#### setModel: Function (model)\n\nset pre-trained\n\n```js\nknn.setModel(JSON.parse(str));\n```\n\n---\n\n### nodeml.CNN\n\nConvolutional Neural Network, based [convnetjs](http://cs.stanford.edu/people/karpathy/convnetjs)\n\n```js\nconst {CNN} = require('nodeml');\nlet cnn = new CNN();\n```\n\n#### configure: Function (options)\n\noptions object refer `trainer option` at [convnetjs](http://cs.stanford.edu/people/karpathy/convnetjs/docs.html)\n\n```js\ncnn.configure({learning_rate: 0.1, momentum: 0.001, batch_size: 5, l2_decay: 0.0001});\n```\n\n#### setModel: Function (layer or model)\n\nlayer refer at [convnetjs](http://cs.stanford.edu/people/karpathy/convnetjs/docs.html)\n\n```js\nvar layer = [];\nlayer.push({type: 'input', out_sx: 1, out_sy: 1, out_depth: 8});\nlayer.push({type: 'svm', num_classes: 10});\n\ncnn.makeLayer(layer);\n\n// set pre-trained\ncnn.setModel(JSON.parse(str));\n```\n\n#### train: Function (data, label)\n\n```js\ncnn.train([0.2, 0.5, 0.7, 0.4], 1);       \ncnn.train({ 'my': 20, 'home': 30 }, 1);   \n\n// training bulk\ncnn.train([[2, 5,], [2, 1,]], [1, 2]);    \ncnn.train([{}, {}], [1, 2]);   \n```\n\n#### test: Function(data) =\u003e { answer: string, score: {} }\n\nclassify document\n\n```js\nlet result = cnn.test([2, 5, 1, 4]);\nlet result = cnn.test({'fun': 3, 'fast': 3, 'shoot': 2});\n```\n\n#### getModel: Function () =\u003e model\n\nget trained result\n\n```js\nlet model = cnn.getModel();\nlet str = JSON.stringify(model);\n```\n---\n\n### nodeml.kMeans\n\nk-Means Clustering\n\n```js\nconst {kMeans} = require('nodeml');\nlet kmeans = new kMeans();\n```\n\n#### train: Function(dataset, options) =\u003e model\n\ntraining\n\n```js\nkmeans.train([[2, 5,], [2, 1,]], {\n    k: 10, dm: 0.00001, iter: 100,  \n    proc: (iter, j, d)=\u003e { console.log(iter, j, d); }\n});\n```\n\n| options | description | type | default |\n|---|---|---|---|\n| init | cluster initialize function: `random`, `fuzzy (preparing)` | string | 'random' |\n| k | number of cluster | integer | 3 |\n| dm | distortion measure | float | 0.00 |\n| iter | maximum iteration | integer | unlimited |\n| labels | supervised learning, if labels exists, detect k automatically | array | null |\n| proc | process handler | function | null |\n\n#### test: Function(dataset) =\u003e [ class1, class2, class1 ]\n\nclassify document (default k is 3)\n\n```js\nlet result = kmeans.test([[2, 5,], [2, 1,]]);\n```\n\n#### getModel: Function () =\u003e model\n\nget trained result\n\n```js\nlet model = kmeans.getModel();\nlet str = JSON.stringify(model);\n```\n\n#### setModel: Function (model)\n\nset pre-trained\n\n```js\nkmeans.setModel(JSON.parse(str));\n```\n\n---\n\n### nodeml.CF\n\nCollaborative Filtering Function\n\n```js\nconst {CF, evaluation} = require('../index');\n\nlet train = [[1, 1, 2], [1, 2, 2], [1, 4, 5], [2, 3, 2],\n    [2, 5, 1], [3, 1, 2], [3, 2, 3], [3, 3, 3]];\nlet test = [[3, 4, 1]];\n\nconst cf = new CF();\ncf.train(train);\nlet gt = cf.gt(test);\nlet result = cf.recommendGT(gt, 1);\n\nlet ndcg = evaluation.ndcg(gt, result);\n\nconsole.log(gt);\nconsole.log(result);\nconsole.log(ndcg);\n```\n\n#### train: Function\n\n---\n\n### nodeml.evaluate\n\n#### accuracy: Function (gt, result) =\u003e {precision, recall, f-measure, accuracy}\n\n```js\nlet {evaluate} = require('nodeml');\n\nlet original = [1, 2, 1, 1, 3]; // original label\nlet result = [1, 1, 2, 1, 3]; // train result label\n\n// exec evaluate, this contains accuracy, micro/macro precision/recall/f-measure\nlet accuracy = evaluate.accuracy(original, result);\n```\n\n#### ndcg: Function (gt, result) =\u003e 0 ~ 1 ndcg value\n\n```js\nlet {CF, evaluate} = require('nodeml');\nconst cf = new CF();\nlet gt = cf.gt(test, 'user_id', 'movie_id', 'rating');\n\nlet result = cf.recommandToUsers(users, 40);\n\nlet ndcg = evaluation.ndcg(gt, result);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproin%2Fnodeml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproin%2Fnodeml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproin%2Fnodeml/lists"}