everyone. I'm a noob in data science and I'm building my first ML model. But I keep getting this error,
'DecisionTreeRegressor' object has no attribute 'tree_'
This is my code below.
df = pd.read_csv('/Users/mog/Downloads/train_data.csv')
from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size = 0.3, random_state = 1)
df.model = DecisionTreeRegressor()
df.model.fit(x_train, y_train)
from sklearn.metrics import accuracy_score
print('Training score...', accuracy_score(y_train, df_model.predict(x_train)))
print('Test score...', accuracy_score(y_test, df_model.predict(x_test)))
Please help.