LLM-powered modular data science pipeline
Project description
๐ Data Science Pro
AI-Powered Automated Data Science Pipeline
Transform your data science workflow with an intelligent pipeline that automates EDA, preprocessing, model selection, training, and evaluation - all powered by LLM suggestions.
โจ Key Features
- ๐ค AI-Powered Suggestions: Get intelligent recommendations for preprocessing, feature engineering, and model selection
- ๐ Automated EDA: Generate comprehensive data analysis reports instantly
- ๐ง Smart Preprocessing: Handle missing values, encode categoricals, scale features automatically
- ๐ฏ Model Selection: LLM suggests optimal models and hyperparameters based on your data
- ๐ Training & Evaluation: Train models with built-in evaluation metrics
- ๐พ Model Registry: Save and version your trained models
- ๐ Cyclic Workflow: Iterate until you achieve your desired performance metrics
๐ฆ Installation
# Clone the repository
git clone <your-repo-url>
cd data_science_pro
# Install the package
pip install .
๐ Quick Start
Option 1: Command Line Interface (CLI)
# Basic usage
data-science-pro --data your_data.csv --target target_column --api_key your_openai_key
# This will:
# - Load your dataset
# - Generate EDA report
# - Apply preprocessing (drop NA, encode, scale)
# - Train a RandomForest model
# - Display evaluation metrics
Option 2: Python API (Interactive)
import data_science_pro
# Initialize pipeline with OpenAI API key
pipeline = data_science_pro.DataSciencePro(api_key='your-openai-key')
# Load your data
pipeline.input_data('your_data.csv', target_col='target_column')
# Get AI-powered analysis
report = pipeline.report()
print("๐ Data Analysis Report:")
print(report)
# Get intelligent suggestions
suggestions = pipeline.suggestions("How can I improve my model accuracy?")
print("๐ค AI Suggestions:", suggestions)
๐ Available Preprocessing Actions
| Action | Description |
|---|---|
drop_na |
Remove rows with missing values |
fill_na |
Fill missing values (median for numeric, mode for categorical) |
encode_categorical |
One-hot encode categorical variables |
scale_numeric |
Standard scale numeric features |
drop_duplicates |
Remove duplicate rows |
drop_constant |
Remove columns with constant values |
drop_high_na |
Remove columns with >50% missing values |
feature_gen |
Generate interaction features |
๐ค Available Models
| Model | Parameters |
|---|---|
randomforest |
{'n_estimators': 100, 'max_depth': 10} |
logisticregression |
{'C': 1.0, 'max_iter': 1000} |
๐ฏ Complete Workflow Example
import data_science_pro
# Initialize pipeline
pipeline = data_science_pro.DataSciencePro(api_key='your-openai-key')
# 1. Load data
pipeline.input_data('titanic.csv', target_col='Survived')
# 2. Get initial analysis
print("Initial Analysis:", pipeline.report())
# 3. Apply preprocessing
preprocessing_steps = ['drop_na', 'encode_categorical', 'scale_numeric']
for step in preprocessing_steps:
print(f"Applying {step}...")
pipeline.apply_action(step)
# 4. Train model with AI-suggested hyperparameters
pipeline.set_model('randomforest', {'n_estimators': 200, 'max_depth': 15})
pipeline.train()
# 5. Evaluate model
results = pipeline.evaluate()
print("๐ Model Performance:", results)
# 6. Save model
pipeline.save_model('titanic_model.pkl')
print("๐พ Model saved successfully!")
๐ Advanced: Cyclic Workflow
from data_science_pro.cycle.controller import Controller
# Run automated cyclic workflow until target metric is achieved
controller = Controller()
pipeline.run_full_cycle(controller, metric_goal=0.85)
๐ ๏ธ Troubleshooting
Import Error: ModuleNotFoundError: No module named 'data_science_pro'
Solution: Make sure you installed the package with pip install . and you're running from a different directory than the package source.
Error: NameError: name 'OneHotEncoder' is not defined
Solution: This was a bug that's been fixed. Update your package installation.
Error: TypeError: input_data() got an unexpected keyword argument 'target'
Solution: Use target_col instead of target:
# โ Wrong
pipeline.input_data('data.csv', target='column_name')
# โ
Correct
pipeline.input_data('data.csv', target_col='column_name')
OpenAI API Issues
- Make sure your API key is valid and has credits
- Check your internet connection
- Verify the API key format:
sk-...
๐ Example Output
๐ Data Analysis Report:
Dataset shape: (891, 12)
Target variable: Survived
Missing values: Age (177), Cabin (687), Embarked (2)
Data types: 5 numeric, 7 categorical
๐ค AI Suggestions:
"Based on your data, I recommend:
1. Fill missing Age values with median
2. Drop Cabin column due to high missingness (77%)
3. Encode Sex and Embarked as categorical
4. Consider RandomForest with n_estimators=200"
๐ Model Performance:
{'accuracy': 0.83, 'precision': 0.81, 'recall': 0.79, 'f1_score': 0.80}
๐งช Testing Your Installation
Run this quick test to verify everything works:
import data_science_pro
# Test basic functionality
pipeline = data_science_pro.DataSciencePro(api_key='test-key')
print("โ
Package imported successfully!")
# Test with sample data
import pandas as pd
sample_data = pd.DataFrame({
'feature1': [1, 2, 3, 4, 5],
'feature2': ['A', 'B', 'A', 'B', 'A'],
'target': [0, 1, 0, 1, 0]
})
sample_data.to_csv('test_data.csv', index=False)
pipeline.input_data('test_data.csv', target_col='target')
print("โ
Data loading works!")
# Clean up
import os
os.remove('test_data.csv')
print("โ
All tests passed!")
๐ง Extending the Package
Adding Custom Preprocessing
Edit data_science_pro/data/data_operations.py:
def your_custom_operation(self, df, **kwargs):
# Your preprocessing logic here
return df
Adding New Models
Edit the set_model method in pipeline.py:
elif model_name.lower() == 'your_model':
from sklearn.your_model import YourModel
self.model_instance = YourModel(**hyperparams)
๐ Requirements
- Python 3.8+
- pandas
- scikit-learn
- langchain
- openai
- imbalanced-learn
See requirements.txt for complete list.
๐ค Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Built with LangChain for LLM integration
- Powered by scikit-learn for machine learning
- Inspired by automated ML pipelines
Happy Data Science! ๐ Start building smarter models with AI-powered assistance today!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file data_science_pro-0.1.9.tar.gz.
File metadata
- Download URL: data_science_pro-0.1.9.tar.gz
- Upload date:
- Size: 33.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b32231fc8690091fa328632995759efe193f3d982998510cd5000b0443907123
|
|
| MD5 |
a2d81fa07d32aa80e3884b492244f9df
|
|
| BLAKE2b-256 |
489898d20c7ac7239333c1412ff67ada47bb8e65bb41131069d4362402160477
|
File details
Details for the file data_science_pro-0.1.9-py3-none-any.whl.
File metadata
- Download URL: data_science_pro-0.1.9-py3-none-any.whl
- Upload date:
- Size: 35.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a53edf3c97f837388a3fe4b0a75fc9f4c7ed58d2787bc48b5df88a82094703c
|
|
| MD5 |
79b46653a922402118e6547979c53877
|
|
| BLAKE2b-256 |
9665c6289db8e977a240bd173d6dd4a9e9184304497eea27bd8ce040f663c594
|