Skip to content
Permalink
f8944e4b75
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
16 lines (12 sloc) 409 Bytes
#Linear Regression Code =
import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression
df_full = pd.read_csv("Trips_Full_Data.csv")
df = pd.read_csv("Trips_By_Distance.csv")
x = np.array(df_full['Trips 1-25 Miles']).reshape((-1, 1))
y = df['Number of Trips 10-25']
model = LinearRegression()
model.fit(x, y)
r_sq = model.score(x, y)
print(f"R-squared: {r_sq}")