{"id":24793084,"url":"https://github.com/zhenglinlei/zdmp","last_synced_at":"2026-05-03T16:32:45.085Z","repository":{"id":64983328,"uuid":"579966555","full_name":"ZhengLinLei/ZDMP","owner":"ZhengLinLei","description":"Industry 4.0 Optimization with Machine Learning AI","archived":false,"fork":false,"pushed_at":"2023-08-21T09:40:49.000Z","size":30816,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T17:05:09.900Z","etag":null,"topics":["industry-4","knn-classification","machine-learning","pandas","python","scikit-learn"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZhengLinLei.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":"CONTRIBUTING","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":"2022-12-19T11:44:17.000Z","updated_at":"2022-12-19T20:13:40.000Z","dependencies_parsed_at":"2025-01-29T21:56:00.149Z","dependency_job_id":"d5753605-396c-4233-a11e-3e33b1805f9c","html_url":"https://github.com/ZhengLinLei/ZDMP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ZhengLinLei/ZDMP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhengLinLei%2FZDMP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhengLinLei%2FZDMP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhengLinLei%2FZDMP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhengLinLei%2FZDMP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZhengLinLei","download_url":"https://codeload.github.com/ZhengLinLei/ZDMP/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZhengLinLei%2FZDMP/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32577122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["industry-4","knn-classification","machine-learning","pandas","python","scikit-learn"],"created_at":"2025-01-29T21:55:53.519Z","updated_at":"2026-05-03T16:32:45.059Z","avatar_url":"https://github.com/ZhengLinLei.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e #### Required Repositories to complete the system\n\u003e - [ZDMP-Datasets](https://github.com/ZhengLinLei/ZDMP-datasets)\n\u003e - [ZDMP-Client](https://github.com/ZhengLinLei/ZDMP-client) \n\n\u003cbr\u003e\n\u003cbr\u003e\n\u003ch1 align=\"center\"\u003eZDMP System\u003c/h1\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./docs/zdmp.jpeg\" alt=\"Logo\" /\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"./CONTRIBUTING.md\"\u003eContributing\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/ZhengLinLei/ZDMP/issues\"\u003eIssues\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://opensource.org/licenses/Apache-2.0\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\" alt=\"License\" /\u003e\n    \u003c/a\u003e\u0026nbsp;\n    \u003ca\u003e\n        \u003cimg src=\"https://img.shields.io/badge/version-1.0-brightgreen\" alt=\"Version\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n## Table of Contents\n\n- [About the Project](#about-the-project)\n- [Requirements](#requirements)\n    - [Project](#project)\n    - [Components](#components)\n- [Getting Started](#getting-started)\n    - [Prerequisites](#prerequisites)\n    - [Installation](#installation)\n    - [Usage](#usage)\n        - [Analyze the data](#analyze-the-data)\n        - [Run the training and evaluation](#run-the-training-and-evaluation)\n        - [Run the server](#run-the-server)\n        - [Run the client](#run-the-client)\n- [Contributing](#contributing)\n- [License](#license)\n- [Contact](#contact)\n- [Acknowledgements](#acknowledgements)\n\n\n## About The Project\nThe ZDMP project is a European project created by a consortium of 40 entities, whose main objective is to provide a reference digital platform for the achievement of the \"zero defects\" objective, with which it is intended to support quality improvement both both in processes and in products.\nManufacturing high-quality products at low cost is the best way for Europe to maintain leadership in the manufacturing industry and remain competitive in a global marketplace. This industry is in the midst of a digital transformation process, due to the proliferation and increase of new technological solutions, which are incorporated into the production chain to make it more efficient (Smart Factories and industry 4.0).\n\nThis is a project that aims to provide a reference digital platform for the achievement of the \"zero defects\" objective, with which it is intended to support quality improvement both both in processes and in products. All of this content comes from [iti.es](https://www.iti.es/en/) ZDMP [Datathon](https://www.datasciencesociety.net/what-is-the-datathon/) and [Hackaton](https://en.wikipedia.org/wiki/Hackathon).\n\n\n## Requirements\n\u003e #### Required Repositories to complete the system\n\u003e - [ZDMP-Datasets](https://github.com/ZhengLinLei/ZDMP-datasets)\n\u003e - [ZDMP-Client](https://github.com/ZhengLinLei/ZDMP-clien) \n\n### Project\n- [Python 3.10](https://www.python.org/downloads/release/python-3100/)\n- [Docker](https://www.docker.com/)\n- [Docker Compose](https://docs.docker.com/compose/)\n- [Git](https://git-scm.com/)\n\n### Components\n- [ZDMP-Datasets](https://github.com/ZhengLinLei/ZDMP-datasets)\n- [ZDMP-Client](https://github.com/ZhengLinLei/ZDMP-client) \n    - [NodeJS](https://nodejs.org/en/)\n    - [Express](https://expressjs.com/)\n\n\n## Getting Started\nTo train and use the the core of the system you need to follow the next steps.\n### Prerequisites\n```json\n\"dependencies\": [\n    {\n        \"name\": \"pandas\",\n        \"version\": \"1.5.2\"\n    },\n    {\n        \"name\": \"scikit-learn\",\n        \"version\": \"1.2.0\"\n    },\n    {\n        \"name\": \"numpy\",\n        \"version\": \"1.23.5\"\n    },\n    {\n        \"name\": \"matplotlib\",\n        \"version\": \"3.6.2\"\n    },\n    {\n        \"name\": \"Flask\",\n        \"version\": \"2.2.2\"\n    }\n]\n```\n### Installation\n1. Clone the repo\n```sh\ngit clone https://github.com/ZhengLinLei/ZDMP.git\n```\n\n2. Install components\n```sh\ngit clone https://github.com/ZhengLinLei/ZDMP-datasets.git\ngit clone https://github.com/ZhengLinLei/ZDMP-client.git\n```\n\n3. Install requirements\n```sh\npip install -r requirements.txt\n```\n\n4. Get datasets and locate it into the datasets folder\n\n5. Config the .ini\n```json\n{\n    \"dataset\": {\n        \"path\": \"datasets/batch_data.csv\",\n        \"name\": \"batch_data\",\n        \"predict\": \"datasets/predict.json\",\n        \"batch_size\": 32,\n        \"shuffle\": true\n    },\n    \"build\": {\n        \"path\": \"build\",\n        \"data\": \"data.png\",\n        \"model\": \"model.pkl\",\n        \"module\": \"pickle\"\n    },\n    \"server\": {\n        \"host\": \"127.0.0.1\",\n        \"port\": 5000\n    }\n}\n```\n\n### Usage\n#### Analyze the data\nTo analyze the data run the below script, all analysis can be found in the `src/` folder.\n```sh\npython src/data.py\n```\n\nAnd you will get the following output as image.\n\n![Data](./docs/data.png)\n\n\n#### Run the training and evaluation\nTo get the best model run the below script, all models can be found in the `src/models` folder.\n```sh\npython src/train_eval.py\n```\n\nAfter the training and evaluation process, the data will be printed.\n```sh\n               Method  Training MSE     Training R2             Test MSE                Test R2        Time\n 0  Linear regression      0.026466        0.651201    2603143596.200458    -34521933304.644592          4s\n 1      Random forest      0.054894        0.276561             0.053715               0.287655      1m 30s\n 2        KNNeighbors      0.000056        0.999266             0.014994               0.801152      1m  2s\n 3                SVM      0.044920        0.408009             0.043429               0.424063      6m  4s\n```\n\n#### Run the model training\nAfter running the `src/train_eval.py` script, the data sciencetist can choose the best model to train it.\n```sh\n               Method  Training MSE     Training R2             Test MSE                Test R2        Time\n 0  Linear regression      0.026466        0.651201    2603143596.200458    -34521933304.644592          4s ----\u003e Worst model\n 1      Random forest      0.054894        0.276561             0.053715               0.287655      1m 30s\n 2        KNNeighbors      0.000056        0.999266             0.014994               0.801152      1m  2s ----\u003e Best model\n 3                SVM      0.044920        0.408009             0.043429               0.424063      6m  4s\n```\n\nChange the `model` variable in the `src/train.py` file to the best model.\n```python\n# Import KNN model\nfrom models.KNNeighbors import KNNModel\n\n# Create the model\nmodel = KNNModel()\n```\n\nTo train the model run the below script.\n```sh\npython src/train.py\n```\n\nThe model trainned will be saved in the `build` folder.\n\n#### Run the server\nTo run the server run the below script.\n```sh\npython src/\n```\n\nThe server will listen all the request to make predictions. The source of code of prediction can be found in the `src/predict.py` file.\n```python\n# Create the route\n@app.route('/predict', methods=['POST'])\ndef predict_api():\n    # Get the data\n    data = request.get_json(force=True)\n\n    # Make prediction\n    prediction = predict(data, os.path.join(CURRENT_PATH, CONFIG['model']['path']))\n\n    # Return the prediction\n    return jsonify(prediction)\n```\n\n#### Run the client\n\u003e\n\u003e   Read the [ZDMP-Client](https://github.com/ZhengLinLei/ZDMP-client) (Pending to be updated) repository to know how to run the client.\n\u003e   The client will send the request to the python server to make predictions.\n\n![Client](./docs/app/dashboard.png)\n![Client](./docs/app/layer.png)\n![Client](./docs/app/models.png)\n\n\n### Contributing\nContributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\n**How to contribute:**\n1. Fork the Project\n2. Clone your repository (`git clone repo_url`)\n3. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n5. Push to the Branch (`git push origin feature/AmazingFeature`)\n6. Open a Pull Request\n\n\n### License\nDistributed under the Apache 2.0 License. See `LICENSE` for more information.\n\n\n### Contact\n* Zheng Lin Lei - [zheng9112003@icloud.com](mailto:zheng9112003@icloud.com) | [zheng9112003@gmail.com](mailto:zheng9112003@gamil.com)\n* Guillermo Breva de Dios - No contact available\n* Elena Clofent Muñoz - No contact available\n\nProject Link: [https://github.com/ZhengLinLei/ZDMP](https://github.com/ZhengLinLei/ZDMP)\n\n\n### Acknowledgements\n* [ITI](https://www.iti.es/)\n* [ZDMP](https://www.zdmp.eu/)\n* [UPV](https://www.upv.es/)\n\n\n### References\n* [ZDMP](https://www.zdmp.eu/)\n* [ZDMP-Datasets](https://github.com/ZhengLinLei/ZDMP-datasets)\n* [ZDMP-Client](https://github.com/ZhengLinLei/ZDMP-client)\n* Hackaton 2022 - [ZDMP](https://www.zdmp.eu/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhenglinlei%2Fzdmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhenglinlei%2Fzdmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhenglinlei%2Fzdmp/lists"}