Last active
June 18, 2017 19:30
-
-
Save abhisheksoni27/0df36d30ff1ec81432324a6a836f3035 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dressData() { | |
/** | |
* One row of the data object looks like: | |
* { | |
* TV: "10", | |
* Radio: "100", | |
* Newspaper: "20", | |
* "Sales": "1000" | |
* } | |
* | |
* Hence, while adding the data points, | |
* we need to parse the String value as a Float. | |
*/ | |
csvData.forEach((row) => { | |
X.push(f(row.Radio)); | |
y.push(f(row.Sales)); | |
}); | |
} | |
function f(s) { | |
return parseFloat(s); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment