Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
471 B
1
Indexable
Never
from sklearn.metrics import r2_score

# Calculate R-squared
r_squared = r2_score(y, y_pred)
print(f'R-squared: {r_squared}')

# Make predictions for new values
new_X_values = np.array([2.5, 5.0, 7.5]).reshape(-1, 1)
new_X_transformed = transformer.transform(new_X_values)
new_y_pred = model.predict(new_X_transformed)

print("Predictions for new values:")
for x_val, y_val in zip(new_X_values, new_y_pred):
    print(f'X = {x_val[0]}, Predicted y = {y_val}')
Leave a Comment