Dodanie model.joblib + README
Browse files
README.md
CHANGED
|
@@ -18,4 +18,31 @@ tags:
|
|
| 18 |
- Embarked: Port zaokr臋towania, czyli miejsce, w kt贸rym pasa偶er wsiad艂 na statek:
|
| 19 |
- C = Cherbourg
|
| 20 |
- Q = Queenstown
|
| 21 |
-
- S = Southampton
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
- Embarked: Port zaokr臋towania, czyli miejsce, w kt贸rym pasa偶er wsiad艂 na statek:
|
| 19 |
- C = Cherbourg
|
| 20 |
- Q = Queenstown
|
| 21 |
+
- S = Southampton
|
| 22 |
+
|
| 23 |
+
Przyk艂ad u偶ycia modelu:
|
| 24 |
+
|
| 25 |
+
```python
|
| 26 |
+
import joblib
|
| 27 |
+
import pandas as pd
|
| 28 |
+
from huggingface_hub import hf_hub_download
|
| 29 |
+
import numpy as np
|
| 30 |
+
|
| 31 |
+
repo_id = "studentscolab/titanic"
|
| 32 |
+
|
| 33 |
+
model_path = hf_hub_download(repo_id=repo_id, filename="model.joblib")
|
| 34 |
+
model = joblib.load(model_path)
|
| 35 |
+
|
| 36 |
+
sample_data = pd.DataFrame([
|
| 37 |
+
{'Pclass': 3, 'Sex': 'male', 'Age': 25, 'SibSp': 0, 'Parch': 0, 'Fare': 7.5, 'Embarked': 'S'},
|
| 38 |
+
{'Pclass': 1, 'Sex': 'female', 'Age': 35, 'SibSp': 1, 'Parch': 0, 'Fare': 1.5, 'Embarked': 'S'}
|
| 39 |
+
])
|
| 40 |
+
np.set_printoptions(precision=10, suppress=True)
|
| 41 |
+
|
| 42 |
+
print(sample_data)
|
| 43 |
+
|
| 44 |
+
prediction = model.predict(sample_data)
|
| 45 |
+
|
| 46 |
+
for p in prediction:
|
| 47 |
+
print(f"Prognoza dla danych pr贸bnych [{p}]: {'prze偶y艂' if prediction[p] == 1 else 'nie prze偶y艂'}")
|
| 48 |
+
```
|