{"id":22845180,"url":"https://github.com/infinitode/scikit-learn-decisiontreeclassifier-updater","last_synced_at":"2025-03-31T05:26:42.789Z","repository":{"id":267776149,"uuid":"902319084","full_name":"Infinitode/Scikit-learn-DecisionTreeClassifier-Updater","owner":"Infinitode","description":"An open-source tool to convert older Scikit-learn DecisionTreeClassifier models to the newer version.","archived":false,"fork":false,"pushed_at":"2024-12-12T10:57:10.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-06T09:47:48.791Z","etag":null,"topics":["ai","classifier","cli","converter","decisiontree","python","scikit-learn","sklearn","tools"],"latest_commit_sha":null,"homepage":"https://infinitode.netlify.app","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Infinitode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-12T10:36:52.000Z","updated_at":"2024-12-12T10:57:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"afd5067b-5172-42c8-8901-c7609bf568ba","html_url":"https://github.com/Infinitode/Scikit-learn-DecisionTreeClassifier-Updater","commit_stats":null,"previous_names":["infinitode/scikit-learn-decisiontreeclassifier-updater"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infinitode%2FScikit-learn-DecisionTreeClassifier-Updater","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infinitode%2FScikit-learn-DecisionTreeClassifier-Updater/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infinitode%2FScikit-learn-DecisionTreeClassifier-Updater/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infinitode%2FScikit-learn-DecisionTreeClassifier-Updater/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Infinitode","download_url":"https://codeload.github.com/Infinitode/Scikit-learn-DecisionTreeClassifier-Updater/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246421054,"owners_count":20774435,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","classifier","cli","converter","decisiontree","python","scikit-learn","sklearn","tools"],"created_at":"2024-12-13T03:15:58.883Z","updated_at":"2025-03-31T05:26:42.784Z","avatar_url":"https://github.com/Infinitode.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Scikit-learn `DecisionTreeClassifier` Updater\n\n![GitHub commit activity](https://img.shields.io/github/commit-activity/m/infinitode/scikit-learn-decisiontreeclassifier-updater)\n![GitHub top language](https://img.shields.io/github/languages/top/infinitode/scikit-learn-decisiontreeclassifier-updater)\n![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/infinitode/scikit-learn-decisiontreeclassifier-updater)\n![GitHub License](https://img.shields.io/github/license/infinitode/scikit-learn-decisiontreeclassifier-updater)\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/infinitode/scikit-learn-decisiontreeclassifier-updater)\n[![GitHub Repo stars](https://img.shields.io/github/stars/infinitode/scikit-learn-decisiontreeclassifier-updater)](https://github.com/infinitode/scikit-learn-decisiontreeclassifier-updater/stargazers)\n\nThis repository contains the necessary code and tools to upgrade `DecisionTreeClassifier` models from `scikit-learn==1.3.x` or lower to the newer versions of `scikit-learn`.\n\n## Features\n\n- Model Converter: Extracts and upgrades components of a Scikit-learn model for compatibility with newer versions than `1.3.x`.\n- Model Upgrader: Reconstructs and updates the model using the modified components.\n- Open-source and easy-to-use CLI commands.\n\n## Installation\n\nClone this repository:\n```bash\ngit clone https://github.com/Infinitode/repo-name.git\ncd repo-name\n```\n\n## Usage\n\n### Python Script Files\n\nYou can modify the Python script files to convert and upgrade your models. These files are located in `new_environment` and `old_environment` respectively.\n\n**1. Set up `old_environment`**\n\n- Start with the `old_environment`.\n- You'll need to install the older versions of both `scikit-learn` and `numpy` in this environment.\n- Make sure to use the same Python version your model was saved in.\n\n\u003e [!NOTE]\n\u003e It needs to be similar to your `original` environment in which you saved your model.\n\n**2. Modify the script under `old_environment` and run**\n\nModify the script file, and run it, it will convert your model and store the files that we need for later.\n\n**3. Set up `new_environment`**\n\n- Create a new environment for `new_environment`.\n- Install the latest/target versions of `scikit-learn` and `numpy`.\n- Use the latest/target Python version.\n\n**4. Modify the script under `new_environment` and run**\n\nModify the script file and run it. It will use the files created in `step 2` to create a new model, that is compatible with your chosen version.\n\n### CLI\n\nYou can use the CLI tools to quickly convert your model files.\n- `model_converter.py` - Initial conversion. Extracts and upgrades components of the model for compatibility with newer versions than `1.3.x`. Works in `original environment` (older `scikit-learn`, etc.).\n- `model_upgrader.py` - Final conversion. Reconstructs and updates the model using the modified components. Works in `new environment` (updated `scikit-learn`, etc.)\n\n#### Model Converter\n```bash\npython model_converter.py \\\n    --model_path path/to/original_model.pkl \\\n    --shell_path path/to/classifier_shell.pkl \\\n    --tree_state_path path/to/tree_state.pkl \\\n    --upgraded_tree_state_path path/to/upgraded/tree_state.pkl \\\n    --model_txt_path path/to/model.txt\n```\n\n**Explanation of arguments:**\n- `--model_path`: Path to your saved model.\n- `--shell_path`: Output path for the classifier shell (e.g. shell.pkl).\n- `--tree_state_path`: Output path for the tree state (e.g. tree_state.pkl).\n- `--upgraded_tree_state_path`: Output path for the upgraded tree state (e.g. upgraded_tree_state.pkl).\n- `--model_txt_path`: Output path for the model's inputs and outputs (e.g. model.txt).\n\n#### Model Upgrader\n```bash\npython model_upgrader.py \\\n    --shell_path path/to/classifier_shell.pkl \\\n    --upgraded_tree_state_path path/to/upgraded/tree_state.pkl \\\n    --model_txt_path path/to/model.txt \\\n    --output_path path/to/updated_classifier.pkl\n```\n\n**Explanation of arguments:**\n- `--shell_path`: Path to the classifier shell (e.g. shell.pkl).\n- `--upgraded_tree_state_path`: Path to the upgraded tree state (e.g. upgraded_tree_state.pkl).\n- `--model_txt_path`: Path to the model's inputs and outputs (e.g. model.txt).\n- `--output_path`: Output path for the final model (e.g. upgraded_model.pkl).\n\n\u003e [!TIP]\n\u003e You can use `--help` in the commandline for usage instructions.\n\u003e\n\u003e ```bash\n\u003e python model_upgrader.py --help\n\u003e ```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request with your changes.\n\n## Acknowledgments\n\nThis project was inspired by the need to adapt Scikit-learn models to newer versions and ensure compatibility in various environments.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfinitode%2Fscikit-learn-decisiontreeclassifier-updater","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfinitode%2Fscikit-learn-decisiontreeclassifier-updater","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfinitode%2Fscikit-learn-decisiontreeclassifier-updater/lists"}