[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-08-17 UTC。"],[[["\u003cp\u003eThis module introduces linear regression, a statistical method used to predict a label value based on its features.\u003c/p\u003e\n"],["\u003cp\u003eThe linear regression model uses an equation (y' = b + w₁x₁ + ...) to represent the relationship between features and the label.\u003c/p\u003e\n"],["\u003cp\u003eDuring training, the model adjusts its bias (b) and weights (w) to minimize the difference between predicted and actual values.\u003c/p\u003e\n"],["\u003cp\u003eLinear regression can be applied to models with multiple features, each with its own weight, to improve prediction accuracy.\u003c/p\u003e\n"],["\u003cp\u003eGradient descent and hyperparameter tuning are key techniques used to optimize the performance of a linear regression model.\u003c/p\u003e\n"]]],[],null,["| **Estimated module length:** 70 minutes\n\nThis module introduces **linear regression** concepts.\n| **Learning objectives:**\n|\n| - Explain a loss function and how it works.\n| - Define and describe how gradient descent finds the optimal model parameters.\n| - Describe how to tune hyperparameters to efficiently train a linear model.\n| **Prerequisites:**\n|\n| This module assumes you are familiar with the concepts covered in the\n| following module:\n|\n| - [Introduction to Machine Learning](/machine-learning/intro-to-ml)\n\n[**Linear regression**](/machine-learning/glossary#linear-regression) is a\nstatistical technique used to find the relationship between variables. In an ML\ncontext, linear regression finds the relationship between\n[**features**](/machine-learning/glossary#feature) and a\n[**label**](/machine-learning/glossary#label).\n\nFor example, suppose we want to predict a car's fuel efficiency in miles per\ngallon based on how heavy the car is, and we have the following dataset:\n\n| Pounds in 1000s (feature) | Miles per gallon (label) |\n|---------------------------|--------------------------|\n| 3.5 | 18 |\n| 3.69 | 15 |\n| 3.44 | 18 |\n| 3.43 | 16 |\n| 4.34 | 15 |\n| 4.42 | 14 |\n| 2.37 | 24 |\n\nIf we plotted these points, we'd get the following graph:\n\n**Figure 1**. Car heaviness (in pounds) versus miles per gallon rating. As a\ncar gets heavier, its miles per gallon rating generally decreases.\n\nWe could create our own model by drawing a best fit line through the points:\n\n**Figure 2**. A best fit line drawn through the data from the previous figure.\n\nLinear regression equation\n\nIn algebraic terms, the model would be defined as $ y = mx + b $, where\n\n- $ y $ is miles per gallon---the value we want to predict.\n- $ m $ is the slope of the line.\n- $ x $ is pounds---our input value.\n- $ b $ is the y-intercept.\n\nIn ML, we write the equation for a linear regression model as follows: \n$$ y' = b + w_1x_1 $$\n\nwhere:\n\n- $ y' $ is the predicted label---the output.\n- $ b $ is the [**bias**](/machine-learning/glossary#bias-math-or-bias-term) of the model. Bias is the same concept as the y-intercept in the algebraic equation for a line. In ML, bias is sometimes referred to as $ w_0 $. Bias is a [**parameter**](/machine-learning/glossary#parameter) of the model and is calculated during training.\n- $ w_1 $ is the [**weight**](/machine-learning/glossary#weight) of the feature. Weight is the same concept as the slope $ m $ in the algebraic equation for a line. Weight is a [**parameter**](/machine-learning/glossary#parameter) of the model and is calculated during training.\n- $ x_1 $ is a [**feature**](/machine-learning/glossary#feature)---the input.\n\nDuring training, the model calculates the weight and bias that produce the best\nmodel.\n\n**Figure 3**. Mathematical representation of a linear model.\n\nIn our example, we'd calculate the weight and bias from the line we drew. The\nbias is 34 (where the line intersects the y-axis), and the weight is --4.6 (the\nslope of the line). The model would be defined as $ y' = 34 + (-4.6)(x_1) $, and\nwe could use it to make predictions. For instance, using this model, a\n4,000-pound car would have a predicted fuel efficiency of 15.6 miles per\ngallon.\n\n**Figure 4**. Using the model, a 4,000-pound car has a predicted\nfuel efficiency of 15.6 miles per gallon.\n\nModels with multiple features\n\nAlthough the example in this section uses only one feature---the heaviness\nof the car---a more sophisticated model might rely on multiple features,\neach having a separate weight ($ w_1 $, $ w_2 $, etc.). For example, a model\nthat relies on five features would be written as follows:\n\n$ y' = b + w_1x_1 + w_2x_2 + w_3x_3 + w_4x_4 + w_5x_5 $\n\nFor example, a model that predicts gas mileage could additionally use features\nsuch as the following:\n\n- Engine displacement\n- Acceleration\n- Number of cylinders\n- Horsepower\n\nThis model would be written as follows:\n\n**Figure 5**. A model with five features to predict a car's miles per gallon\nrating.\n\nBy graphing some of these additional features, we can see that they also have a\nlinear relationship to the label, miles per gallon:\n\n**Figure 6**. A car's displacement in cubic centimeters and its miles per gallon\nrating. As a car's engine gets bigger, its miles per gallon rating generally\ndecreases.\n\n**Figure 7**. A car's acceleration and its miles per gallon rating. As a car's\nacceleration takes longer, the miles per gallon rating generally increases.\n\n**Figure 8**. A car's horsepower and its miles per gallon rating. As a car's\nhorsepower increases, the miles per gallon rating generally decreases.\n\nExercise: Check your understanding \nWhat parts of the linear regression equation are updated during training? \nThe bias and weights \nDuring training, the model updates the bias and weights. \nThe prediction \nPredictions are not updated during training. \nThe feature values \nFeature values are part of the dataset, so they're not updated during training.\n| **Key terms:**\n|\n| - [Bias](/machine-learning/glossary#bias-math-or-bias-term)\n| - [Feature](/machine-learning/glossary#feature)\n| - [Label](/machine-learning/glossary#label)\n| - [Linear regression](/machine-learning/glossary#linear-regression)\n| - [Parameter](/machine-learning/glossary#parameter)\n- [Weight](/machine-learning/glossary#weight) \n[Help Center](https://support.google.com/machinelearningeducation)"]]