{"id":19267105,"url":"https://github.com/mljs/nmf","last_synced_at":"2025-10-05T14:25:52.658Z","repository":{"id":46933853,"uuid":"97470784","full_name":"mljs/nmf","owner":"mljs","description":"Non-negative Matrix Factorization (NMF)","archived":false,"fork":false,"pushed_at":"2023-01-12T10:18:51.000Z","size":937,"stargazers_count":3,"open_issues_count":12,"forks_count":2,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-01T15:41:55.527Z","etag":null,"topics":[],"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/mljs.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":"2017-07-17T11:52:40.000Z","updated_at":"2022-07-19T13:23:43.000Z","dependencies_parsed_at":"2023-02-09T11:16:29.378Z","dependency_job_id":null,"html_url":"https://github.com/mljs/nmf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fnmf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fnmf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fnmf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fnmf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mljs","download_url":"https://codeload.github.com/mljs/nmf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250120099,"owners_count":21378135,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-09T20:10:26.579Z","updated_at":"2025-10-05T14:25:47.624Z","avatar_url":"https://github.com/mljs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Non-negative Matrix Factorization (NMF)\n=======================================\n\nImplementation of the projected gradient methods for NMF. [Wikipedia](https://en.wikipedia.org/wiki/Non-negative_matrix_factorization)\n\nUsage\n=====\n\n```js\nconst NMF = require('../src');\nconst {Matrix} = require(\"ml-matrix\");\n\nlet w = new Matrix([[1,2,3],[4,5,6]]);\nlet h = new Matrix([[1,2],[3,4],[5,6]]);\nlet winit = new Matrix([[1,1,3],[4,5,6]]);\nlet hinit = new Matrix([[1,1],[3,4],[5,6]]);\n\nlet v = w.mmul(h);\n\nconst options = {\n  Winit: winit, \n  Hinit: hinit,\n  tol: 0.001, \n  maxIter: 10\n}\n\nlet result = NMF.nmf(v, options);\nlet w0 = result.W;\nlet h0 = result.H;\nconsole.log('W computed :', w0);\nconsole.log('H computed :', h0);\nconsole.log('W*H :', w0.mmul(h0));\nconsole.log('expected :', v);\n```\n\nReferences\n==========\n\n- C.-J. Lin. Projected gradient methods for non-negative matrix factorization. Neural Computation, 19(2007), 2756-2779.\n- WebAssembly implementation: https://github.com/firmenich/NNLSjs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmljs%2Fnmf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmljs%2Fnmf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmljs%2Fnmf/lists"}