Spaces:
Runtime error
Runtime error
Commit
·
a4b03e0
1
Parent(s):
f05d85e
upload model
Browse files- app.py +19 -16
- dtc_model.m +0 -0
- result.png +0 -0
- rfc_model.m +0 -0
app.py
CHANGED
|
@@ -78,29 +78,32 @@ def make_clf_t_plot():
|
|
| 78 |
return fig
|
| 79 |
|
| 80 |
def download_clf():
|
| 81 |
-
joblib.dump(clf,"dtc_model.m")
|
| 82 |
return "./dtc_model.m"
|
| 83 |
|
| 84 |
def download_rfc():
|
| 85 |
-
joblib.dump(rfc,"rfc_model.m")
|
| 86 |
return "./rfc_model.m"
|
| 87 |
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
morning_features = ['air_pressure', 'aver_tem', 'humidity',
|
| 91 |
-
'sunlight_time', 'wind_direction', 'wind_speed']
|
| 92 |
-
feature=clean_data[morning_features].copy()
|
| 93 |
-
label = clean_data['rain_accum'].copy()
|
| 94 |
-
X_train,X_test,y_train,y_test = train_test_split(feature,label,test_size=0.33,random_state=324)
|
| 95 |
-
clf = DecisionTreeClassifier(random_state=25)
|
| 96 |
-
rfc = RandomForestClassifier(random_state=25, n_estimators=11)
|
| 97 |
-
clf.fit(X_train,y_train)
|
| 98 |
-
rfc.fit(X_train,y_train)
|
| 99 |
-
clf_score = clf.score(X_test, y_test)
|
| 100 |
-
rfc_score = rfc.score(X_test, y_test)
|
| 101 |
-
score = pd.DataFrame([[clf_score,rfc_score],['DecisioTree Score','RandomForest Score']],columns=['DecisioTree Score','RandomForest Score'])
|
| 102 |
|
| 103 |
if __name__ == '__main__':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
with gr.Blocks() as demo:
|
| 105 |
gr.Markdown("""
|
| 106 |
## Data Collection
|
|
|
|
| 78 |
return fig
|
| 79 |
|
| 80 |
def download_clf():
|
| 81 |
+
# joblib.dump(clf,"dtc_model.m")
|
| 82 |
return "./dtc_model.m"
|
| 83 |
|
| 84 |
def download_rfc():
|
| 85 |
+
# joblib.dump(rfc,"rfc_model.m")
|
| 86 |
return "./rfc_model.m"
|
| 87 |
|
| 88 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
if __name__ == '__main__':
|
| 91 |
+
|
| 92 |
+
table_data, clean_data = make_ra_table(data)
|
| 93 |
+
|
| 94 |
+
morning_features = ['air_pressure', 'aver_tem', 'humidity',
|
| 95 |
+
'sunlight_time', 'wind_direction', 'wind_speed']
|
| 96 |
+
feature=clean_data[morning_features].copy()
|
| 97 |
+
label = clean_data['rain_accum'].copy()
|
| 98 |
+
X_train,X_test,y_train,y_test = train_test_split(feature,label,test_size=0.1,random_state=324)
|
| 99 |
+
clf = joblib.load("dtc_model.m") # DecisionTreeClassifier(random_state=25)
|
| 100 |
+
rfc = joblib.load("rfc_model.m") # RandomForestClassifier(random_state=25, n_estimators=11)
|
| 101 |
+
# clf.fit(X_train,y_train)
|
| 102 |
+
# rfc.fit(X_train,y_train)
|
| 103 |
+
clf_score = clf.score(X_test, y_test)
|
| 104 |
+
rfc_score = rfc.score(X_test, y_test)
|
| 105 |
+
score = pd.DataFrame([[clf_score,rfc_score],['DecisioTree Score','RandomForest Score']],columns=['DecisioTree Score','RandomForest Score'])
|
| 106 |
+
|
| 107 |
with gr.Blocks() as demo:
|
| 108 |
gr.Markdown("""
|
| 109 |
## Data Collection
|
dtc_model.m
ADDED
|
Binary file (5.88 kB). View file
|
|
|
result.png
ADDED
|
rfc_model.m
ADDED
|
Binary file (67.9 kB). View file
|
|
|