Downloads · 30 days
2
2% of all-time downloads
MarceloLZR/titanic
titanic is a tabular classification model from MarceloLZR. Use it for the tabular classification task on the model card, and read the license before you ship it in a product. It is set up for sklearn.
Downloads · 30 days
2
2% of all-time downloads
All-time downloads
97
Public
Repo size
34.1 KB
Likes
0
Public
Click a slice to open those files.
.h526.4 KB · 69%
From the Hugging Face model README
from huggingface_hub import hf_hub_url, cached_download
import joblib
import pandas as pd
import numpy as np
from tensorflow.keras.models import load_model
REPO_ID = 'danupurnomo/dummy-titanic'
PIPELINE_FILENAME = 'final_pipeline.pkl'
TF_FILENAME = 'titanic_model.h5'
model_pipeline = joblib.load(cached_download(
hf_hub_url(REPO_ID, PIPELINE_FILENAME)
))
model_seq = load_model(cached_download(
hf_hub_url(REPO_ID, TF_FILENAME)
))
new_data = {
'PassengerId': 1191,
'Pclass': 1,
'Name': 'Sherlock Holmes',
'Sex': 'male',
'Age': 30,
'SibSp': 0,
'Parch': 0,
'Ticket': 'C.A.29395',
'Fare': 12,
'Cabin': 'F44',
'Embarked': 'S'
}
new_data = pd.DataFrame([new_data])
new_data_transform = model_pipeline.transform(new_data)
y_pred_inf_single = model_seq.predict(new_data_transform)
y_pred_inf_single = np.where(y_pred_inf_single >= 0.5, 1, 0)
print('Result : ', y_pred_inf_single)
# [[0]]