Created
May 15, 2021 14:13
-
-
Save bkaankuguoglu/c89b317fc2ed019ed1074aeda62a27c7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.linear_model import LinearRegression | |
def build_baseline_model(df, test_ratio, target_col): | |
X, y = feature_label_split(df, target_col) | |
X_train, X_test, y_train, y_test = train_test_split( | |
X, y, test_size=test_ratio, shuffle=False | |
) | |
model = LinearRegression() | |
model.fit(X_train, y_train) | |
prediction = model.predict(X_test) | |
result = pd.DataFrame(y_test) | |
result["prediction"] = prediction | |
result = result.sort_index() | |
return result | |
df_baseline = build_baseline_model(df_features, 0.2, 'value') | |
baseline_metrics = calculate_metrics(df_baseline) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment