cpknextgen 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,59 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '**'
7
+
8
+ jobs:
9
+ package:
10
+ name: Build dist packages
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout source code
14
+ uses: actions/checkout@v4
15
+
16
+ - name: Setup python
17
+ uses: actions/setup-python@v4
18
+ with:
19
+ python-version: "3.11"
20
+
21
+ - name: Install build tools
22
+ run: python -m pip install --upgrade pip build
23
+
24
+ - name: Build package
25
+ run: python -m build
26
+
27
+ - name: Create GitHub release
28
+ env:
29
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30
+ tag: ${{ github.ref_name }}
31
+ run: |
32
+ gh release create "$tag" \
33
+ --repo="$GITHUB_REPOSITORY" \
34
+ --title="${tag#v}"
35
+
36
+ - name: Store the distribution packages
37
+ uses: actions/upload-artifact@v3
38
+ with:
39
+ name: dist-packages
40
+ path: dist/
41
+
42
+ pypi-publish:
43
+ name: Upload packages to PyPI
44
+ needs: package
45
+ runs-on: ubuntu-latest
46
+ environment:
47
+ name: release
48
+ url: https://pypi.org/p/cpknextgen
49
+ permissions:
50
+ id-token: write
51
+ steps:
52
+ - name: Download all the dists packages
53
+ uses: actions/download-artifact@v3
54
+ with:
55
+ name: dist-packages
56
+ path: dist/
57
+
58
+ - name: Publish package distributions to PyPI
59
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,36 @@
1
+ name: Test
2
+ on:
3
+ push:
4
+ pull_request:
5
+
6
+ concurrency:
7
+ group: test-${{ github.ref }}
8
+ cancel-in-progress: true
9
+
10
+ jobs:
11
+ test:
12
+ name: Test with ${{ matrix.py }}
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ py:
18
+ - "3.11"
19
+ - "3.10"
20
+ - "3.9"
21
+ steps:
22
+ - name: Checkout source code
23
+ uses: actions/checkout@v3
24
+ with:
25
+ fetch-depth: 0
26
+
27
+ - name: Setup python for test ${{ matrix.py }}
28
+ uses: actions/setup-python@v4
29
+ with:
30
+ python-version: ${{ matrix.py }}
31
+
32
+ - name: Install tox
33
+ run: python -m pip install tox-gh>=4
34
+
35
+ - name: Run test suite
36
+ run: tox run
@@ -0,0 +1,11 @@
1
+ # ignore idea files
2
+ **/.idea
3
+ **/*.iml
4
+
5
+ # ignore local python env
6
+ env/
7
+ venv/
8
+
9
+ dist/
10
+
11
+ .tox
@@ -0,0 +1,48 @@
1
+ # Contributing guidelines
2
+
3
+ This project use [`tox`](https://pypi.org/project/tox/) to simplify virtual environment management and testing.
4
+
5
+ ## Dependencies
6
+ Dependencies are defined in `pyproject.toml` using version ranges.
7
+ We want to define broad version ranges so the users of this library won't run into dependency conflict.
8
+
9
+ ### Pinned dependencies
10
+ Pinned versions of dependencies are defined in `requirements.txt` and `requirements-test.txt`.
11
+ These are used for local development and testing on CI.
12
+ These files are automatically generated using `pip-compile` TOX environment.
13
+
14
+ To re-generate requirements files run:
15
+ ```
16
+ tox run -e pip-compile
17
+ ```
18
+
19
+ ## Running tests
20
+ You can run tests for all supported Python versions using:
21
+ ```
22
+ tox run
23
+ ```
24
+
25
+ Or for specific Python version:
26
+ ```
27
+ tox run -e py311
28
+ ```
29
+
30
+ Or manually invoke pytest:
31
+ ```
32
+ pytest tests
33
+ ```
34
+
35
+ ## Build
36
+ Build tools are defined in `pyproject.toml`.
37
+ Backend tool is [`hatchling`](https://hatch.pypa.io/latest/) - responsible for building distribution package.
38
+ CLI tool is [`build`](https://pypa-build.readthedocs.io/en/stable/index.html).
39
+ The package name specified in .toml config must match the directory name src/[package_name]
40
+ if `package_name` contains `__init__.py`.
41
+
42
+ You can run the build manually:
43
+ 1. Install build: `python -m pip install build`
44
+ 2. Run `python -m build` from the project root - this will create wheel in the `/dist` folder.
45
+
46
+ Or using tox:
47
+ 1. Run `tox run`
48
+ 2. Wheel is created in `.tox/.pkg/dist` folder.
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2023 Diribet Thesaurus s.r.o.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
18
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
19
+ OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,75 @@
1
+ Metadata-Version: 2.1
2
+ Name: cpknextgen
3
+ Version: 1.0.0
4
+ Summary: Cpk NextGen
5
+ Project-URL: Homepage, https://github.com/diribet/cpknextgen
6
+ Project-URL: Issues, https://github.com/diribet/cpknextgen/issues
7
+ Author-email: Stanislav Král <stanislav.kral@diribet.cz>, Jaroslav Staněk <jaroslav.stanek@diribet.cz>, Helena Paulasová <helena.paulasova@diribet.cz>, Vlastimil Dolejš <vlastimil.dolejs@diribet.cz>
8
+ License: MIT License
9
+ License-File: LICENSE
10
+ Keywords: Cp,Cpk,Process capability
11
+ Classifier: Intended Audience :: Manufacturing
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Requires-Python: >=3.9
16
+ Requires-Dist: numba>=0.55.0
17
+ Requires-Dist: numpy<1.27,>=1.21
18
+ Requires-Dist: scikit-learn>=1.0
19
+ Requires-Dist: scipy<1.15,>=1.10
20
+ Provides-Extra: test
21
+ Requires-Dist: pytest-sugar>=0.9; extra == 'test'
22
+ Requires-Dist: pytest>=7; extra == 'test'
23
+ Description-Content-Type: text/markdown
24
+
25
+ # C<sub>pk</sub> NextGen
26
+ [![Build](https://github.com/diribet/cpknextgen/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/diribet/cpknextgen/actions/workflows/test.yml)
27
+ [![PyPI - Version](https://img.shields.io/pypi/v/cpknextgen)](https://pypi.org/project/cpknextgen/)
28
+
29
+ ## Process Capability using Normal distribution mixture
30
+ This procedure allows you to compute the $c_p$ and $c_{pk}$ process capability indices, utilizing an innovative method for estimating the center and quantiles of the process, including their uncertainty. The advantage of this approach is its consistency in comparing processes and their changes over time, without relying heavily on anecdotal evidence or having to categorize the “process type”.
31
+
32
+ ## Usage
33
+ Install the library
34
+ ```shell
35
+ python -m pip install cpknextgen
36
+ ```
37
+
38
+ Import the `evaluate` function which is the main entry point
39
+
40
+ ```python
41
+ from cpknextgen import evaluate
42
+ ```
43
+ The function takes in 1-dimensional list/numpy array of process data, the tolerances (as mentioned above) and some other parameters for the Gaussian Mixture. Refer to the docstring for further details. It calculates point and interval estimates of the indices, and graphical results - empirical CDF and sample estimate of CDF.
44
+
45
+ ## Methodology
46
+ The method leverages past performance data and experience. The process of calculation, as outlined in the figure below, can either include or exclude the prior, where the prior is a dataset from past performance used as Bayesian-type information.
47
+
48
+ ![method_illustration](https://github.com/diribet/cpknextgen/assets/1448805/28878d30-307a-40b5-8b04-388eb6f05d96)
49
+
50
+ The algorithm is designed for continuous process observation, meaning it estimates the resulting indices' value with uncertainty at each point of the process. It can predict what the resulting indices' values will be when the process is complete for a given production period (e.g., a shift, a day, a week, etc.).
51
+
52
+ ### Calculation Without Prior
53
+ Calculation without the prior is equivalent to estimating the indices on the prior, and the resulting information can be used to calculate the indices on another dataset with this prior. It is especially recommended for “closed” production periods, such as calculating the process capability for a recently concluded shift.
54
+
55
+ The data is often accompanied by varying amounts of contextual information, most notably the tolerance limits and the extreme limits. These extreme limits are dictated by physical restrictions or plausibility limits and are not mandatory. Any data outside these limits are treated as outliers and ignored.
56
+ To calculate $c_{pk}$, at least one tolerance limit is necessary. Both tolerance limits are needed for a proper calculation of c_p. If not provided, the algorithm only estimates the quantiles, giving the process center and width, without a tolerance interval for comparison.
57
+
58
+ Before distribution estimation, data transformation based on shape takes place. This involves the following steps:
59
+ 1. Logarithmic or logit transformations based on extreme limits, when they exist.
60
+ 2. Applying a Yeo-Johnson transformation.
61
+ 3. Scaling the tolerance interval to a +/-1 interval. In cases where one or both tolerances are missing, they are estimated as "tolerance quantiles" from the data.
62
+
63
+ ### Calculation With Prior (NOT IMPLEMENTED!)
64
+ The data transformation method is derived from the prior. The extent to which the prior is used in distribution estimation varies, depending on the amount of information available at the time of estimation. With limited information, e.g., after the first hour of an 8-hour shift, there is a higher reliance on the past shape of the process from the prior. As the shift progresses, indices will be estimated purely from the information from the ongoing production period.
65
+
66
+ This balance is controlled by the "Basic sample size" and the "Process Length" parameters. Regardless of the size of the prior, the algorithm ensures the amount of information derived from it corresponds to these two parameters. Hence, it is advisable to use a "sufficiently large" prior dataset that includes all reasonable process variants.
67
+
68
+ ### Special Cases
69
+ There are two types of special cases that limit the calculation. In the first scenario, no calculation proceeds if there's only one data point or if all data points in the set have the same value. In the second scenario, the calculation proceeds, but it does not produce a prior that can be used for another dataset, e.g., when the lower limit/tolerance isn't given, and all data are above the upper tolerance.
70
+ These special cases are currently under review, and we look forward to sharing updated methodologies to handle them in the future.
71
+
72
+ ### Conclusion
73
+ ![prior_illustration](https://github.com/diribet/cpknextgen/assets/1448805/c56a1653-d0bf-42ce-8970-bb714be48e98)
74
+
75
+ This novel method for computing process capability indices offers a more consistent and data-driven approach. Feedback and contributions are encouraged as we continue to refine and extend this methodology. Please refer to the figure above for a graphical representation of the process.
@@ -0,0 +1,51 @@
1
+ # C<sub>pk</sub> NextGen
2
+ [![Build](https://github.com/diribet/cpknextgen/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/diribet/cpknextgen/actions/workflows/test.yml)
3
+ [![PyPI - Version](https://img.shields.io/pypi/v/cpknextgen)](https://pypi.org/project/cpknextgen/)
4
+
5
+ ## Process Capability using Normal distribution mixture
6
+ This procedure allows you to compute the $c_p$ and $c_{pk}$ process capability indices, utilizing an innovative method for estimating the center and quantiles of the process, including their uncertainty. The advantage of this approach is its consistency in comparing processes and their changes over time, without relying heavily on anecdotal evidence or having to categorize the “process type”.
7
+
8
+ ## Usage
9
+ Install the library
10
+ ```shell
11
+ python -m pip install cpknextgen
12
+ ```
13
+
14
+ Import the `evaluate` function which is the main entry point
15
+
16
+ ```python
17
+ from cpknextgen import evaluate
18
+ ```
19
+ The function takes in 1-dimensional list/numpy array of process data, the tolerances (as mentioned above) and some other parameters for the Gaussian Mixture. Refer to the docstring for further details. It calculates point and interval estimates of the indices, and graphical results - empirical CDF and sample estimate of CDF.
20
+
21
+ ## Methodology
22
+ The method leverages past performance data and experience. The process of calculation, as outlined in the figure below, can either include or exclude the prior, where the prior is a dataset from past performance used as Bayesian-type information.
23
+
24
+ ![method_illustration](https://github.com/diribet/cpknextgen/assets/1448805/28878d30-307a-40b5-8b04-388eb6f05d96)
25
+
26
+ The algorithm is designed for continuous process observation, meaning it estimates the resulting indices' value with uncertainty at each point of the process. It can predict what the resulting indices' values will be when the process is complete for a given production period (e.g., a shift, a day, a week, etc.).
27
+
28
+ ### Calculation Without Prior
29
+ Calculation without the prior is equivalent to estimating the indices on the prior, and the resulting information can be used to calculate the indices on another dataset with this prior. It is especially recommended for “closed” production periods, such as calculating the process capability for a recently concluded shift.
30
+
31
+ The data is often accompanied by varying amounts of contextual information, most notably the tolerance limits and the extreme limits. These extreme limits are dictated by physical restrictions or plausibility limits and are not mandatory. Any data outside these limits are treated as outliers and ignored.
32
+ To calculate $c_{pk}$, at least one tolerance limit is necessary. Both tolerance limits are needed for a proper calculation of c_p. If not provided, the algorithm only estimates the quantiles, giving the process center and width, without a tolerance interval for comparison.
33
+
34
+ Before distribution estimation, data transformation based on shape takes place. This involves the following steps:
35
+ 1. Logarithmic or logit transformations based on extreme limits, when they exist.
36
+ 2. Applying a Yeo-Johnson transformation.
37
+ 3. Scaling the tolerance interval to a +/-1 interval. In cases where one or both tolerances are missing, they are estimated as "tolerance quantiles" from the data.
38
+
39
+ ### Calculation With Prior (NOT IMPLEMENTED!)
40
+ The data transformation method is derived from the prior. The extent to which the prior is used in distribution estimation varies, depending on the amount of information available at the time of estimation. With limited information, e.g., after the first hour of an 8-hour shift, there is a higher reliance on the past shape of the process from the prior. As the shift progresses, indices will be estimated purely from the information from the ongoing production period.
41
+
42
+ This balance is controlled by the "Basic sample size" and the "Process Length" parameters. Regardless of the size of the prior, the algorithm ensures the amount of information derived from it corresponds to these two parameters. Hence, it is advisable to use a "sufficiently large" prior dataset that includes all reasonable process variants.
43
+
44
+ ### Special Cases
45
+ There are two types of special cases that limit the calculation. In the first scenario, no calculation proceeds if there's only one data point or if all data points in the set have the same value. In the second scenario, the calculation proceeds, but it does not produce a prior that can be used for another dataset, e.g., when the lower limit/tolerance isn't given, and all data are above the upper tolerance.
46
+ These special cases are currently under review, and we look forward to sharing updated methodologies to handle them in the future.
47
+
48
+ ### Conclusion
49
+ ![prior_illustration](https://github.com/diribet/cpknextgen/assets/1448805/c56a1653-d0bf-42ce-8970-bb714be48e98)
50
+
51
+ This novel method for computing process capability indices offers a more consistent and data-driven approach. Feedback and contributions are encouraged as we continue to refine and extend this methodology. Please refer to the figure above for a graphical representation of the process.
@@ -0,0 +1,45 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "cpknextgen"
7
+ version = "1.0.0"
8
+ authors = [
9
+ { name = "Stanislav Král", email = "stanislav.kral@diribet.cz" },
10
+ { name = "Jaroslav Staněk", email = "jaroslav.stanek@diribet.cz" },
11
+ { name = "Helena Paulasová", email = "helena.paulasova@diribet.cz" },
12
+ { name = "Vlastimil Dolejš", email = "vlastimil.dolejs@diribet.cz" },
13
+ ]
14
+ description = "Cpk NextGen"
15
+ license = { text = "MIT License" }
16
+ keywords = ["Cp", "Cpk", "Process capability"]
17
+ readme = "README.md"
18
+ classifiers = [
19
+ "Programming Language :: Python :: 3",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: OS Independent",
22
+ "Intended Audience :: Manufacturing",
23
+ ]
24
+ requires-python = ">=3.9"
25
+ dependencies = [
26
+ 'numpy>=1.21,<1.27',
27
+ 'scipy>=1.10,<1.15',
28
+ 'numba>=0.55.0',
29
+ 'scikit-learn>=1.0'
30
+ ]
31
+
32
+ [project.urls]
33
+ Homepage = "https://github.com/diribet/cpknextgen"
34
+ Issues = "https://github.com/diribet/cpknextgen/issues"
35
+
36
+ [project.optional-dependencies]
37
+ test = [
38
+ "pytest>=7",
39
+ "pytest-sugar>=0.9"
40
+ ]
41
+
42
+ [tool.pytest.ini_options]
43
+ pythonpath = [
44
+ "src"
45
+ ]
@@ -0,0 +1,44 @@
1
+ #
2
+ # This file is autogenerated by pip-compile with Python 3.11
3
+ # by the following command:
4
+ #
5
+ # pip-compile --extra=test --output-file=requirements-test.txt pyproject.toml
6
+ #
7
+ colorama==0.4.6
8
+ # via pytest
9
+ iniconfig==2.0.0
10
+ # via pytest
11
+ joblib==1.3.1
12
+ # via scikit-learn
13
+ llvmlite==0.40.1
14
+ # via numba
15
+ numba==0.57.1
16
+ # via cpknextgen (pyproject.toml)
17
+ numpy==1.24.4
18
+ # via
19
+ # cpknextgen (pyproject.toml)
20
+ # numba
21
+ # scikit-learn
22
+ # scipy
23
+ packaging==23.1
24
+ # via
25
+ # pytest
26
+ # pytest-sugar
27
+ pluggy==1.2.0
28
+ # via pytest
29
+ pytest==7.4.0
30
+ # via
31
+ # cpknextgen (pyproject.toml)
32
+ # pytest-sugar
33
+ pytest-sugar==0.9.7
34
+ # via cpknextgen (pyproject.toml)
35
+ scikit-learn==1.3.0
36
+ # via cpknextgen (pyproject.toml)
37
+ scipy==1.11.1
38
+ # via
39
+ # cpknextgen (pyproject.toml)
40
+ # scikit-learn
41
+ termcolor==2.3.0
42
+ # via pytest-sugar
43
+ threadpoolctl==3.2.0
44
+ # via scikit-learn
@@ -0,0 +1,26 @@
1
+ #
2
+ # This file is autogenerated by pip-compile with Python 3.11
3
+ # by the following command:
4
+ #
5
+ # pip-compile --output-file=requirements.txt pyproject.toml
6
+ #
7
+ joblib==1.3.1
8
+ # via scikit-learn
9
+ llvmlite==0.40.1
10
+ # via numba
11
+ numba==0.57.1
12
+ # via cpknextgen (pyproject.toml)
13
+ numpy==1.24.4
14
+ # via
15
+ # cpknextgen (pyproject.toml)
16
+ # numba
17
+ # scikit-learn
18
+ # scipy
19
+ scikit-learn==1.3.0
20
+ # via cpknextgen (pyproject.toml)
21
+ scipy==1.11.1
22
+ # via
23
+ # cpknextgen (pyproject.toml)
24
+ # scikit-learn
25
+ threadpoolctl==3.2.0
26
+ # via scikit-learn
@@ -0,0 +1 @@
1
+ from .__main__ import evaluate, EvaluationResult