ml-regression-exponential
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -0,1 +1,8 @@ | ||
## [2.1.0](https://github.com/mljs/regression-exponential/compare/v2.0.0...v2.1.0) (2021-05-10) | ||
### Features | ||
* update dependencies and add TS definition ([b2d5a84](https://github.com/mljs/regression-exponential/commit/b2d5a84cd4eb127dc2d4dc041d77ef1d2aa747bf)) | ||
# [2.0.0](https://github.com/mljs/regression-exponential/compare/v1.0.1...v2.0.0) (2019-06-29) | ||
@@ -2,0 +9,0 @@ |
'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var BaseRegression = require('ml-regression-base'); | ||
var BaseRegression__default = _interopDefault(BaseRegression); | ||
var SimpleLinearRegression = _interopDefault(require('ml-regression-simple-linear')); | ||
var SimpleLinearRegression = require('ml-regression-simple-linear'); | ||
class ExponentialRegression extends BaseRegression__default { | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var BaseRegression__default = /*#__PURE__*/_interopDefaultLegacy(BaseRegression); | ||
var SimpleLinearRegression__default = /*#__PURE__*/_interopDefaultLegacy(SimpleLinearRegression); | ||
class ExponentialRegression extends BaseRegression__default['default'] { | ||
constructor(x, y) { | ||
@@ -29,3 +31,3 @@ super(); | ||
A: this.A, | ||
B: this.B | ||
B: this.B, | ||
}; | ||
@@ -35,9 +37,6 @@ } | ||
toString(precision) { | ||
return ( | ||
`f(x) = ${ | ||
BaseRegression.maybeToPrecision(this.B, precision) | ||
} * e^(${ | ||
BaseRegression.maybeToPrecision(this.A, precision) | ||
} * x)` | ||
); | ||
return `f(x) = ${BaseRegression.maybeToPrecision( | ||
this.B, | ||
precision, | ||
)} * e^(${BaseRegression.maybeToPrecision(this.A, precision)} * x)`; | ||
} | ||
@@ -47,17 +46,11 @@ | ||
if (this.A >= 0) { | ||
return ( | ||
`f(x) = ${ | ||
BaseRegression.maybeToPrecision(this.B, precision) | ||
}e^{${ | ||
BaseRegression.maybeToPrecision(this.A, precision) | ||
}x}` | ||
); | ||
return `f(x) = ${BaseRegression.maybeToPrecision( | ||
this.B, | ||
precision, | ||
)}e^{${BaseRegression.maybeToPrecision(this.A, precision)}x}`; | ||
} else { | ||
return ( | ||
`f(x) = \\frac{${ | ||
BaseRegression.maybeToPrecision(this.B, precision) | ||
}}{e^{${ | ||
BaseRegression.maybeToPrecision(-this.A, precision) | ||
}x}}` | ||
); | ||
return `f(x) = \\frac{${BaseRegression.maybeToPrecision( | ||
this.B, | ||
precision, | ||
)}}{e^{${BaseRegression.maybeToPrecision(-this.A, precision)}x}}`; | ||
} | ||
@@ -81,3 +74,3 @@ } | ||
const linear = new SimpleLinearRegression(x, yl); | ||
const linear = new SimpleLinearRegression__default['default'](x, yl); | ||
er.A = linear.slope; | ||
@@ -84,0 +77,0 @@ er.B = Math.exp(linear.intercept); |
{ | ||
"name": "ml-regression-exponential", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Exponential Regression", | ||
"main": "lib/index.js", | ||
"module": "src/index.js", | ||
"types": "regression-exponential.d.ts", | ||
"files": [ | ||
"regression-exponential.d.ts", | ||
"lib", | ||
@@ -15,3 +17,3 @@ "src" | ||
"eslint-fix": "npm run eslint -- --fix", | ||
"prepublishOnly": "npm run compile", | ||
"prepack": "npm run compile", | ||
"test": "npm run test-coverage && npm run eslint", | ||
@@ -36,14 +38,13 @@ "test-only": "jest", | ||
"devDependencies": { | ||
"@babel/plugin-transform-modules-commonjs": "^7.4.4", | ||
"eslint": "^5.16.0", | ||
"eslint-config-cheminfo": "^1.20.1", | ||
"eslint-plugin-import": "^2.17.2", | ||
"eslint-plugin-jest": "^22.5.1", | ||
"jest": "^24.7.1", | ||
"rollup": "^1.10.1" | ||
"@babel/plugin-transform-modules-commonjs": "^7.14.0", | ||
"eslint": "^7.26.0", | ||
"eslint-config-cheminfo": "^5.2.3", | ||
"jest": "^26.6.3", | ||
"prettier": "^2.3.0", | ||
"rollup": "^2.47.0" | ||
}, | ||
"dependencies": { | ||
"ml-regression-base": "^2.0.1", | ||
"ml-regression-simple-linear": "^2.0.2" | ||
"ml-regression-base": "^2.1.3", | ||
"ml-regression-simple-linear": "^2.0.3" | ||
} | ||
} |
# regression-exponential | ||
[![NPM version][npm-image]][npm-url] | ||
[![build status][travis-image]][travis-url] | ||
[![build status][ci-image]][ci-url] | ||
[![npm download][download-image]][download-url] | ||
@@ -35,7 +35,7 @@ | ||
[npm-image]: https://img.shields.io/npm/v/ml-regression-exponential.svg?style=flat-square | ||
[npm-image]: https://img.shields.io/npm/v/ml-regression-exponential.svg | ||
[npm-url]: https://npmjs.org/package/ml-regression-exponential | ||
[travis-image]: https://img.shields.io/travis/mljs/regression-exponential/master.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/mljs/regression-exponential | ||
[download-image]: https://img.shields.io/npm/dm/ml-regression-exponential.svg?style=flat-square | ||
[ci-image]: https://github.com/mljs/regression-exponential/workflows/Node.js%20CI/badge.svg?branch=master | ||
[ci-url]: https://github.com/mljs/regression-exponential/actions?query=workflow%3A%22Node.js+CI%22 | ||
[download-image]: https://img.shields.io/npm/dm/ml-regression-exponential.svg | ||
[download-url]: https://npmjs.org/package/ml-regression-exponential |
@@ -23,3 +23,3 @@ import ExponentialRegression from '..'; | ||
A: -1, | ||
B: 1 | ||
B: 1, | ||
}); | ||
@@ -29,3 +29,3 @@ | ||
0.36787944117144233, | ||
Number.EPSILON | ||
Number.EPSILON, | ||
); | ||
@@ -37,5 +37,5 @@ | ||
A: -1, | ||
B: 1 | ||
B: 1, | ||
}); | ||
}); | ||
}); |
import BaseRegression, { | ||
checkArrayLength, | ||
maybeToPrecision | ||
maybeToPrecision, | ||
} from 'ml-regression-base'; | ||
@@ -27,3 +27,3 @@ import SimpleLinearRegression from 'ml-regression-simple-linear'; | ||
A: this.A, | ||
B: this.B | ||
B: this.B, | ||
}; | ||
@@ -33,9 +33,6 @@ } | ||
toString(precision) { | ||
return ( | ||
`f(x) = ${ | ||
maybeToPrecision(this.B, precision) | ||
} * e^(${ | ||
maybeToPrecision(this.A, precision) | ||
} * x)` | ||
); | ||
return `f(x) = ${maybeToPrecision( | ||
this.B, | ||
precision, | ||
)} * e^(${maybeToPrecision(this.A, precision)} * x)`; | ||
} | ||
@@ -45,17 +42,11 @@ | ||
if (this.A >= 0) { | ||
return ( | ||
`f(x) = ${ | ||
maybeToPrecision(this.B, precision) | ||
}e^{${ | ||
maybeToPrecision(this.A, precision) | ||
}x}` | ||
); | ||
return `f(x) = ${maybeToPrecision( | ||
this.B, | ||
precision, | ||
)}e^{${maybeToPrecision(this.A, precision)}x}`; | ||
} else { | ||
return ( | ||
`f(x) = \\frac{${ | ||
maybeToPrecision(this.B, precision) | ||
}}{e^{${ | ||
maybeToPrecision(-this.A, precision) | ||
}x}}` | ||
); | ||
return `f(x) = \\frac{${maybeToPrecision( | ||
this.B, | ||
precision, | ||
)}}{e^{${maybeToPrecision(-this.A, precision)}x}}`; | ||
} | ||
@@ -62,0 +53,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9737
6
8
171