
Discover practical strategies to follow this course, including asking questions, copying code, using ChatGPT for explanations, and accessing lecture resources and the GitHub repository.
Set up your ai ml course workspace by creating a directory and notes.md, configuring Visual Studio Code markdown preview, and installing node.js to start coding in JavaScript for linear regression.
Explore linear regression as a simple, supervised machine learning method for predicting continuous targets using one or more input features, with salaries and car prices as examples.
Demonstrate linear regression by drawing the line y = 0.5x + 2, map inputs to outputs on a two-axis graph, and predict outputs from x.
Derive the line equation y = b + mx, explain the slope m and intercept b, and connect simple linear regression to predicting y from one input x.
Plot three linear equations on one graph to compare intercepts and slopes, showing all lines share a y-intercept of 1 while slopes are 1, 2, and 3.
Master simple linear regression with one input variable by finding the line of best fit that minimizes the distance to data points. Use the line equation y = m x + b to predict outputs, identify the intercept and slope from data, and assess relationships.
Explore linear regression formats, such as y = beta0 + beta1 x and y = B + m x, and explain intercepts, slopes, and regression term origin by Francis Galton.
Begin the first exercise by building a simple linear regression model to predict exam scores from study hours, using beta zero and beta one, in a React.js app.
Install and use react-plotlyjs to plot study hours vs scores in a scatter graph, then explore fitting a regression line to predict exam scores.
Learn how to compute x bar and y bar to begin fitting a regression line, implement the math in code, and use averages to predict scores from study hours.
Compute x-bar and y-bar means to form the regression line in this js-based course, using study hours and scores as examples.
Calculate mean study hours and mean exam scores from data using a use effect train model function, first with a for loop, then with reduce, yielding results 3 and 76.
Compute the slope numerator for linear regression by summing (x_i − x̄)(y_i − ȳ) across five data points, yielding 85, with the denominator to be covered next.
Compute the numerator for the slope in code by summing (study hours data[i] - mean study hours) times (exam scores data[i] - mean exam scores), yielding 85.
Compute the regression denominator, derive the slope as 85 divided by 10 to yield 8.5, and describe it as the rate of change of the regression line.
Compute the slope by dividing the numerator by the denominator to get beta one, 8.5, then apply this value in code using the study hours data and power two operation.
Compute the y intercept in simple linear regression using y bar minus beta one times x bar; derive beta zero as 50.5, with beta one 8.5, referencing code and paper.
Explore regression analysis by deriving the regression line y = 50.5 + 8.5x from study hours and scores, then predict and plot values against real data to evaluate model accuracy.
Set up a simple linear regression forecast by storing b0 and b1, creating an input for study hours, and predicting scores while displaying b0, b1, and the input value.
Explore building a simple linear regression model in JavaScript: compute predictions from study hours using beta zero and beta one, handle empty input, clamp scores to 100, and format results.
Compute predicted values from input data and assess model accuracy by exploring residuals, the difference between actual and predicted outputs, and use a training/testing split (70%/30%) to evaluate regression coefficients.
Learn how to compute residuals with epsilon = y minus y hat, interpret negative values as overestimation and positive as underestimation, and use residuals to evaluate regression metrics.
Compute residuals from predicted y hat values using regression parameters in code, and test the model by computing predictions from inputs and the resulting residuals.
Learn to compute R-squared as a regression evaluation using residuals. Ranges from 0 to 1, where 1 indicates perfect prediction, and shows how hours predict scores.
Compute r-squared in code demonstrates calculating r-squared from residuals and total sum of squares in a js regression, showing 93.83% of exam score variance explained by study hours.
Compute the mean absolute error (mae) to measure how residuals, the differences between actual and predicted values, deviate on average; mae offers robustness to outliers and aids model comparison.
Compute mean squared error (MSE) to evaluate model fit by squaring each residual, weighting large errors more heavily, with a practical JS example and comparison to MAE.
Compute the mean squared error to reproduce 9.5 mean squared error, then create a user interface with boxes for exam, car, and salary predictions using simple and multiple linear regression.
Move the prediction UI into its own exam score prediction component, create a components folder, and export it for reuse, enabling future multiple models and model-specific display.
Create a React-based JavaScript model selection component to compare multiple models, including a simple linear regression for exam score prediction based on study hours.
Finish the model selection by wiring clicks to capture model ids, manage active model state, map ids to components for exam score prediction, and toggle visibility with a green border.
Explore the simple linear regression formula y = beta zero plus beta one x and the residual, or error term, that accounts for prediction discrepancies, with a concrete example.
Learn how multiple linear regression extends simple regression by using two independent variables—study hours and sleep hours—to predict exam scores and fit a regression plane.
Visualize multiple linear regression in a JS app with two inputs, study hours and sleep hours, using a 3D regression plane. Learn the formula and coefficients that drive predictions.
Explain organizing study hours and sleep hours into matrices, forming X and y, and computing the regression plane with matrix multiplication and beta coefficients.
Organize matrices in code by building input X and output Y matrices in JavaScript for regression. Create an intercept column by mapping X rows and appending ones.
Organize data into x and y matrices for regression and prepare the inputs and outputs. Compute x transpose times x by multiplying the transposed x with x, illustrating row-by-column multiplication.
Install the Mathijs library and transform the x array into a dense matrix, then compute the transpose and multiply to obtain x transpose x, matching the paper results.
Compute x transpose times y, treating y as a five-row, one-column matrix to verify results; the computed value is 1025, confirming the next step toward multiple linear regression.
Compute regression coefficients by forming X and Y, then beta = (X^T X)^{-1} X^T Y, and study determinant and adjugate methods (2×2 and 3×3) for inversion.
Learn to compute the adjugate of the x^T x matrix via cofactors and the determinant, then obtain the inverse for beta zero and coefficients of x1 and x2 in regression.
Compute the inverse of x^T x using the determinant and adjugate, derive the beta coefficients, and predict y from study hours and sleep hours.
Compute regression coefficients by calculating inverse of xᵀx and multiplying by xᵀy to obtain beta, log results (34.67, 4.68, 3.64), and verify with paper values.
Store the computed beta coefficients by flattening the beta matrix to a one-dimensional, rounded array and saving them as mr-example-coefficients.json in the public folder for use in a React.js component.
Retrieve coefficients from a JSON file on the frontend using fetch, manage them with state and useEffect, and convert string coefficients to numbers for display.
Load coefficients from a json file, compute predictions using beta zero, one, and two across study and sleep hours, and render a blue 3d regression plane.
Prepare data for multiple linear regression by parsing a csv data set and building a salary-prediction model based on age and experience, with back-end model setup.
Read csv data with a node read stream and csv parse to convert file bytes into numeric rows (age, experience, income) for the salary regression model.
Shuffle the data, then split it into 70% training and 30% testing; implement a split data function that returns train and test sets for model evaluation.
Seed your data to achieve consistent train and test splits by installing seedrandom, importing it, and using a seeded RNG instead of Math.random.
Train a multiple linear regression model using a dedicated package, format train inputs and outputs, and interpret the beta coefficients to see how age and experience affect salary.
Explain how a regression model computes salary predictions from inputs x1 and x2, with coefficients beta0, beta1, and beta2, and interpret standard errors, t-values, and prediction accuracy.
Store the computed beta coefficients by flattening the matrix, rounding to two decimals, and writing them to a public coefficients.json file in the React app using fs.
Compute r squared from the residuals and total sum of squares using test inputs, test outputs, and model predictions, then store the result in the json file.
Compute r squared from test outputs and predictions by calculating the mean and the residual and total sums of squares, then derive r2.
Store training, testing, and prediction data and the r-squared value in JSON files to power front-end graphs, replacing hard-coded data and unifying front-end and back-end model calculations.
Create a salary prediction component that fetches train data, test data, and predictions from a json file and visualizes them on a front end as a 3d scatter plot.
Display the regression plane for salary predictions using training data ranges for age and experience, computing x1 and x2 steps, and rendering a 3D mesh of predicted salaries.
Predict salaries from age and experience using a multi linear regression model and visualize the regression plane while building an interactive user interface for input and live predictions.
Transform data from an array of arrays to an array of objects with key-value pairs, enabling numeric encoding of strings for a regression model.
Learn to simplify car names by converting complex model strings to brand names, enabling easier price prediction using horsepower, size, doors, and engine type.
Identify typos in car names by extracting unique values and verifying data categories. Create a fixed brands mapping and apply it during data cleaning to produce corrected, consistent car names.
One hot encode text categories like car name, fuel type, and car body into binary vectors for regression models in JavaScript.
Learn to convert text categories such as door number and cylinder number into numeric features using a text-to-number parser, enhancing preprocessing for regression models.
Map numeric features to category names by iterating text category mappings, build raw categories, and structure 67 independent variables for a regression model, preparing training and testing data.
Split the dataset into 70% training and 30% testing for a regression model, with price as the dependent variable and all other features as independent variables.
Dive into the world of machine learning with Machine Learning with JS: Regression Tasks (Math + Code). This course offers a focused look at linear regression, blending theoretical knowledge with hands-on coding to teach you how to build and apply linear regression models using JavaScript.
What You Will Learn:
Core Principles of Linear Regression: Begin with the fundamentals of linear regression and expand into multiple regression techniques. Discover how these models can predict future outcomes based on past data.
Hands-On Coding: Engage directly with practical coding examples, utilizing JavaScript. You'll use Node.js for the computational aspects and React.js for dynamic data visualization.
Simplified Mathematics: We make the essential math behind the models accessible, focusing on concepts that allow you to understand and implement the algorithms effectively.
Project-Based Learning: Build a React application from scratch that not only plots data but also computes regression parameters and visualizes these computations in real-time. This hands-on approach will help solidify your learning through actual development experience.
Real-World Applications: Learn to forecast real-world outcomes using the models you build. Understand the importance of residuals and how to quantify model accuracy with statistical measures such as R-squared, Mean Absolute Error (MAE), and Mean Squared Error (MSE).
Advanced Topics in Depth: Go beyond basic regression with sessions on handling complex data types through multiple regression analysis, matrix operations, and model selection techniques.
Course Structure:
This course includes over 80 detailed video lectures that guide you through every step of learning machine learning with JavaScript:
Introduction and Setup: Start with an overview of the necessary tools and configurations. Understand the foundational terms and concepts in regression.
Interactive Exercises: Each new concept is paired with practical coding exercises that reinforce the material by putting theory into practice.
In-Depth Projects: Apply what you've learned in extensive, real-world projects. Predict salary ranges based on job data or estimate car prices with sophisticated regression models.
Why Choose This Course?
Targeted Learning: We focus on linear regression to provide a thorough understanding of one of the most common machine learning techniques.
Practical JavaScript Use: By using JavaScript, a language familiar to many developers, this course demystifies the process of integrating machine learning into web applications and backend services.
Project-Driven Approach: The projects are designed to reflect real industry problems, preparing you for technical challenges in your career.