MarceloLZR
commited on
Commit
•
205ff18
1
Parent(s):
ed8f563
Upload 5 files
Browse files- README.md +85 -0
- config.json +59 -0
- final_pipeline.pkl +3 -0
- sklearn_model.joblib +3 -0
- titanic_model.h5 +3 -0
README.md
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- tabular-classification
|
4 |
+
- sklearn
|
5 |
+
dataset:
|
6 |
+
- titanic
|
7 |
+
widget:
|
8 |
+
- structuredData:
|
9 |
+
PassengerId:
|
10 |
+
- 1191
|
11 |
+
Pclass:
|
12 |
+
- 1
|
13 |
+
Name:
|
14 |
+
- Sherlock Holmes
|
15 |
+
Sex:
|
16 |
+
- male
|
17 |
+
SibSp:
|
18 |
+
- 0
|
19 |
+
Parch:
|
20 |
+
- 0
|
21 |
+
Ticket:
|
22 |
+
- C.A.29395
|
23 |
+
Fare:
|
24 |
+
- 12
|
25 |
+
Cabin:
|
26 |
+
- F44
|
27 |
+
Embarked:
|
28 |
+
- S
|
29 |
+
|
30 |
+
---
|
31 |
+
|
32 |
+
## Titanic (Survived/Not Survived) - Binary Classification
|
33 |
+
|
34 |
+
### How to use
|
35 |
+
|
36 |
+
```python
|
37 |
+
from huggingface_hub import hf_hub_url, cached_download
|
38 |
+
import joblib
|
39 |
+
import pandas as pd
|
40 |
+
import numpy as np
|
41 |
+
from tensorflow.keras.models import load_model
|
42 |
+
|
43 |
+
REPO_ID = 'danupurnomo/dummy-titanic'
|
44 |
+
PIPELINE_FILENAME = 'final_pipeline.pkl'
|
45 |
+
TF_FILENAME = 'titanic_model.h5'
|
46 |
+
|
47 |
+
model_pipeline = joblib.load(cached_download(
|
48 |
+
hf_hub_url(REPO_ID, PIPELINE_FILENAME)
|
49 |
+
))
|
50 |
+
|
51 |
+
model_seq = load_model(cached_download(
|
52 |
+
hf_hub_url(REPO_ID, TF_FILENAME)
|
53 |
+
))
|
54 |
+
```
|
55 |
+
|
56 |
+
### Example A New Data
|
57 |
+
```python
|
58 |
+
new_data = {
|
59 |
+
'PassengerId': 1191,
|
60 |
+
'Pclass': 1,
|
61 |
+
'Name': 'Sherlock Holmes',
|
62 |
+
'Sex': 'male',
|
63 |
+
'Age': 30,
|
64 |
+
'SibSp': 0,
|
65 |
+
'Parch': 0,
|
66 |
+
'Ticket': 'C.A.29395',
|
67 |
+
'Fare': 12,
|
68 |
+
'Cabin': 'F44',
|
69 |
+
'Embarked': 'S'
|
70 |
+
}
|
71 |
+
new_data = pd.DataFrame([new_data])
|
72 |
+
```
|
73 |
+
|
74 |
+
### Transform Inference-Set
|
75 |
+
```python
|
76 |
+
new_data_transform = model_pipeline.transform(new_data)
|
77 |
+
```
|
78 |
+
|
79 |
+
### Predict using Neural Networks
|
80 |
+
```python
|
81 |
+
y_pred_inf_single = model_seq.predict(new_data_transform)
|
82 |
+
y_pred_inf_single = np.where(y_pred_inf_single >= 0.5, 1, 0)
|
83 |
+
print('Result : ', y_pred_inf_single)
|
84 |
+
# [[0]]
|
85 |
+
```
|
config.json
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"sklearn": {
|
3 |
+
"columns": [
|
4 |
+
"PassengerId",
|
5 |
+
"Pclass",
|
6 |
+
"Name",
|
7 |
+
"Sex",
|
8 |
+
"Age",
|
9 |
+
"SibSp",
|
10 |
+
"Parch",
|
11 |
+
"Ticket",
|
12 |
+
"Fare",
|
13 |
+
"Cabin",
|
14 |
+
"Embarked"
|
15 |
+
],
|
16 |
+
"environment": [
|
17 |
+
"scikit-learn=1.1.1"
|
18 |
+
],
|
19 |
+
"example_input": {
|
20 |
+
"PassengerId": [
|
21 |
+
1191
|
22 |
+
],
|
23 |
+
"Pclass": [
|
24 |
+
1
|
25 |
+
],
|
26 |
+
"Name": [
|
27 |
+
"Sherlock Holmes"
|
28 |
+
],
|
29 |
+
"Sex": [
|
30 |
+
"male"
|
31 |
+
],
|
32 |
+
"Age": [
|
33 |
+
30
|
34 |
+
],
|
35 |
+
"SibSp": [
|
36 |
+
0
|
37 |
+
],
|
38 |
+
"Parch": [
|
39 |
+
0
|
40 |
+
],
|
41 |
+
"Ticket": [
|
42 |
+
"C.A.29395"
|
43 |
+
],
|
44 |
+
"Fare": [
|
45 |
+
12
|
46 |
+
],
|
47 |
+
"Cabin": [
|
48 |
+
"F44"
|
49 |
+
],
|
50 |
+
"Embarked": [
|
51 |
+
"S"
|
52 |
+
]
|
53 |
+
},
|
54 |
+
"model": {
|
55 |
+
"file": "sklean_model.jpblib"
|
56 |
+
},
|
57 |
+
"task": "tabular-classificaation"
|
58 |
+
}
|
59 |
+
}
|
final_pipeline.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f19010fbf0a972ebd404d9c7c07ff768b6793b51fdeb30122b254617b50bea78
|
3 |
+
size 3435
|
sklearn_model.joblib
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:24aaf13e7124bc8af8d319d2a093e611919eb8b7584aecbe1f4199715f9553ae
|
3 |
+
size 4287
|
titanic_model.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:15f39eb8d2456faaa095259e186bb6f438698cc0c5a4324c08a4f6a5346d5213
|
3 |
+
size 26368
|