Skip to main content

"It is a Machine Learning Copilot Agent that can execute code for end-to-end ML Cycle"

Project description

ML-Copilot-Agent

ML-Copilot is an interactive machine learning assistant that streamlines the process of data preprocessing, model training, evaluation, plotting results, and generating documentation—all through a command-line interface powered by OpenAI's GPT 4o.

The framework is build as an llm-agent with llama-index workflow, which is able to execute realtime code through code-intepreter which is present as a tool with the llm-agenmt.

Full Documentation available on Read the Docs

How to use ? : watch short video (Recommended)

How to use ?: Watch short video

LLM-Agent-Features

  • List Files: View files in the current directory.
  • Data Preprocessing: Preprocess data for binary classification tasks with customizable instructions.
  • Model Training: Train binary classification models using algorithms like Logistic Regression, SVM, or Random Forest.
  • Model Evaluation: Evaluate trained models and obtain metrics such as accuracy, precision, recall, F1-score, and AUC.
  • Plotting: Generate various plots (e.g., bar plots, PCA plots, correlation matrices) from data or evaluation results.
  • Interactive Workflow: Seamlessly navigate through different steps with an intuitive command-line interface.
  • Custom Instruction: Can provide custom instruction to execute code, for example "Perform pca on temp_csv, save the pca results, plot the pca and save plot inside results folder

Please make a conda environment before begin

Direct Installation

pip install ml-copilot-agent

Manual Installation

  1. Clone the repository:
git clone https://github.com/VatsalPatel18/ml-copilot-agent.git
  1. Navigate to the project directory:
cd ml-copilot
  1. Install the required dependencies:
pip install -r requirements.txt

Ensure you have Python 3.7 or higher installed on your system.

Usage

Download the file for test run

wget https://raw.githubusercontent.com/VatsalPatel18/ml-copilot-agent/master/temp_csv1.data
  1. Get Your OpenAI API Key::

To use the OpenAI API, you need to obtain your API key. If you haven't done so yet, follow these steps:

  • Go to the OpenAI API keys page
  • Log in to your OpenAI account (or sign up if you don't have one).
  • Create a new API key and copy it

Remember to delete the key after use.

  1. Run ML-Copilot:
python -m ml_copilot_agent paste-your-openai-api-key

Replace paste-your-openai-api-key with your actual OpenAI API key.

  1. Interact with ML-Copilot:

Once started, ML-Copilot will prompt you for commands. You can enter any of the following commands:

  • show files: Show files in the current directory.
  • preprocess: Preprocess data for a binary classification task.
  • train: Train a binary classification model.
  • evaluate: Evaluate the trained model.
  • plot: Generate plots from data or evaluation results.
  • document: Generate a documentation report. (Under Development)
  • exit: Terminate the workflow.

Example Workflow

Step 1: List Files

list files

View all files in the current directory to ensure your dataset is available.

Step 2: Preprocess Data

preprocess
  • Dataset Path: Provide the path to your dataset (e.g., data/dataset.csv).
  • Target Column Name: Specify the name of the target column in your dataset.
  • Save Path: Choose where to save the preprocessed data (default is data/preprocessed_data.csv).
  • Additional Instructions: (Optional) Add any specific preprocessing instructions (e.g., "use standard scaler").

Step 3: Train Model

train
  • Model Save Path: Specify where to save the trained model (default is models/model.pkl).
  • Additional Instructions: (Optional) Specify model preferences (e.g., "use SVM classifier").

Step 4: Evaluate Model

evaluate
  • Evaluation Save Path: Specify where to save the evaluation results (default is results/evaluation.txt).

Step 5: Plot Results

plot
  • Data File Path: Provide the data file path or press Enter to use default evaluation results or preprocessed data.
  • Additional Plotting Instructions: (Optional) Specify the type of plot (e.g., "make a bar plot of accuracy and precision").

Step 7: Custom Instructions

custom instruction
  • Provide any kind of custom instruction that you would like to execute code.

Step 8: Exit

exit

Terminate the workflow when you are done.

Dependencies

  • Python 3.7 or higher
  • OpenAI GPT Models
  • LlamaIndex
  • Pandas
  • Scikit-learn
  • Matplotlib
  • Seaborn

Install all dependencies using:

pip install -r requirements.txt

Project Structure

  • ml_copilot/
  • __init__.py: Initialization and configuration.
  • __main__.py: Entry point of the application.
  • workflow.py: Defines the MLWorkflow class and all associated steps and events.
  • data/: Directory where preprocessed data is saved.
  • models/: Directory where trained models are saved.
  • results/: Directory where evaluation results and plots are saved.
  • reports/: Directory where documentation reports are saved.
  • requirements.txt: Contains all Python dependencies.

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Commit your changes with clear and descriptive messages.
  4. Push to your fork and submit a pull request.

License

This project is licensed under the CC-BY-NC-ND-4.0 License.

Acknowledgments

  • Thanks to the developers of OpenAI and LlamaIndex for providing the foundational tools that make this project possible.

Contact

For any questions or suggestions, feel free to open an issue or contact vatsal1804@gmail.com.

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

ml_copilot_agent-0.1.9.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

ml_copilot_agent-0.1.9-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file ml_copilot_agent-0.1.9.tar.gz.

File metadata

  • Download URL: ml_copilot_agent-0.1.9.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.7 Linux/6.8.0-48-generic

File hashes

Hashes for ml_copilot_agent-0.1.9.tar.gz
Algorithm Hash digest
SHA256 2f33342f8c1de1d9870c33a72ea331cf1f0a253c13f76d4a7607f49deab9eeae
MD5 014ee8ef2dc8fee92c0d5dae78c4ae38
BLAKE2b-256 c3d1a8696454702ef73d3d792c80987deff69c2d4e2e46232827f1e7d81e7ba8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ml_copilot_agent-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.7 Linux/6.8.0-48-generic

File hashes

Hashes for ml_copilot_agent-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 828417f226f2ec637ab3e3d8a2d634ccb32227c71376f4ea2524b3d8ebc1ce64
MD5 ddef0d50d9e2ab154a234054b1062ffa
BLAKE2b-256 6ee6c27580c4eafe339c9c6952ed68a5c09b45a0cd076eac9a849155548097e7

See more details on using hashes here.

Supported by

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