Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
## `.pkl` 文件是什么?
|
| 2 |
|
| 3 |
PKL = Pickle,是 Python 的一种序列化格式。
|
|
@@ -10,11 +13,13 @@ PKL = Pickle,是 Python 的一种序列化格式。
|
|
| 10 |
## 两个文件分别存了什么?
|
| 11 |
|
| 12 |
### `bike_availability_model.pkl`
|
|
|
|
| 13 |
- 存储了训练好的 Random Forest 模型
|
| 14 |
- 包含所有学习到的决策树、权重等信息
|
| 15 |
- 加载后可以直接调用 `.predict()` 进行预测
|
| 16 |
|
| 17 |
### `model_features.pkl`
|
|
|
|
| 18 |
- 存储了特征列表:`['station_id', 'capacity', 'lat', 'lon', 'hour', 'day', 'day_of_week', 'is_weekend', 'avg_temperature', 'avg_humidity', 'avg_pressure']`
|
| 19 |
- 确保预测时特征的**顺序和名称**与训练时完全一致
|
| 20 |
- 顺序错了预测结果就会出错
|
|
@@ -22,6 +27,7 @@ PKL = Pickle,是 Python 的一种序列化格式。
|
|
| 22 |
---
|
| 23 |
|
| 24 |
## 如何在 Flask 中使用?
|
|
|
|
| 25 |
```python
|
| 26 |
import pickle
|
| 27 |
import pandas as pd
|
|
@@ -55,4 +61,5 @@ def predict_bikes(station_id, capacity, lat, lon,
|
|
| 55 |
|
| 56 |
prediction = model.predict(input_data)
|
| 57 |
return int(round(prediction[0]))
|
| 58 |
-
```
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
## `.pkl` 文件是什么?
|
| 5 |
|
| 6 |
PKL = Pickle,是 Python 的一种序列化格式。
|
|
|
|
| 13 |
## 两个文件分别存了什么?
|
| 14 |
|
| 15 |
### `bike_availability_model.pkl`
|
| 16 |
+
|
| 17 |
- 存储了训练好的 Random Forest 模型
|
| 18 |
- 包含所有学习到的决策树、权重等信息
|
| 19 |
- 加载后可以直接调用 `.predict()` 进行预测
|
| 20 |
|
| 21 |
### `model_features.pkl`
|
| 22 |
+
|
| 23 |
- 存储了特征列表:`['station_id', 'capacity', 'lat', 'lon', 'hour', 'day', 'day_of_week', 'is_weekend', 'avg_temperature', 'avg_humidity', 'avg_pressure']`
|
| 24 |
- 确保预测时特征的**顺序和名称**与训练时完全一致
|
| 25 |
- 顺序错了预测结果就会出错
|
|
|
|
| 27 |
---
|
| 28 |
|
| 29 |
## 如何在 Flask 中使用?
|
| 30 |
+
|
| 31 |
```python
|
| 32 |
import pickle
|
| 33 |
import pandas as pd
|
|
|
|
| 61 |
|
| 62 |
prediction = model.predict(input_data)
|
| 63 |
return int(round(prediction[0]))
|
| 64 |
+
```
|
| 65 |
+
|