Skip to content

Commit b59fb0b

Browse files
author
SebastienMelo
committed
fix series to dataframe
1 parent 303ffa1 commit b59fb0b

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

python_scripts/linear_models_ex_01.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
penguins = pd.read_csv("../datasets/penguins_regression.csv")
4141
feature_name = "Flipper Length (mm)"
4242
target_name = "Body Mass (g)"
43-
data, target = penguins[[feature_name]], penguins[target_name]
43+
data, target = penguins[[feature_name]], penguins[[target_name]]
4444

4545
# %% [markdown]
4646
# ### Model definition

python_scripts/linear_models_sol_01.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
penguins = pd.read_csv("../datasets/penguins_regression.csv")
3535
feature_name = "Flipper Length (mm)"
3636
target_name = "Body Mass (g)"
37-
data, target = penguins[[feature_name]], penguins[target_name]
37+
data, target = penguins[[feature_name]], penguins[[target_name]]
3838

3939
# %% [markdown]
4040
# ### Model definition
@@ -106,7 +106,7 @@ def linear_model_flipper_mass(
106106
def goodness_fit_measure(true_values, predictions):
107107
# we compute the error between the true values and the predictions of our
108108
# model
109-
errors = np.ravel(true_values) - np.ravel(predictions)
109+
errors = true_values - predictions
110110
# We have several possible strategies to reduce all errors to a single value.
111111
# Computing the mean error (sum divided by the number of element) might seem
112112
# like a good solution. However, we have negative errors that will misleadingly

0 commit comments

Comments
 (0)