Skip to main content

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

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

data_science_pro-0.1.9.tar.gz (33.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

data_science_pro-0.1.9-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

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

Hashes for data_science_pro-0.1.9.tar.gz
Algorithm Hash digest
SHA256 b32231fc8690091fa328632995759efe193f3d982998510cd5000b0443907123
MD5 a2d81fa07d32aa80e3884b492244f9df
BLAKE2b-256 489898d20c7ac7239333c1412ff67ada47bb8e65bb41131069d4362402160477

See more details on using hashes here.

File details

Details for the file data_science_pro-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for data_science_pro-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 1a53edf3c97f837388a3fe4b0a75fc9f4c7ed58d2787bc48b5df88a82094703c
MD5 79b46653a922402118e6547979c53877
BLAKE2b-256 9665c6289db8e977a240bd173d6dd4a9e9184304497eea27bd8ce040f663c594

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page