How vj220803/titanic_survival works
Project type and purpose
• This is a standalone machine-learning classification project (“Titanic Survival Prediction”) whose primary goal is to train a Random Forest model on tabular data and expose prediction functionality via a Python app (app.py).
• It includes exploratory data analysis (EDA) and model-building in a Jupyter notebook, serialized artifacts (model and encoders), and a lightweight serving layer.
File structure
Top-level files:
• Titanic_CODSOFT.ipynb – notebook that implements the entire ML pipeline: data loading, EDA, preprocessing, training, evaluation.
• Titanic-Dataset.csv – raw data source.
• titanic_model.pkl, le_sex.pkl, le_embarked.pkl – serialized artifacts from training (model and encoders).
• app.py – Python script acting as the inference service (likely Flask or FastAPI).
• requirements.txt – lists Python dependencies.
• Book1_Titanic.twbx – Tableau workbook for visualizing feature insights.
README for additional insights
• The README confirms steps: data loading, cleaning, feature encoding, model training, and evaluation metrics.
• It mentions a “UI Dashboard” (Tableau) link.
a. Main components
1. Data Layer
• Titanic-Dataset.csv (source CSV)
• Tableau workbook (Book1_Titanic.twbx) for visualization (optional)
2. Training Pipeline
• Jupyter Notebook (Titanic_CODSOFT.ipynb) orchestrates:
• Data ingestion (pandas)
• Preprocessing (fill missing, label encoding)
• Feature selection
• Model training (scikit-learn RandomForest)
• Model evaluation
• Produces artifacts: titanic_model.pkl, le_sex.pkl, le_embarked.pkl
3. Inference/API Layer
• app.py: loads pickled model & encoders, exposes an HTTP endpoint (Flask/FastAPI)
• Accepts JSON/post parameters (Pclass, Sex, Age, etc.), returns predicted “Survived” label
4. Client/UI Layer
• Could be:
• A simple web page or Postman/cURL tests against the API
• Tableau Dashboard for visual exploration (reads CSV or API)
b. Relationships & interactions
• Training pipeline reads raw CSV → processes → outputs model artifacts.
• Inference layer loads artifacts at startup → receives user input → applies same preprocessing → invokes model.predict → returns result.
• Optional: Tableau connects directly to CSV or calls the API for live predictions.
c. Architectural patterns & design principles
• Separation of concerns: training vs inference; data vs model serving
• Reproducibility: notebook documents everything, artifacts ensure identical preprocessing in inference
• Stateless API: no persistent session, model loaded once in memory
d. Key technologies
• Python, pandas, scikit-learn, Flask or FastAPI (in app.py)
• Jupyter Notebook (for pipeline orchestration)
• pickle for serialization
• Tableau (for viz)
Elements
• Raw Data → Notebook
• Notebook → Model Artifacts
• Model Artifacts → Inference API
• Client → Inference API → Response
• Raw Data → Tableau (optional)
• Blue for data stores (CSV, pickles)
• Green for compute components (Notebook, API)
• Orange for user-facing/UI (Client, Tableau)
Final advice
• Be detailed but avoid clutter: group related files/artifacts under each component.
• Essential flow: Data → Train → Artifacts → Serve → Consume.