-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Before you begin, ensure you have:
|
3.8+ |
Latest Usually included |
Minimum 8GB recommended |
Latest |
# 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!
# Create environment
python3 -m venv venv
# Activate
source venv/bin/activate |
# Create environment
python -m venv venv
# Activate
venv\Scripts\activate |
โ Verify: Your prompt should show
(venv)prefix
# 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 |
Run this quick test:
# test_install.py
from depression_predictor import DepressionPredictor
print("โ
Installation successful!")
print(f"๐ฆ Version: {DepressionPredictor.__version__}")python test_install.pyExpected output:
โ
Installation successful!
๐ฆ Version: 1.0.0
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}")# 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
# Load pre-trained model
model = DepressionPredictor(model_path='models/best_model.h5')
# Make prediction
result = model.predict(your_data)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: csvVerify everything works:
# Run all tests
pytest tests/
# Run with coverage
pytest --cov=depression_predictor tests/
# Run specific test file
pytest tests/test_model.py -vExpected output:
โ
tests/test_model.py ........................ PASSED
โ
tests/test_preprocessing.py ................ . PASSED
โ
tests/test_api.py ........................... PASSED
========== 24 passed in 5.32s ==========
# Start Flask development server
python app.py
# Or with gunicorn (production)
gunicorn -w 4 -b 0.0.0.0:5000 app:appVerify it's running:
curl http://localhost:5000/api/v1/healthResponse:
{
"status": "healthy",
"version": "1.0.0"
}# Download sample dataset
python scripts/download_sample_data.py
# Verify download
ls -lh data/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
| Step | Topic | Time | |: ----:|-------|------| | 1๏ธโฃ | ๐ Usage Guide | 10 min | | 2๏ธโฃ | ๐๏ธ Model Architecture | 15 min | | 3๏ธโฃ | ๐ API Reference | 20 min | | 4๏ธโฃ | ๐พ Dataset Information | 10 min |
โ 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๐ฏ Performance Tip
For faster predictions, use batch processing instead of single predictions
๐ Security Tip
Never commit your
config.ymlwith 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]