from sklearn.model_selection import train_test_split # Split data: some for learning, some for testing X_train, X_test, y_train, y_test = train_test_split(heights.reshape(-1,1), weights, test_size=0.5) model.fit(X_train, y_train) # Learn from training data score = model.score(X_test, y_test) # Test on unseen data print(f"Model accuracy: {score:.2f}")