An automated machine learning system that leverages O1 and Claude to iteratively develop, improve, and optimize ML solutions.
This system automates the entire machine learning workflow by:
- Generating ML code using O1
- Fixing errors using Claude
- Optimizing performance when needed
- Tracking progress and improvements across iterations
- Managing solution versions and submissions
- NOTE: includes datasets for Spceship Titanic Kaggle challenge: https://www.kaggle.com/competitions/spaceship-titanic/overview
π Proven Performance: This AI Data Scientist achieved remarkable success on Kaggle's Spaceship Titanic challenge, ranking 29th out of 2,400+ solutions (top 1%)! π The system autonomously developed, optimized, and fine-tuned its solution to reach this exceptional performance level. π
Watch the complete build process on Patreon See exactly how this automation system was created step by step, with detailed explanations and insights into the development process.
This is one of 400+ fascinating projects in my collection! Support me on Patreon to get:
- π― Access to 400+ AI projects (and growing daily!)
- Including advanced projects like 2 Agent Real-time voice template with turn taking
- π₯ Full source code & detailed explanations
- π 1000x Cursor Course
- π Live coding sessions & AMAs
- π¬ 1-on-1 consultations (higher tiers)
- π Exclusive discounts on AI tools & platforms (up to $180 value)
- O1: Generates and improves ML solutions
- Claude: Handles error fixing and code repairs
- Both models maintain code quality and follow best practices
- Automatic GPU detection and utilization
- Graceful fallback to CPU when GPU is unavailable
- Framework-specific GPU optimizations (PyTorch, TensorFlow, XGBoost, LightGBM)
- Maximum runtime limit (default: 30 minutes)
- Automatic timeout detection
- Performance optimization suggestions when timeout occurs
- Maintains accuracy while improving efficiency
- Tracks performance metrics across iterations
- Uses previous results to guide improvements
- Maintains history of all solutions and progress reports
- Automated versioning of solutions, reports, and submissions
- Detailed progress reports in JSON format
- Cross-validation scores tracking
- Feature importance analysis
- Model performance metrics
- Execution logs with timestamps
- Intelligent error vs. warning detection
- Automatic error fixing with Claude
- Missing package installation handling
- Clear error reporting and logging
project/
βββ o1_ml_scientist.py # Main automation script
βββ solution.py # Current ML solution
βββ progress_report.json # Current progress metrics
βββ submission.csv # Current submission file
βββ execution_outputs.txt # Execution logs
βββ older_solutions/ # Version history
β βββ solution_1.py
β βββ progress_report_1.json
β βββ submission_1.csv
β βββ ...
Key configurable parameters:
ITERATIONS = 50 # Maximum iterations
MAX_RUNTIME_MINUTES = 30 # Maximum runtime per solution
CLAUDE_MODEL = "claude-3-5-sonnet-20241022"
O1_MODEL = "o1"
{
"cross_validation_scores": [...],
"mean_cv_accuracy": float,
"feature_importance": {
"feature1": importance1,
"feature2": importance2,
...
},
"model_parameters": {...},
"execution_time": float
}
- Code Generation: O1 generates ML solution
- Execution: Code runs with timeout monitoring
- Error Detection: System distinguishes between errors and warnings
- Error Fixing: Claude fixes errors while maintaining core functionality
- Performance Optimization: O1 optimizes slow-running solutions
- Verification: System verifies fixes and optimizations
- GPU utilization when available
- Proper train/test splitting
- Cross-validation for model evaluation
- Feature importance analysis
- Progress tracking and logging
- Code efficiency and readability
- UTF-8 encoding for file operations
- Proper error handling and reporting
- Maximum runtime constraint
- Model-specific GPU support
- Dependent on API availability
- Resource intensive for large datasets
- Python 3.x
- OpenAI API access
- Anthropic API access
- Required Python packages:
- openai
- anthropic
- pandas
- numpy
- scikit-learn
- torch (optional for GPU)
- termcolor
- other ML frameworks as needed
- Set up API keys as environment variables
- Prepare your dataset (train.csv and test.csv)
- Create additional_info.txt with problem description
- Run the main script:
python o1_ml_scientist.py
- solution.py: Current ML solution
- progress_report.json: Performance metrics
- submission.csv: Predictions
- execution_outputs.txt: Detailed logs
- Version history in older_solutions/
- Real-time execution feedback
- Color-coded status messages
- Detailed error reporting
- Progress tracking across iterations
- Performance metrics logging