# run_regression # Runs a linear regression on the hospital charge dataset import linear_regression as lr path_to_data = './hospital_charge_sample.csv' df = lr.load_hospital_data(path_to_data) data = lr.prepare_data(df) results = lr.run_hospital_regression(path_to_data) print(results) ### END ###
'and days_since_0122 between 175 and 179 order by days_since_0122 asc' df3 = pd.read_sql(sql3, conn) data3 = df3.deaths.values sql4 = 'select days_since_0122, recovered from covid_19_data_full where country = \'Italy\' ' \ 'and days_since_0122 between 175 and 179 order by days_since_0122 asc' df4 = pd.read_sql(sql4, conn) data4 = df4.recovered.values # Linear Regression Confirmed sql = 'select days_since_0122, confirmed from covid_19_data_0714 where country = \'Italy\' ' \ 'and days_since_0122 > 140 order by days_since_0122 asc' df = pd.read_sql(sql, conn) data = df.confirmed.values X_train, X_test, Y_train, Y_test, X_lately = lr.prepare_data(data, 5, 0.2) score = lr.linear_regression(X_train, X_test, Y_train, Y_test, X_lately, 'confirmed-5', True) print("Actual for", 'confirmed-5', ':', data2) # Linear Regression Deaths sql = 'select days_since_0122, deaths from covid_19_data_0714 where country = \'Italy\' ' \ 'and days_since_0122 > 140 order by days_since_0122 asc' df = pd.read_sql(sql, conn) data = df.deaths.values X_train, X_test, Y_train, Y_test, X_lately = lr.prepare_data(data, 5, 0.2) score = lr.linear_regression(X_train, X_test, Y_train, Y_test, X_lately, 'deaths-5', True)