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

Add residuals prop, upgrade packages #101

Closed
wants to merge 2 commits into from

Conversation

jazeee
Copy link

@jazeee jazeee commented Jan 1, 2020

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

Upgrade babel and build process.
Update README
Lint fix
Copy link
Author

@jazeee jazeee left a 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/**",
Copy link
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)

"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
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

@@ -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) => ([
Copy link
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

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]]);
Copy link
Author

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);
Copy link
Author

Choose a reason for hiding this comment

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

yarn lint --fix

Copy link
Author

@jazeee jazeee left a 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"
Copy link
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

@@ -1,41 +1,6 @@
const DEFAULT_OPTIONS = { order: 2, precision: 2, period: null };
const { round, deriveDataProperties } = require('./utils');
Copy link
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
Copy link
Author

jazeee commented Jan 23, 2020

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