Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge | Building and Training Model
Explore the Linear Regression Using Python
course content

Contenu du cours

Explore the Linear Regression Using Python

Explore the Linear Regression Using Python

1. What is the Linear Regression?
2. Correlation
3. Building and Training Model
4. Metrics to Evaluate the Model
5. Multivariate Linear Regression

book
Challenge

Let’s combine our knowledge!

Tâche

Swipe to start coding

In this task, you build, train and fit your model and make predictions based on it. This time you will make predictions about total_phenols, based on flavanoids. It means that your target now is total_phenols.

Your plan:

  1. [Line #18] Define the target (in this task it's total_phenols).
  2. [Line #25] Split the data 70-30 (70% of the data is for training and 30% is for testing) and insert 1 as a random parameter.
  3. [Line #26] Initialize linear regression model .
  4. [Line #27] Fit the model using your tain data.
  5. [Line #30] Assign np.array() to the variable new_flavanoids if their number is 1 (don't forget to use function .reshape(-1,1)).
  6. [Line #31] Predict and assign the amount of flavanoids to the variable predicted_value.
  7. [Line #32] Print the predicted amount of flavanoids.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 4
toggle bottom row

book
Challenge

Let’s combine our knowledge!

Tâche

Swipe to start coding

In this task, you build, train and fit your model and make predictions based on it. This time you will make predictions about total_phenols, based on flavanoids. It means that your target now is total_phenols.

Your plan:

  1. [Line #18] Define the target (in this task it's total_phenols).
  2. [Line #25] Split the data 70-30 (70% of the data is for training and 30% is for testing) and insert 1 as a random parameter.
  3. [Line #26] Initialize linear regression model .
  4. [Line #27] Fit the model using your tain data.
  5. [Line #30] Assign np.array() to the variable new_flavanoids if their number is 1 (don't forget to use function .reshape(-1,1)).
  6. [Line #31] Predict and assign the amount of flavanoids to the variable predicted_value.
  7. [Line #32] Print the predicted amount of flavanoids.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 4
Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
We're sorry to hear that something went wrong. What happened?
some-alt