{"id":26194353,"url":"https://github.com/sf-tec/openmodels","last_synced_at":"2025-04-15T03:15:08.712Z","repository":{"id":243853383,"uuid":"811833462","full_name":"SF-Tec/openmodels","owner":"SF-Tec","description":"OpenModels is a flexible and extensible library for serializing and deserializing machine learning models. It's designed to support any serialization format through a plugin-based architecture, providing a safe and transparent solution for exporting and sharing predictive models.","archived":false,"fork":false,"pushed_at":"2025-03-03T10:08:53.000Z","size":258,"stargazers_count":3,"open_issues_count":8,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-14T03:12:11.698Z","etag":null,"topics":["json","python","scikit-learn","serialization","sklearn"],"latest_commit_sha":null,"homepage":"","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/SF-Tec.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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-06-07T11:52:02.000Z","updated_at":"2025-03-03T10:08:58.000Z","dependencies_parsed_at":"2024-06-11T14:56:16.589Z","dependency_job_id":"fa6d7e37-6328-4136-8e53-2296e26f2004","html_url":"https://github.com/SF-Tec/openmodels","commit_stats":null,"previous_names":["sf-tec/openmodels"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SF-Tec%2Fopenmodels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SF-Tec%2Fopenmodels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SF-Tec%2Fopenmodels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SF-Tec%2Fopenmodels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SF-Tec","download_url":"https://codeload.github.com/SF-Tec/openmodels/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248836021,"owners_count":21169333,"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":["json","python","scikit-learn","serialization","sklearn"],"created_at":"2025-03-12T01:56:19.045Z","updated_at":"2025-04-15T03:15:08.697Z","avatar_url":"https://github.com/SF-Tec.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenModels\n\n[![PyPI version](https://badge.fury.io/py/openmodels.svg)](https://badge.fury.io/py/openmodels)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python Versions](https://img.shields.io/pypi/pyversions/openmodels.svg)](https://pypi.org/project/openmodels/)\n\nOpenModels is a flexible and extensible library for serializing and deserializing machine learning models. It's designed to support any serialization format through a plugin-based architecture, providing a safe and transparent solution for exporting and sharing predictive models.\n\n## Key Features\n\n- **Format Agnostic**: Supports any serialization format through a plugin-based system.\n- **Extensible**: Easily add support for new model types and serialization formats.\n- **Safe**: Provides alternatives to potentially unsafe serialization methods like Pickle.\n- **Transparent**: Supports human-readable formats for easy inspection of serialized models.\n\n## Installation\n\n```bash\npip install openmodels\n```\n\n## Quick Start\n\n```python\nfrom openmodels import SerializationManager, SklearnSerializer\nfrom sklearn.decomposition import PCA\nfrom sklearn.datasets import make_classification\n\n# Create and train a scikit-learn model\nX, _ = make_classification(n_samples=1000, n_features=4, n_informative=2, n_redundant=0, random_state=0, shuffle=False)\nmodel = PCA(n_components=2, random_state=0)\nmodel.fit(X)\n\n# Create a SerializationManager\nmanager = SerializationManager(SklearnSerializer())\n\n# Serialize the model (default format is JSON)\nserialized_model = manager.serialize(model)\n\n# Deserialize the model\ndeserialized_model = manager.deserialize(serialized_model)\n\n# Use the deserialized model\ntransformed_data = deserialized_model.transform(X[:5])\nprint(transformed_data)\n```\n\n## Extensibility\n\nOpenModels is designed to be easily extended with new serialization formats and model types.\n\n### Adding a New Format\n\nTo add a new serialization format, create a class that implements the `FormatConverter` protocol and register it with the `FormatRegistry`:\n\n```python\nfrom openmodels.protocols import FormatConverter\nfrom openmodels.format_registry import FormatRegistry\nfrom typing import Dict, Any\n\nclass YAMLConverter(FormatConverter):\n    @staticmethod\n    def serialize_to_format(data: Dict[str, Any]) -\u003e str:\n        import yaml\n        return yaml.dump(data)\n\n    @staticmethod\n    def deserialize_from_format(formatted_data: str) -\u003e Dict[str, Any]:\n        import yaml\n        return yaml.safe_load(formatted_data)\n\nFormatRegistry.register(\"yaml\", YAMLConverter)\n```\n\n### Adding a New Model Serializer\n\nTo add support for a new type of model, create a class that implements the `ModelSerializer` protocol:\n\n```python\nfrom openmodels.protocols import ModelSerializer\nfrom typing import Any, Dict\n\nclass TensorFlowSerializer(ModelSerializer):\n    def serialize(self, model: Any) -\u003e Dict[str, Any]:\n        # Implementation for serializing TensorFlow models\n        ...\n\n    def deserialize(self, data: Dict[str, Any]) -\u003e Any:\n        # Implementation for deserializing TensorFlow models\n        ...\n```\n\n## Supported Models\n\nOpenModels currently supports a wide range of scikit-learn models, including:\n\n- Classification: LogisticRegression, RandomForestClassifier, SVC, etc.\n- Regression: LinearRegression, RandomForestRegressor, SVR, etc.\n- Clustering: KMeans\n- Dimensionality Reduction: PCA\n\nFor a full list of supported models, please refer to the `SUPPORTED_ESTIMATORS` dictionary in `serializers/sklearn_serializer.py`.\n\n## Contributing\n\nWe welcome contributions to OpenModels! Whether you want to add support for new models, implement new serialization formats, or improve the existing codebase, your help is appreciated.\n\nPlease refer to our [Contributing Guidelines](https://github.com/SF-Tec/openmodels/blob/main/CONTRIBUTING.md) for more information on how to get started.\n\n## Running Tests\n\nTo run the tests:\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/your-repo/openmodels.git\n   cd openmodels\n   ```\n\n2. Install the package and its dependencies:\n\n   ```bash\n   pip install -e .\n   ```\n\n3. Run the tests:\n   ```bash\n   pytest\n   ```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](https://github.com/SF-Tec/openmodels/blob/main/LICENSE) file for details.\n\n## Changelog\n\nFor a detailed changelog, please see the [CHANGELOG.md](https://github.com/SF-Tec/openmodels/blob/main/CHANGELOG.md) file.\n\n## Support\n\nIf you encounter any issues or have questions, please [file an issue](https://github.com/SF-Tec/openmodels/issues/new) on our GitHub repository.\n\nWe're always looking to improve OpenModels. If you have any suggestions or feature requests, please let us know!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsf-tec%2Fopenmodels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsf-tec%2Fopenmodels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsf-tec%2Fopenmodels/lists"}