You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There was a syntax error in Example 1-1, Line 20; Accidental capitalization of "x" to "X"
To Reproduce
import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression
# Download and prepare the data
data_root = "https://github.com/ageron/data/raw/main/"
lifesat = pd.read_csv(data_root + "lifesat/lifesat.csv")
x = lifesat[["GDP per capita (USD)"]].values
y = lifesat[["Life satisfaction"]].values
# Visualize the data
lifesat.plot(kind= "scatter", grid = True,
x = "GDP per capita (USD)", y = "Life satisfaction")
plt.axis([23_500, 62_500, 4, 9])
plt.show()
# Select a linear model
model = LinearRegression()
# Train the model
model.fit(X, y)
X_new = [[37_655]] # Cyprus' GDP per capita in 2020
print(model.predict(X_new)) # output: [[6.30165767]]
Exception:
Traceback (most recent call last):
File "/Users/##############/Library/Mobile Documents/com~apple~CloudDocs/Programs/python/###.py", line 22, in <module>
model.fit(X, y)
^
NameError: name 'X' is not defined. Did you mean: 'x'?
Not the biggest issue, just thought to let you guys know 👍
The text was updated successfully, but these errors were encountered:
There was a syntax error in Example 1-1, Line 20; Accidental capitalization of "x" to "X"
To Reproduce
Exception:
Not the biggest issue, just thought to let you guys know 👍
The text was updated successfully, but these errors were encountered: