X and Y are our positions from our earlier table. As we increase in hours ( X) spent studying, b increases more and more. b is the slope or coefficient, in other words the number of topics solved in a specific hour ( X).One hour is the least amount of time we're going to accept into our example data set. a is the intercept, in other words the value that we expect, on average, from a student that practices for one hour.To give some context as to what they mean: Having said that, and now that we're not scared by the formula, we just need to figure out the a and b values. The formula, for those unfamiliar with it, probably looks underwhelming – even more so given the fact that we already have the values for Y and X in our example. In a graph these points look like this: Each point is a student (X, Y) and how long it took that specific student to complete a certain number of topicsĭisclaimer: This data is fictional and was made by hitting random keys. You can read it like this: "Someone spent 1 hour and solved 2 topics" or "One student after 3 hours solved 10 topics". ![]() Since we all have different rates of learning, the number of topics solved can be higher or lower for the same time invested. Let's assume that our objective is to figure out how many topics are covered by a student per hour of learning.Įach pair (X, Y) will represent a student. To do that let's expand on the example mentioned earlier. Setting up an exampleīefore we jump into the formula and code, let's define the data we're going to use. This method is used by a multitude of professionals, for example statisticians, accountants, managers, and engineers (like in machine learning problems). Then we can predict how many topics will be covered after 4 hours of continuous study even without that data being available to us. ![]() Anomalies are values that are too good, or bad, to be true or that represent rare cases.įor example, say we have a list of how many topics future engineers here at freeCodeCamp can solve if they invest 1, 2, or 3 hours continuously. It helps us predict results based on an existing set of data as well as clear anomalies in our data. Least squares is a method to apply linear regression. What is the Least Squares Regression method and why use it? This will help us more easily visualize the formula in action using Chart.js to represent the data. ![]() But we're going to look into the theory of how we could do it with the formula Y = a + b * X.Īfter we cover the theory we're going to be creating a JavaScript project. There are multiple ways to tackle the problem of attempting to predict the future. Would you like to know how to predict the future with a simple formula and some data?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |