You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
miner/backend/regression_strategy.py

19 lines
504 B

from sklearn.linear_model import LinearRegression
def perform_regression(data, data_name, target_name):
X = data[data_name]
y = data[target_name]
if not isinstance(y.iloc[0], (int, float)):
raise ValueError("The target variable should be numeric (continuous) for regression.")
model = LinearRegression()
model.fit(X, y)
return model
def make_prediction(model, feature_names, input_values):
prediction = model.predict([input_values])
return prediction[0]