Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update dependencies #186

Merged
merged 5 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .eslintrc.yml

This file was deleted.

16 changes: 16 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import cheminfo from 'eslint-config-cheminfo';
import globals from 'globals';

export default [
...cheminfo,
{
languageOptions: {
globals: {
...globals.node,
},
},
rules: {
// "camelcase": "off",
}
}
]
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"description": "Machine learning tools",
"main": "src/index.js",
"scripts": {
"compile": "rollup -c",
"build": "cheminfo-build --root ML",
"compile": "rollup -c",
"eslint": "eslint src --cache",
"eslint-fix": "npm run eslint -- --fix",
"prepack": "npm run compile",
"prettier": "prettier --check src",
"prettier-write": "prettier --write src",
"test": "npm run test-only && npm run eslint && npm run prettier",
"test-only": "jest --coverage"
"test-only": "vitest run --coverage"
},
"files": [
"src",
Expand Down Expand Up @@ -71,38 +71,38 @@
"ml-distance-matrix": "^2.0.1",
"ml-fcnnls": "^3.0.0",
"ml-fnn": "^5.0.0",
"ml-gsd": "^12.1.3",
"ml-gsd": "^12.1.8",
"ml-hash-table": "^1.0.0",
"ml-hclust": "^3.1.0",
"ml-kernel": "^3.0.0",
"ml-kmeans": "^6.0.0",
"ml-knn": "^3.0.0",
"ml-levenberg-marquardt": "^4.1.3",
"ml-matrix": "^6.11.0",
"ml-matrix": "^6.12.0",
"ml-naivebayes": "^4.0.0",
"ml-ngmca": "^1.0.0",
"ml-pad-array": "^2.0.0",
"ml-pca": "^4.1.1",
"ml-performance": "^0.2.0",
"ml-pls": "^4.3.2",
"ml-random": "^1.0.1",
"ml-random": "^2.0.0",
"ml-random-forest": "^2.1.0",
"ml-regression": "^5.0.0",
"ml-regression": "^6.2.0",
"ml-savitzky-golay": "^5.0.0",
"ml-som": "^0.0.6",
"ml-sparse-matrix": "^2.1.0",
"ml-xsadd": "^2.0.0",
"ml-xsadd": "^3.0.1",
"num-sort": "^3.0.0"
},
"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.23.3",
"@types/jest": "^29.5.12",
"@babel/plugin-transform-modules-commonjs": "^7.25.7",
"@vitest/coverage-v8": "^2.1.3",
"cheminfo-build": "^1.2.0",
"eslint": "^8.56.0",
"eslint-config-cheminfo": "^9.1.1",
"eslint": "^9.12.0",
"eslint-config-cheminfo": "^12.0.1",
"esm": "^3.2.25",
"jest": "^29.7.0",
"prettier": "^3.2.4",
"rollup": "^4.9.6"
"prettier": "^3.3.3",
"rollup": "^4.24.0",
"vitest": "^2.1.3"
}
}
33 changes: 32 additions & 1 deletion src/__tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,39 @@
/* eslint-disable import/namespace */
import { it, describe, expect } from 'vitest';

import * as ML from '..';

describe('Check all properties are defined', () => {
const objectsAndNbKeys = {
Distance: 42,
Similarity: 11,
Array: 11,
ArrayXY: 10,
BitArray: 12,
KMeans: 2,
HClust: 2,
NaiveBayes: 2,
CrossValidation: 6,
FCNNLS: 2,
MatrixLib: 36,
GSD: 7,
};

it.each(Object.keys(ML))('Check %s', (key) => {
// if a function it should key should start with lowercase
// if a class it should key should start with uppercase
expect(ML[key]).toBeDefined();

if (objectsAndNbKeys[key]) {
expect(typeof ML[key]).toBe('object');
expect(Object.keys(ML[key]).length).toBe(objectsAndNbKeys[key]);
} else if (key[0] === key[0].toUpperCase()) {
// should be a class
expect(typeof ML[key]).toBe('function');
expect(typeof ML[key].prototype).toBe('object');
expect(ML[key].prototype?.constructor).toBe(ML[key]);
} else {
// should be function
expect(typeof ML[key]).toBe('function');
}
});
});
44 changes: 17 additions & 27 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,17 @@
/* eslint-disable import/order */
/* eslint-disable import/first */

import { DecisionTreeClassifier, DecisionTreeRegression } from 'ml-cart';
import {
RandomForestClassifier,
RandomForestRegression,
} from 'ml-random-forest';

// Try to keep this list in the same structure as the README.

// Unsupervised learning
export { PCA } from 'ml-pca';
import * as HClust from 'ml-hclust';
export { HClust };
import * as KMeans from 'ml-kmeans';
export { KMeans };

// Supervised learning
import * as NaiveBayes from 'ml-naivebayes';
export { NaiveBayes };

export { default as KNN } from 'ml-knn';
export { PLS, KOPLS, OPLS, oplsNipals } from 'ml-pls';
import * as CrossValidation from 'ml-cross-validation';
export { CrossValidation };

export { ConfusionMatrix } from 'ml-confusion-matrix';
export { DecisionTreeClassifier };
export { RandomForestClassifier };

// Artificial neural networks
export { default as FNN } from 'ml-fnn';
Expand All @@ -42,13 +28,9 @@ export {
TheilSenRegression,
RobustPolynomialRegression,
} from 'ml-regression';
export { DecisionTreeRegression };
export { RandomForestRegression };

// Optimization
export { levenbergMarquardt } from 'ml-levenberg-marquardt';
import * as FCNNLS from 'ml-fcnnls';
export { FCNNLS };

// Math
import * as MatrixLib from 'ml-matrix';
Expand All @@ -61,7 +43,6 @@ const {
QrDecomposition,
} = MatrixLib;
export {
MatrixLib,
Matrix,
SVD,
EVD,
Expand All @@ -72,10 +53,9 @@ export {

export { SparseMatrix } from 'ml-sparse-matrix';
export { default as Kernel } from 'ml-kernel';
import { distance, similarity } from 'ml-distance';
export { distance as Distance, similarity as Similarity };
export { distance as Distance, similarity as Similarity } from 'ml-distance';
export { default as distanceMatrix } from 'ml-distance-matrix';
export { default as XSadd } from 'ml-xsadd';
export { XSadd } from 'ml-xsadd';
export { nGMCA } from 'ml-ngmca';

// Statistics
Expand All @@ -89,9 +69,7 @@ export { default as BitArray } from 'ml-bit-array';
export { default as HashTable } from 'ml-hash-table';
export { default as padArray } from 'ml-pad-array';
export { default as binarySearch } from 'binary-search';
export { default as Random } from 'ml-random';
import * as GSD from 'ml-gsd';
export { GSD };
export { Random } from 'ml-random';

import min from 'ml-array-min';
import max from 'ml-array-max';
Expand Down Expand Up @@ -140,3 +118,15 @@ export const ArrayXY = {
equallySpaced,
filterX,
};
export { DecisionTreeClassifier, DecisionTreeRegression } from 'ml-cart';
export {
RandomForestClassifier,
RandomForestRegression,
} from 'ml-random-forest';
export * as HClust from 'ml-hclust';
export * as KMeans from 'ml-kmeans';
export * as NaiveBayes from 'ml-naivebayes';
export * as CrossValidation from 'ml-cross-validation';
export * as FCNNLS from 'ml-fcnnls';
export * as MatrixLib from 'ml-matrix';
export * as GSD from 'ml-gsd';