Published
Edited
May 26, 2019
3 stars
Insert cell
Insert cell
Insert cell
data = d3.csv("https://raw.githubusercontent.com/tanvirrazin/Machine-Learning-A-Z-Udemy/master/data_files/Position_Salaries.csv")
Insert cell
Insert cell
result = regression.polynomial(data.map((item) => (
[parseFloat(item.Level), parseFloat(item.Salary)]
)), { order: 2, precision: 10 });
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
regressionChart = {
let positionSalariesData = {
x: positionSalaries[0],
y: positionSalaries[1],
name: 'Salaries by Position Level',
mode: 'markers',
type: 'scatter'
};
var predictedSalariesData = {
x: predictions.map((item, index) => index+1),
y: predictions.map(item => item),
name: 'Predicted Salaries',
mode: 'lines',
type: 'scatter'
};
var data = [positionSalariesData, predictedSalariesData];
const div = DOM.element('div');
Plotly.newPlot(div, data, {width: width});
return div;
}
Insert cell
Insert cell
// Machine-Learning A-Z Dataset
// https://github.com/tanvirrazin/Machine-Learning-A-Z-Udemy/tree/master/data_files

// Regression-JS
// https://github.com/Tom-Alexander/regression-js
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more