-
Notifications
You must be signed in to change notification settings - Fork 131
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
Add residuals
prop, upgrade packages
#101
Conversation
Upgrade babel and build process. Update README Lint fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LMK if this looks fine.
@@ -18,25 +18,27 @@ | |||
], | |||
"scripts": { | |||
"clean": "rm -rf dist && mkdir dist", | |||
"lint": "./node_modules/.bin/eslint src/** tests/**", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./node_modules/.bin
prefix is unneeded.
Oddly, tests
was incorrect - the path was test
. This broke linting... (maybe latest eslint is more strict)
"lint": "./node_modules/.bin/eslint src/** tests/**", | ||
"test": "npm run lint && ./node_modules/.bin/nyc --reporter=lcov ./node_modules/.bin/mocha --compilers js:babel-core/register", | ||
"lint": "eslint src/** test/**", | ||
"test": "npm run lint && nyc --reporter=lcov mocha --require @babel/register", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgrade to babel and mocha deprecated --compilers
@@ -125,15 +125,17 @@ const methods = { | |||
const gradient = run === 0 ? 0 : round(rise / run, options.precision); | |||
const intercept = round((sum[1] / len) - ((gradient * sum[0]) / len), options.precision); | |||
|
|||
const predict = x => ([ | |||
const predict = (x) => ([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automatically fixed with yarn lint --fix
src/regression.js
Outdated
round(x, options.precision), | ||
round((gradient * x) + intercept, options.precision)] | ||
); | ||
|
||
const points = data.map(point => predict(point[0])); | ||
const points = data.map((point) => predict(point[0])); | ||
const residuals = points.map((point, index) => [point[0], point[1] - data[index][1]]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New functionality...
@@ -19,12 +19,13 @@ describe('models', () => { | |||
const example = models[model][name]; | |||
describe(name, () => { | |||
it(`correctly predicts ${name}`, () => { | |||
let result = regression[model](example.data, example.config); | |||
const result = regression[model](example.data, example.config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yarn lint --fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LMK if this looks fine.
.travis.yml
Outdated
@@ -4,7 +4,7 @@ env: | |||
- GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi) | |||
language: node_js | |||
node_js: | |||
- "6.1" | |||
- "8.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Travis complained about 6.1
@@ -1,41 +1,6 @@ | |||
const DEFAULT_OPTIONS = { order: 2, precision: 2, period: null }; | |||
const { round, deriveDataProperties } = require('./utils'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI tests complained about this file being too big, and that there was duplicate code.
Moved that to utils.js
cf79570
to
1a90d06
Compare
Pulled out the build upgrades from this code and in to PR #103 |
Add
residuals
prop.Upgrade babel and build process.
Update README
Lint fix