Untitled
import numpy as np from sklearn.linear_model import LinearRegression # Sample data aviator_coefficients = np.array([1, 2, 3, 4, 5]) multiplier = 2 # You can adjust this multiplier based on your requirements # Generating corresponding dependent variable values aviator_values = multiplier * aviator_coefficients # Reshape the data for fitting into the model aviator_coefficients = aviator_coefficients.reshape(-1, 1) aviator_values = aviator_values.reshape(-1, 1) # Creating and fitting the linear regression model model = LinearRegression().fit(aviator_coefficients, aviator_values) # Predicting future values future_coefficients = np.array([6, 7, 8]) future_coefficients = future_coefficients.reshape(-1, 1) predicted_values = model.predict(future_coefficients) # Displaying the predictions for i in range(len(future_coefficients)): print(f"Predicted value for Aviator coefficient {future_coefficients[i][0]}: {predicted_values[i][0]}")
Leave a Comment