This project employs the CatBoost algorithm for predicting the survival of Titanic passengers. It's implemented using the JFrog ML and the CatBoost library.
-
Custom TitanicSurvivalPrediction Class Definition: Customizes the base QwakModel to work with the CatBoost algorithm for survival prediction.
-
Model Initialization: Initializes the CatBoost model with user-defined or default hyperparameters. The model is trained on the Titanic dataset and fine-tuned for optimal performance.
-
Survival Prediction via JFrog ML's Predict API: Utilizes JFrog ML's Predict API for assessing the probability of survival based on various features like passenger class, age, sex, etc.
The primary functionality is to predict the probability of survival for Titanic passengers. The code is designed for seamless integration with JFrog ML's platform and serves as a practical example for survival prediction tasks.
-
Clone the Repository: Clone this GitHub repository to your local machine.
-
Install Dependencies: Make sure you have the required dependencies installed, as specified in the
conda.yml
file.conda env create -f main/conda.yaml conda activate titanic_conda
-
Install and Configure the Qwak SDK: Use your account JFrog ML API Keyto set up your SDK locally.
pip install qwak-sdk qwak configure
-
Run the Model Locally: Execute the following command to test the model locally:
python test_model_locally.py
-
Build on the JFrog ML Platform:
Create a new model on JFrog ML using the command:
qwak models create "Titanic Survival Model" --project "Sample Project"
Initiate a model build with:
qwak models build --model-id <your-model-id> ./titanic_conda
-
Deploy the Model on the JFrog ML Platform with a Real-Time Endpoint:
To deploy your model via the CLI, use the following command:
qwak models deploy realtime --model-id <your-model-id> --build-id <your-build-id>
-
Test the Live Model with a Sample Request:
Install the JFrog ML Inference SDK:
pip install qwak-inference
Call the Real-Time endpoint using your Model ID from the JFrog ML platform:
python test_live_mode.py <your-qwak-model-id>
.
├── main # Main directory containing core code
│ ├── __init__.py # An empty file that indicates this directory is a Python package
│ ├── model.py # Defines the Titanic Survival Model
│ └── conda.yaml # Conda environment configuration
|
├── test_model_locally.py # Script to test the model locally
├── test_live_model.py # Script to test the live model with a sample REST request
└── README.md # Documentation