fin separation front/back
This commit is contained in:
18
backend/regression_strategy.py
Normal file
18
backend/regression_strategy.py
Normal file
@@ -0,0 +1,18 @@
|
||||
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]
|
Reference in New Issue
Block a user