Skip to content

Getting Started

SRIJA DE CHOWDHURY edited this page Dec 29, 2025 · 1 revision

🚀 Getting Started

Get up and running in under 5 minutes!


📋 Prerequisites

Before you begin, ensure you have:

🐍 Python

3.8+

Download

📦 pip

Latest

Usually included

💻 4GB RAM

Minimum

8GB recommended

🔧 Git

Latest

Download


🎯 Installation Steps

Step 1️⃣: Clone the Repository

# Clone via HTTPS
git clone https://github.com/willow788/Advanced-depression-predictor-model. git

# Or via SSH
git clone git@github.com:willow788/Advanced-depression-predictor-model.git

# Navigate to directory
cd Advanced-depression-predictor-model

💡 Tip: Use SSH for easier authentication!


Step 2️⃣: Create Virtual Environment

🐧 Linux/Mac

# Create environment
python3 -m venv venv

# Activate
source venv/bin/activate

🪟 Windows

# Create environment
python -m venv venv

# Activate
venv\Scripts\activate

Verify: Your prompt should show (venv) prefix


Step 3️⃣: Install Dependencies

# Install all required packages
pip install -r requirements. txt

# Or install with dev dependencies
pip install -r requirements-dev.txt
📦 View Key Dependencies
Package Version Purpose
TensorFlow 2.13+ Neural network framework
scikit-learn 1.3+ ML utilities
pandas 2.0+ Data manipulation
numpy 1.24+ Numerical computing
matplotlib 3.7+ Visualization
Flask 2.3+ REST API

✅ Verify Installation

Run this quick test:

# test_install.py
from depression_predictor import DepressionPredictor

print("✅ Installation successful!")
print(f"📦 Version: {DepressionPredictor.__version__}")
python test_install.py

Expected output:

✅ Installation successful!
📦 Version:  1.0.0

🎨 Quick Start Examples

Example 1: Simple Prediction

from depression_predictor import DepressionPredictor
import pandas as pd

# 1. Initialize model
model = DepressionPredictor()

# 2. Load sample data
data = pd.read_csv('data/sample. csv')

# 3. Make predictions
predictions = model.predict(data)

# 4. View results
print(f"Predictions: {predictions}")

Example 2: Single Sample Prediction

# Prepare sample data
sample = {
    'age': 28,
    'gender': 'female',
    'sleep_hours': 5. 5,
    'activity_level': 'low',
    'mood_score': 3,
    'social_interaction': 'minimal',
    # ... other features
}

# Get prediction
result = model.predict_single(sample)

# Display results
print(f"""
🎯 Prediction Results
{'='*40}
Risk Level:      {result['prediction']}
Probability:    {result['probability']:.1%}
Confidence:     {result['confidence']}
""")

Output:

🎯 Prediction Results
========================================
Risk Level:     1
Probability:    76.3%
Confidence:     high

Example 3: Using Pre-trained Model

# Load pre-trained model
model = DepressionPredictor(model_path='models/best_model.h5')

# Make prediction
result = model.predict(your_data)

⚙️ Configuration

Create a config.yml file in the project root:

# Model Configuration
model: 
  type: neural_network
  architecture: deep
  epochs: 100
  batch_size: 32
  learning_rate: 0.001

# Data Configuration
data:
  train_path: data/train.csv
  test_path: data/test.csv
  validation_split: 0.2
  
# Feature Configuration
features:
  scaling: standard
  missing_strategy: median
  categorical_encoding: onehot

# Output Configuration
output:
  save_predictions: true
  output_path: results/
  format: csv

🧪 Run Tests

Verify everything works:

# Run all tests
pytest tests/

# Run with coverage
pytest --cov=depression_predictor tests/

# Run specific test file
pytest tests/test_model.py -v

Expected output:

✅ tests/test_model.py ........................  PASSED
✅ tests/test_preprocessing.py ................ .  PASSED
✅ tests/test_api.py ...........................  PASSED

========== 24 passed in 5.32s ==========

🚀 Starting the API Server

# Start Flask development server
python app.py

# Or with gunicorn (production)
gunicorn -w 4 -b 0.0.0.0:5000 app:app

Verify it's running:

curl http://localhost:5000/api/v1/health

Response:

{
  "status": "healthy",
  "version": "1.0.0"
}

📊 Download Sample Data

# Download sample dataset
python scripts/download_sample_data.py

# Verify download
ls -lh data/

🎓 Learning Path

graph TD
    A[🚀 Getting Started] --> B[📚 Usage Guide]
    B --> C[🏗️ Model Architecture]
    C --> D[🔌 API Reference]
    D --> E[📊 Performance Metrics]
    E --> F[🤝 Contributing]
    
    style A fill:#4CAF50
    style B fill:#2196F3
    style C fill:#FF9800
    style D fill:#9C27B0
    style E fill:#F44336
    style F fill:#00BCD4
Loading

📚 Recommended Next Steps

| Step | Topic | Time | |: ----:|-------|------| | 1️⃣ | 📖 Usage Guide | 10 min | | 2️⃣ | 🏗️ Model Architecture | 15 min | | 3️⃣ | 🔌 API Reference | 20 min | | 4️⃣ | 💾 Dataset Information | 10 min |


🐛 Troubleshooting

❌ ImportError: No module named 'depression_predictor'

Solution:

# Ensure you're in the correct directory
cd Advanced-depression-predictor-model

# Install in development mode
pip install -e . 
❌ TensorFlow installation failed

Solution:

# For Mac M1/M2
pip install tensorflow-macos

# For older systems, try
pip install tensorflow==2.12.0
❌ CUDA/GPU issues

Solution:

# Install CPU-only version
pip install tensorflow-cpu

# Or check CUDA compatibility
python -c "import tensorflow as tf; print(tf. config.list_physical_devices('GPU'))"
❌ Port 5000 already in use

Solution:

# Use a different port
export FLASK_PORT=5001
python app.py

# Or kill the process using port 5000
lsof -ti:5000 | xargs kill -9

💡 Tips & Best Practices

🎯 Performance Tip

For faster predictions, use batch processing instead of single predictions

🔒 Security Tip

Never commit your config.yml with sensitive data. Use environment variables instead.

📦 Dependency Tip

Keep your dependencies updated:

pip install --upgrade -r requirements.txt

Speed Tip

Use a GPU for training. Install with:

pip install tensorflow[and-cuda]

🎉 Success!

You're all set! 🎊

📚 Continue to Usage Guide →


Need help? Check the FAQ or open an issue

Clone this wiki locally