ml-copilot-agent


Nameml-copilot-agent JSON
Version 0.1.9 PyPI version JSON
download
home_pageNone
Summary"It is a Machine Learning Copilot Agent that can execute code for end-to-end ML Cycle"
upload_time2024-11-03 22:33:54
maintainerNone
docs_urlNone
authorVatsalPatel18
requires_python<4.0,>=3.9
licenseCC-BY-NC-ND-4.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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](https://ml-copilot-agent.readthedocs.io/en/latest/)

### How to use ? : watch short video (Recommended)
<!-- ![ML-Copilot-Agent Usage]("assets/ml_copilot_use2_720.gif") -->
[![How to use ?: Watch short video](https://img.youtube.com/vi/rci7WLu7Lw8/0.jpg)](https://youtu.be/rci7WLu7Lw8)
<!-- [![Watch the video](https://img.youtube.com/vi/rci7WLu7Lw8)](https://youtube.com/embed/rci7WLu7Lw8) -->

## 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.
<!-- - **Documentation**: Automatically generate a documentation report summarizing the entire workflow. -->
- **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

```bash
pip install ml-copilot-agent
```

### Manual Installation

1. **Clone the repository**:
```bash
git clone https://github.com/VatsalPatel18/ml-copilot-agent.git
```

2. **Navigate to the project directory**:
```bash
cd ml-copilot
```

3. **Install the required dependencies**:
```bash
pip install -r requirements.txt
```
Ensure you have Python 3.7 or higher installed on your system.


## Usage

### Download the file for test run 
```bash
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](https://platform.openai.com/account/api-keys)
- 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. 

2. **Run ML-Copilot**:
```bash
python -m ml_copilot_agent paste-your-openai-api-key
```

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

3. **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:
```bash
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.



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ml-copilot-agent",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "VatsalPatel18",
    "author_email": "vatsal1804@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c3/d1/a8696454702ef73d3d792c80987deff69c2d4e2e46232827f1e7d81e7ba8/ml_copilot_agent-0.1.9.tar.gz",
    "platform": null,
    "description": "# ML-Copilot-Agent\n\nML-Copilot is an interactive machine learning assistant that streamlines the process of data preprocessing, model training, evaluation, plotting results, and generating documentation\u2014all through a command-line interface powered by OpenAI's GPT 4o.\n\nThe 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. \n\n[Full Documentation available on Read the Docs](https://ml-copilot-agent.readthedocs.io/en/latest/)\n\n### How to use ? : watch short video (Recommended)\n<!-- ![ML-Copilot-Agent Usage](\"assets/ml_copilot_use2_720.gif\") -->\n[![How to use ?: Watch short video](https://img.youtube.com/vi/rci7WLu7Lw8/0.jpg)](https://youtu.be/rci7WLu7Lw8)\n<!-- [![Watch the video](https://img.youtube.com/vi/rci7WLu7Lw8)](https://youtube.com/embed/rci7WLu7Lw8) -->\n\n## LLM-Agent-Features\n\n- **List Files**: View files in the current directory.\n- **Data Preprocessing**: Preprocess data for binary classification tasks with customizable instructions.\n- **Model Training**: Train binary classification models using algorithms like Logistic Regression, SVM, or Random Forest.\n- **Model Evaluation**: Evaluate trained models and obtain metrics such as accuracy, precision, recall, F1-score, and AUC.\n- **Plotting**: Generate various plots (e.g., bar plots, PCA plots, correlation matrices) from data or evaluation results.\n<!-- - **Documentation**: Automatically generate a documentation report summarizing the entire workflow. -->\n- **Interactive Workflow**: Seamlessly navigate through different steps with an intuitive command-line interface.\n- **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  \n\nPlease make a conda environment before begin\n\n## Direct Installation\n\n```bash\npip install ml-copilot-agent\n```\n\n### Manual Installation\n\n1. **Clone the repository**:\n```bash\ngit clone https://github.com/VatsalPatel18/ml-copilot-agent.git\n```\n\n2. **Navigate to the project directory**:\n```bash\ncd ml-copilot\n```\n\n3. **Install the required dependencies**:\n```bash\npip install -r requirements.txt\n```\nEnsure you have Python 3.7 or higher installed on your system.\n\n\n## Usage\n\n### Download the file for test run \n```bash\nwget https://raw.githubusercontent.com/VatsalPatel18/ml-copilot-agent/master/temp_csv1.data\n```\n\n1. **Get Your OpenAI API Key:**:\n\nTo use the OpenAI API, you need to obtain your API key. If you haven't done so yet, follow these steps:\n- Go to the [OpenAI API keys page](https://platform.openai.com/account/api-keys)\n- Log in to your OpenAI account (or sign up if you don't have one).\n- Create a new API key and copy it\n\nRemember to delete the key after use. \n\n2. **Run ML-Copilot**:\n```bash\npython -m ml_copilot_agent paste-your-openai-api-key\n```\n\nReplace `paste-your-openai-api-key` with your actual OpenAI API key.\n\n3. **Interact with ML-Copilot**:\n\nOnce started, ML-Copilot will prompt you for commands. You can enter any of the following commands:\n\n- `show files`: Show files in the current directory.\n- `preprocess`: Preprocess data for a binary classification task.\n- `train`: Train a binary classification model.\n- `evaluate`: Evaluate the trained model.\n- `plot`: Generate plots from data or evaluation results.\n- `document`: Generate a documentation report. (Under Development)\n- `exit`: Terminate the workflow.\n\n### Example Workflow\n\n**Step 1: List Files**\n\n```\nlist files\n```\n\nView all files in the current directory to ensure your dataset is available.\n\n**Step 2: Preprocess Data**\n```\npreprocess\n```\n\n- **Dataset Path**: Provide the path to your dataset (e.g., `data/dataset.csv`).\n- **Target Column Name**: Specify the name of the target column in your dataset.\n- **Save Path**: Choose where to save the preprocessed data (default is `data/preprocessed_data.csv`).\n- **Additional Instructions**: (Optional) Add any specific preprocessing instructions (e.g., \"use standard scaler\").\n\n**Step 3: Train Model**\n```\ntrain\n```\n\n- **Model Save Path**: Specify where to save the trained model (default is `models/model.pkl`).\n- **Additional Instructions**: (Optional) Specify model preferences (e.g., \"use SVM classifier\").\n\n**Step 4: Evaluate Model**\n```\nevaluate\n```\n\n- **Evaluation Save Path**: Specify where to save the evaluation results (default is `results/evaluation.txt`).\n\n**Step 5: Plot Results**\n\n```\nplot\n```\n\n- **Data File Path**: Provide the data file path or press Enter to use default evaluation results or preprocessed data.\n- **Additional Plotting Instructions**: (Optional) Specify the type of plot (e.g., \"make a bar plot of accuracy and precision\").\n\n**Step 7: Custom Instructions**\n\n```\ncustom instruction\n```\n\n- Provide any kind of custom instruction that you would like to execute code.\n\n**Step 8: Exit**\n\n```\nexit\n```\n\nTerminate the workflow when you are done.\n\n## Dependencies\n\n- **Python 3.7 or higher**\n- **OpenAI GPT Models**\n- **LlamaIndex**\n- **Pandas**\n- **Scikit-learn**\n- **Matplotlib**\n- **Seaborn**\n\nInstall all dependencies using:\n```bash\npip install -r requirements.txt\n```\n## Project Structure\n\n- `ml_copilot/`\n- `__init__.py`: Initialization and configuration.\n- `__main__.py`: Entry point of the application.\n- `workflow.py`: Defines the MLWorkflow class and all associated steps and events.\n- `data/`: Directory where preprocessed data is saved.\n- `models/`: Directory where trained models are saved.\n- `results/`: Directory where evaluation results and plots are saved.\n- `reports/`: Directory where documentation reports are saved.\n- `requirements.txt`: Contains all Python dependencies.\n\n## Contributing\n\nContributions are welcome! Please follow these steps:\n\n1. **Fork the repository**.\n2. **Create a new branch** for your feature or bug fix.\n3. **Commit your changes** with clear and descriptive messages.\n4. **Push to your fork** and submit a pull request.\n\n## License\n\nThis project is licensed under the CC-BY-NC-ND-4.0 License.\n\n## Acknowledgments\n\n- Thanks to the developers of OpenAI and LlamaIndex for providing the foundational tools that make this project possible.\n\n## Contact\n\nFor any questions or suggestions, feel free to open an issue or contact vatsal1804@gmail.com.\n\n\n",
    "bugtrack_url": null,
    "license": "CC-BY-NC-ND-4.0",
    "summary": "\"It is a Machine Learning Copilot Agent that can execute code for end-to-end ML Cycle\"",
    "version": "0.1.9",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6ee6c27580c4eafe339c9c6952ed68a5c09b45a0cd076eac9a849155548097e7",
                "md5": "ddef0d50d9e2ab154a234054b1062ffa",
                "sha256": "828417f226f2ec637ab3e3d8a2d634ccb32227c71376f4ea2524b3d8ebc1ce64"
            },
            "downloads": -1,
            "filename": "ml_copilot_agent-0.1.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ddef0d50d9e2ab154a234054b1062ffa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 14192,
            "upload_time": "2024-11-03T22:33:51",
            "upload_time_iso_8601": "2024-11-03T22:33:51.853713Z",
            "url": "https://files.pythonhosted.org/packages/6e/e6/c27580c4eafe339c9c6952ed68a5c09b45a0cd076eac9a849155548097e7/ml_copilot_agent-0.1.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c3d1a8696454702ef73d3d792c80987deff69c2d4e2e46232827f1e7d81e7ba8",
                "md5": "014ee8ef2dc8fee92c0d5dae78c4ae38",
                "sha256": "2f33342f8c1de1d9870c33a72ea331cf1f0a253c13f76d4a7607f49deab9eeae"
            },
            "downloads": -1,
            "filename": "ml_copilot_agent-0.1.9.tar.gz",
            "has_sig": false,
            "md5_digest": "014ee8ef2dc8fee92c0d5dae78c4ae38",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 14909,
            "upload_time": "2024-11-03T22:33:54",
            "upload_time_iso_8601": "2024-11-03T22:33:54.348626Z",
            "url": "https://files.pythonhosted.org/packages/c3/d1/a8696454702ef73d3d792c80987deff69c2d4e2e46232827f1e7d81e7ba8/ml_copilot_agent-0.1.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-03 22:33:54",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ml-copilot-agent"
}
        
Elapsed time: 1.50469s