|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
|
|
|
|
|
#### Exercise 0: Environment and libraries |
|
|
|
|
|
|
|
|
|
##### The exercice is validated is all questions of the exercice are validated |
|
|
|
|
##### The exercise is validated is all questions of the exercise are validated |
|
|
|
|
|
|
|
|
|
##### Activate the virtual environment. If you used `conda` run `conda activate your_env` |
|
|
|
|
|
|
|
|
@ -10,7 +10,7 @@
|
|
|
|
|
|
|
|
|
|
###### Does it print `Python 3.x`? x >= 8 |
|
|
|
|
|
|
|
|
|
###### Does `import jupyter`, `import numpy`, `import pandas`, `import matplotlib` and `import sklearn` run without any error ? |
|
|
|
|
###### Do `import jupyter`, `import numpy`, `import pandas`, `import matplotlib` and `import sklearn` run without any error? |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
@ -18,13 +18,13 @@
|
|
|
|
|
|
|
|
|
|
#### Exercise 1: Scikit-learn estimator |
|
|
|
|
|
|
|
|
|
##### The question 1 is validated if the output is: |
|
|
|
|
###### For question 1, is the output the following? |
|
|
|
|
|
|
|
|
|
```python |
|
|
|
|
array([[3.96013289]]) |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
##### The question 2 is validated if the output is: |
|
|
|
|
###### For question 2, is the output the following? |
|
|
|
|
|
|
|
|
|
```output |
|
|
|
|
Coefficients: [[0.99667774]] |
|
|
|
@ -38,23 +38,23 @@
|
|
|
|
|
|
|
|
|
|
#### Exercise 2: Linear regression in 1D |
|
|
|
|
|
|
|
|
|
##### The exercise is validated is all questions of the exercise are validated |
|
|
|
|
##### The exercise is validated if all questions of the exercise are validated |
|
|
|
|
|
|
|
|
|
##### The question 1 is validated if the plot looks like: |
|
|
|
|
###### For question 1, does the plot look like the following? |
|
|
|
|
|
|
|
|
|
![alt text][q1] |
|
|
|
|
|
|
|
|
|
[q1]: ../w2_day1_ex2_q1.png "Scatter plot" |
|
|
|
|
|
|
|
|
|
###### The question 2 is validated if the equation of the fitted line is: `y = 42.619430291366946 * x + 99.18581817296929` |
|
|
|
|
###### For question 2, is the equation of the fitted line the following? `y = 42.619430291366946 * x + 99.18581817296929` |
|
|
|
|
|
|
|
|
|
###### The question 3 is validated if the plot looks like: |
|
|
|
|
###### For question 3, does the plot look like the following? |
|
|
|
|
|
|
|
|
|
![alt text][q3] |
|
|
|
|
|
|
|
|
|
[q3]: ../w2_day1_ex2_q3.png "Scatter plot + fitted line" |
|
|
|
|
|
|
|
|
|
###### The question 4 is validated if the outputted prediction for the first 10 values are: |
|
|
|
|
###### For question 4, is the outputted prediction for the first 10 values the following? |
|
|
|
|
|
|
|
|
|
```python |
|
|
|
|
array([ 83.86186727, 140.80961751, 116.3333897 , 64.52998689, |
|
|
|
@ -62,9 +62,9 @@ array([ 83.86186727, 140.80961751, 116.3333897 , 64.52998689,
|
|
|
|
|
108.06237908, 85.90762675]) |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
###### The question 5 is validated if the MSE returned is `114.17148616819485` |
|
|
|
|
###### For question 5, is the MSE returned `114.17148616819485`? |
|
|
|
|
|
|
|
|
|
###### The question 6 is validated if the MSE returned is `2854.2871542048706` |
|
|
|
|
###### For question 6, is the MSE returned `2854.2871542048706`? |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
@ -72,7 +72,7 @@ array([ 83.86186727, 140.80961751, 116.3333897 , 64.52998689,
|
|
|
|
|
|
|
|
|
|
#### Exercise 3: Train test split |
|
|
|
|
|
|
|
|
|
##### The question 1 is validated if X_train, y_train, X_test, y_test match this output: |
|
|
|
|
###### For question 1, do X_train, y_train, X_test, y_test match this output? |
|
|
|
|
|
|
|
|
|
```console |
|
|
|
|
X_train: |
|
|
|
@ -105,9 +105,9 @@ y_test:
|
|
|
|
|
|
|
|
|
|
#### Exercise 4: Forecast diabetes progression |
|
|
|
|
|
|
|
|
|
##### The exercice is validated is all questions of the exercice are validated |
|
|
|
|
##### The exercise is validated if all questions of the exercise are validated |
|
|
|
|
|
|
|
|
|
##### The question 1 is validated if the output of `y_train.values[:10]` and `y_test.values[:10]`are: |
|
|
|
|
###### For question 1, is the output of `y_train.values[:10]` and `y_test.values[:10]` the following? |
|
|
|
|
|
|
|
|
|
```console |
|
|
|
|
y_train.values[:10]: |
|
|
|
@ -135,7 +135,7 @@ y_test:
|
|
|
|
|
[192.]] |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
##### The question 2 is validated if the coefficients and the intercept are: |
|
|
|
|
###### For question 2, are the coefficients and the intercept the following? |
|
|
|
|
|
|
|
|
|
```console |
|
|
|
|
[('age', -60.40163046086952), |
|
|
|
@ -151,7 +151,7 @@ y_test:
|
|
|
|
|
('intercept', 152.05314895029233)] |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
##### The question 3 is validated if the output of `predictions_on_test[:10]` is: |
|
|
|
|
###### For question 3, is the output of `predictions_on_test[:10]`? |
|
|
|
|
|
|
|
|
|
```console |
|
|
|
|
array([[111.74351759], |
|
|
|
@ -166,7 +166,7 @@ y_test:
|
|
|
|
|
[224.83346984]]) |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
##### The question 4 is validated if the mse on the **train set** is `2888.326888` and the mse on the **test set** is `2858.255153`. |
|
|
|
|
###### For question 4, is the mse on the **train set** `2888.326888` and the mse on the **test set** `2858.255153`? |
|
|
|
|
|
|
|
|
|
--- |
|
|
|
|
--- |
|
|
|
|