import numpy as np from sklearn.linear_model import LinearRegression # 1. Provide the training data (The Pattern: Y = 2 * X) X = np.array([[1], [2], [3], [4], [5]]) # Inputs y = np.array([2, 4, 6, 8, 10]) # Correct Outputs (Labels) # 2. Create the AI model model = LinearRegression() # 3. Train the AI (This is where it learns the pattern!) model.fit(X, y) # 4. Use the trained AI to predict something completely new new_input = np.array([[10]]) prediction = model.predict(new_input) print(f"When X is 10, the AI predicts Y will be: {prediction[0]}")