Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -11,9 +11,19 @@ tqdm.pandas()
|
|
| 11 |
def predict_popularity(features):
|
| 12 |
predictions = [None] * 2
|
| 13 |
predictions[0], predictions[1] = rf_model.predict([features]), model.predict([features])
|
|
|
|
| 14 |
return predictions
|
| 15 |
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
data = pd.read_csv('top50.csv', encoding='ISO-8859-1')
|
|
|
|
| 11 |
def predict_popularity(features):
|
| 12 |
predictions = [None] * 2
|
| 13 |
predictions[0], predictions[1] = rf_model.predict([features]), model.predict([features])
|
| 14 |
+
addToCsvAndTrain(trainset)
|
| 15 |
return predictions
|
| 16 |
|
| 17 |
|
| 18 |
+
def addToCsvAndTrain(trainset):
|
| 19 |
+
trainset = [
|
| 20 |
+
[trainset[0],trainset[1],trainset[2],trainset[3],trainset[4],trainset[5],trainset[6],trainset[7],
|
| 21 |
+
trainset[8],trainset[9],trainset[10],trainset[11],trainset[12],trainset[13]
|
| 22 |
+
]
|
| 23 |
+
]
|
| 24 |
+
neues_df = pd.DataFrame(trainset, columns= data.columns)
|
| 25 |
+
df = pd.concat([data, neues_df], ignore_index=True)
|
| 26 |
+
df.to_csv('top50.csv', index=False)
|
| 27 |
|
| 28 |
|
| 29 |
data = pd.read_csv('top50.csv', encoding='ISO-8859-1')
|