Spaces:
Runtime error
Runtime error
Chaninder Rishi commited on
Commit ·
b8d216a
1
Parent(s): 19a71de
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,6 +11,9 @@ from sklearn import linear_model
|
|
| 11 |
|
| 12 |
df = pd.read_csv('emily_election.csv')
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
df['runtime'] = df['cumulative_ad_runtime'].apply(lambda s: int(s.split('days')[0]))
|
| 16 |
df['impressions'] = df['cumulative_impressions_by_region'].apply(lambda d: ast.literal_eval(d))
|
|
@@ -46,10 +49,12 @@ x = np.asanyarray(new_train[['log_runtime', 'log_spend']])
|
|
| 46 |
y = np.asanyarray(new_train[['log_impressions']])
|
| 47 |
regr.fit (x, y)
|
| 48 |
y_pred= regr.predict(new_train[['log_runtime', 'log_spend']])
|
|
|
|
|
|
|
| 49 |
# # The coefficients
|
| 50 |
-
print(regr.coef_)
|
| 51 |
-
print('R-squared score: %.2f' % regr.score(x, y))
|
| 52 |
-
print('Standard Deviation: %.2f' % np.sqrt(sum((y - y_pred)**2) / (len(y) - 2)))
|
| 53 |
|
| 54 |
|
| 55 |
|
|
|
|
| 11 |
|
| 12 |
df = pd.read_csv('emily_election.csv')
|
| 13 |
|
| 14 |
+
loaded_model = pickle.load(open(filename, 'rb'))
|
| 15 |
+
|
| 16 |
+
"""
|
| 17 |
|
| 18 |
df['runtime'] = df['cumulative_ad_runtime'].apply(lambda s: int(s.split('days')[0]))
|
| 19 |
df['impressions'] = df['cumulative_impressions_by_region'].apply(lambda d: ast.literal_eval(d))
|
|
|
|
| 49 |
y = np.asanyarray(new_train[['log_impressions']])
|
| 50 |
regr.fit (x, y)
|
| 51 |
y_pred= regr.predict(new_train[['log_runtime', 'log_spend']])
|
| 52 |
+
|
| 53 |
+
"""
|
| 54 |
# # The coefficients
|
| 55 |
+
#print(regr.coef_)
|
| 56 |
+
#print('R-squared score: %.2f' % regr.score(x, y))
|
| 57 |
+
#print('Standard Deviation: %.2f' % np.sqrt(sum((y - y_pred)**2) / (len(y) - 2)))
|
| 58 |
|
| 59 |
|
| 60 |
|