Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
VinceDayrit-initial_RESIT_project-/#Model Testing Code =.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
18 lines (13 sloc)
576 Bytes
This file contains 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
#Model Testing Code = | |
from sklearn.model_selection import train_test_split | |
from sklearn.linear_model import LinearRegression | |
from sklearn.metrics import mean_squared_error, r2_score | |
#This splitts the data | |
X = df[['Population Staying at Home', 'Week']] | |
y = df['Percent Change in Visits'] | |
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) | |
model = LinearRegression() | |
model.fit(X_train, y_train) | |
#This is responsible for predicting the data | |
y_pred_train = model.predict(X_train) | |
y_pred_test = model.predict(X_test) |