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