Skip to content

Add residuals prop, upgrade packages#101

Closed
jazeee wants to merge 2 commits into
Tom-Alexander:masterfrom
jazeee:master
Closed

Add residuals prop, upgrade packages#101
jazeee wants to merge 2 commits into
Tom-Alexander:masterfrom
jazeee:master

Conversation

@jazeee

@jazeee jazeee commented Jan 1, 2020

Copy link
Copy Markdown

Add residuals prop.
Upgrade babel and build process.
Update README
Lint fix

Upgrade babel and build process.
Update README
Lint fix

@jazeee jazeee left a comment

Copy link
Copy Markdown
Author

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.

Comment thread package.json
],
"scripts": {
"clean": "rm -rf dist && mkdir dist",
"lint": "./node_modules/.bin/eslint src/** tests/**",

Copy link
Copy Markdown
Author

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)

Comment thread package.json
"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",

Copy link
Copy Markdown
Author

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

Comment thread src/regression.js
const intercept = round((sum[1] / len) - ((gradient * sum[0]) / len), options.precision);

const predict = x => ([
const predict = (x) => ([

Copy link
Copy Markdown
Author

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

Comment thread src/regression.js Outdated

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]]);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New functionality...

Comment thread test/regression.test.js
describe(name, () => {
it(`correctly predicts ${name}`, () => {
let result = regression[model](example.data, example.config);
const result = regression[model](example.data, example.config);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yarn lint --fix

@jazeee jazeee left a comment

Copy link
Copy Markdown
Author

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.

Comment thread .travis.yml Outdated
language: node_js
node_js:
- "6.1"
- "8.0.0"

Copy link
Copy Markdown
Author

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

Comment thread src/regression.js
@@ -1,41 +1,6 @@
const DEFAULT_OPTIONS = { order: 2, precision: 2, period: null };
const { round, deriveDataProperties } = require('./utils');

Copy link
Copy Markdown
Author

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

@jazeee jazeee force-pushed the master branch 2 times, most recently from cf79570 to 1a90d06 Compare January 1, 2020 02:03
Move common code to utils.js
Update node version in Travis config to work with  Travis CI.
@jazeee

jazeee commented Jan 23, 2020

Copy link
Copy Markdown
Author

Pulled out the build upgrades from this code and in to PR #103

@jazeee jazeee deleted the branch Tom-Alexander:master May 10, 2024 18:12
@jazeee jazeee closed this May 10, 2024
@jazeee jazeee deleted the master branch May 10, 2024 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants