Science Score: 77.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README -
✓Academic publication links
Links to: wiley.com, zenodo.org -
✓Committers with academic emails
3 of 12 committers (25.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (8.0%) to scientific vocabulary
Keywords
Repository
PLS regression algorithm
Basic Info
- Host: GitHub
- Owner: mljs
- License: mit
- Language: JavaScript
- Default Branch: main
- Homepage: http://mljs.github.io/pls/
- Size: 6.89 MB
Statistics
- Stars: 11
- Watchers: 13
- Forks: 5
- Open Issues: 5
- Releases: 7
Topics
Metadata Files
README.md
Partial Least Squares (PLS), Kernel-based Orthogonal Projections to Latent Structures (K-OPLS) and NIPALS based OPLS
PLS regression algorithm based on the Yi Cao implementation:
K-OPLS regression algorithm based on this paper.
OPLS implementation based on the R package Metabomate using NIPALS factorization loop.
installation
$ npm i ml-pls
Usage
PLS
```js import PLS from 'ml-pls';
const X = [ [0.1, 0.02], [0.25, 1.01], [0.95, 0.01], [1.01, 0.96], ]; const Y = [ [1, 0], [1, 0], [1, 0], [0, 1], ]; const options = { latentVectors: 10, tolerance: 1e-4, };
const pls = new PLS(options); pls.train(X, Y); ```
OPLS-R
```js import { getNumbers, getClassesAsNumber, getCrossValidationSets, } from 'ml-dataset-iris'; import { OPLS } from 'ml-pls';
const cvFolds = getCrossValidationSets(7, { idx: 0, by: 'trainTest' }); const data = getNumbers(); const irisLabels = getClassesAsNumber();
const model = new OPLS(data, irisLabels, { cvFolds }); console.log(model.mode); // 'regression' ```
The OPLS class is intended for exploratory modeling, that is not for the creation of predictors. Therefore there is a built-in k-fold cross-validation loop and Q2y is an average over the folds.
js
console.log(model.model[0].Q2y);
should give 0.9209227614652857
OPLS-DA
```js import { getNumbers, getClasses, getCrossValidationSets, } from 'ml-dataset-iris'; import { OPLS } from 'ml-pls';
const cvFolds = getCrossValidationSets(7, { idx: 0, by: 'trainTest' }); const data = getNumbers(); const irisLabels = getClasses();
const model = new OPLS(data, irisLabels, { cvFolds }); console.log(model.mode); // 'discriminantAnalysis' console.log(model.model[0].auc); // 0.5366666666666665, ```
If for some reason a predictor is necessary the following code may serve as an example
Prediction
```js import { getNumbers, getClassesAsNumber, getCrossValidationSets, } from 'ml-dataset-iris'; import { OPLS } from 'ml-pls';
// get frozen folds for testing purposes const { testIndex, trainIndex } = getCrossValidationSets(7, { idx: 0, by: 'trainTest', })[0];
// Getting the data of selected fold const irisNumbers = getNumbers(); const testData = irisNumbers.filter((el, idx) => testIndex.includes(idx)); const trainingData = irisNumbers.filter((el, idx) => trainIndex.includes(idx));
// Getting the labels of selected fold const irisLabels = getClassesAsNumber(); const testLabels = irisLabels.filter((el, idx) => testIndex.includes(idx)); const trainingLabels = irisLabels.filter((el, idx) => trainIndex.includes(idx));
const model = new OPLS(trainingData, trainingLabels); console.log(model.mode); // 'discriminantAnalysis' const prediction = model.predict(testData, { trueLabels: testLabels }); // Get the predicted Q2 value console.log(prediction.Q2y); // 0.9247698398971457 ```
K-OPLS
```js import Kernel from 'ml-kernel'; import { KOPLS } from 'ml-pls';
const kernel = new Kernel('gaussian', { sigma: 25, });
const X = [ [0.1, 0.02], [0.25, 1.01], [0.95, 0.01], [1.01, 0.96], ]; const Y = [ [1, 0], [1, 0], [1, 0], [0, 1], ];
const cls = new KOPLS({ orthogonalComponents: 10, predictiveComponents: 1, kernel: kernel, });
cls.train(X, Y);
const { prediction, // prediction predScoreMat, // Score matrix over prediction predYOrthVectors, // Y-Orthogonal vectors over prediction } = cls.predict(X);
console.log(prediction); console.log(predScoreMat); console.log(predYOrthVectors); ```
API Documentation
License
Owner
- Name: ml.js
- Login: mljs
- Kind: organization
- Repositories: 112
- Profile: https://github.com/mljs
Machine learning and numerical analysis tools in JavaScript for Node.js and the Browser
Citation (CITATION.cff)
cff-version: 1.2.0
message: 'If you use this software, please cite it as below.'
title: 'Javascript implementation of Partial Least Squares (PLS), Kernel-based Orthogonal Projections to Latent Structures (K-OPLS) and NIPALS based OPLS'
abstract: 'The tools in this package allows to model linear relationships between a descriptor and response matrix using projection to latent structures with different approches using Javascript.'
repository-artifact: http://cheminfo.github.io/jcampconverter/
repository-code: https://github.com/cheminfo/jcampconverter
authors:
- family-names: 'Wist'
given-names: 'Julien'
affiliation: 'Universidad del Valle, Cali, Colombia'
orcid: 'https://orcid.org/0000-0002-3416-2572'
- family-names: 'Osorio'
given-names: 'Javier'
affiliation: 'Universidad del Valle, Cali, Colombia'
orcid: 'https://orcid.org/0000-0002-8278-3103'
- family-names: 'Zasso'
given-names: 'Michaël'
affiliation: 'Zakodium Sàrl, Switzerland'
orcid: 'https://orcid.org/0000-0001-5295-2159'
- family-names: 'Patiny'
given-names: 'Luc'
orcid: 'https://orcid.org/0000-0002-4943-2643'
license: MIT
keywords:
- PLS
- OPLS
- K-OPLS
- NIPALS
- Machine learning
- Supervised learning
doi: 10.5281/zenodo.7314529
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Committers
Last synced: almost 3 years ago
All Time
- Total Commits: 117
- Total Committers: 12
- Avg Commits per committer: 9.75
- Development Distribution Score (DDS): 0.65
Top Committers
| Name | Commits | |
|---|---|---|
| Jefferson | s****0@h****m | 41 |
| Michaël Zasso | t****s@p****m | 22 |
| Jefferson Hernández | j****4@g****m | 18 |
| Luc Patiny | l****c@p****m | 11 |
| mljs-bot | 7****t@u****m | 6 |
| Michaël Zasso | m****e@g****m | 4 |
| Javier Osorio M | 3****m@u****m | 4 |
| Luc Patiny | l****y@u****m | 3 |
| jobo322 | j****s@c****o | 3 |
| josoriom | j****o@c****o | 2 |
| jul | j****t@c****o | 2 |
| Wadjih Bencheikh | j****h@e****z | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 13
- Total pull requests: 30
- Average time to close issues: 9 months
- Average time to close pull requests: about 1 month
- Total issue authors: 8
- Total pull request authors: 9
- Average comments per issue: 0.46
- Average comments per pull request: 1.13
- Merged pull requests: 25
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- targos (3)
- jobo322 (2)
- JeffersonH44 (2)
- lpatiny (2)
- josoriom (1)
- loldrup (1)
- JiayiHong (1)
- DavidMartinOnGitHub (1)
Pull Request Authors
- mljs-bot (10)
- josoriom (6)
- JeffersonH44 (6)
- jwist (2)
- jobo322 (2)
- wadjih-bencheikh18 (1)
- santimirandarp (1)
- targos (1)
- lpatiny (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- npm 1,369 last-month
- Total docker downloads: 16
- Total dependent packages: 3
- Total dependent repositories: 24
- Total versions: 23
- Total maintainers: 7
npmjs.org: ml-pls
Partial least squares library
- Homepage: https://github.com/mljs/pls
- License: MIT
-
Latest release: 4.3.2
published over 2 years ago
Rankings
Maintainers (7)
Dependencies
- @types/jest ^27.4.1 development
- benchmark ^2.1.4 development
- cheminfo-build ^1.1.11 development
- eslint ^8.10.0 development
- eslint-config-cheminfo-typescript ^10.3.0 development
- jest ^27.5.1 development
- jest-matcher-deep-close-to ^3.0.2 development
- ml-dataset-iris ^1.2.1 development
- ml-dataset-metadata ^0.3.0 development
- ml-kernel ^3.0.0 development
- papaparse ^5.3.1 development
- prettier ^2.5.1 development
- rimraf ^3.0.2 development
- ts-jest ^27.1.3 development
- typescript ^4.6.2 development
- ml-array-mean ^1.1.6
- ml-confusion-matrix ^0.4.0
- ml-cross-validation ^1.3.0
- ml-matrix ^6.9.0
- ml-roc-multiclass ^0.2.0
- JamesIves/github-pages-deploy-action releases/v4 composite
- actions/checkout v2 composite
- zakodium/documentationjs-action v1 composite
- actions/checkout v2 composite
- actions/setup-node v2-beta composite
- zakodium/lactame-action v1 composite