chowclassifier 1.1.3__tar.gz → 2.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.
Files changed (28) hide show
  1. {chowclassifier-1.1.3 → chowclassifier-2.0.0}/LICENSE +117 -117
  2. chowclassifier-2.0.0/PKG-INFO +205 -0
  3. chowclassifier-2.0.0/README.md +163 -0
  4. chowclassifier-2.0.0/chowclassifier/__init__.py +15 -0
  5. {chowclassifier-1.1.3 → chowclassifier-2.0.0}/chowclassifier/__main__.py +102 -81
  6. chowclassifier-2.0.0/chowclassifier/bayes.py +366 -0
  7. {chowclassifier-1.1.3 → chowclassifier-2.0.0}/chowclassifier/chewdata.py +466 -418
  8. {chowclassifier-1.1.3 → chowclassifier-2.0.0}/chowclassifier/chow.py +609 -596
  9. {chowclassifier-1.1.3 → chowclassifier-2.0.0}/chowclassifier/utilities.py +112 -122
  10. chowclassifier-2.0.0/chowclassifier.egg-info/PKG-INFO +205 -0
  11. {chowclassifier-1.1.3 → chowclassifier-2.0.0}/chowclassifier.egg-info/SOURCES.txt +3 -0
  12. {chowclassifier-1.1.3 → chowclassifier-2.0.0}/chowclassifier.egg-info/requires.txt +15 -0
  13. {chowclassifier-1.1.3 → chowclassifier-2.0.0}/pyproject.toml +55 -49
  14. {chowclassifier-1.1.3 → chowclassifier-2.0.0}/setup.cfg +4 -4
  15. {chowclassifier-1.1.3 → chowclassifier-2.0.0}/setup.py +5 -5
  16. chowclassifier-2.0.0/tests/test_bayes.py +46 -0
  17. {chowclassifier-1.1.3 → chowclassifier-2.0.0}/tests/test_chow.py +65 -65
  18. chowclassifier-2.0.0/tests/test_examples.py +21 -0
  19. chowclassifier-2.0.0/tests/test_regressions.py +127 -0
  20. {chowclassifier-1.1.3 → chowclassifier-2.0.0}/tests/test_with_synt_data.py +163 -163
  21. chowclassifier-1.1.3/PKG-INFO +0 -183
  22. chowclassifier-1.1.3/README.md +0 -155
  23. chowclassifier-1.1.3/chowclassifier/__init__.py +0 -8
  24. chowclassifier-1.1.3/chowclassifier.egg-info/PKG-INFO +0 -183
  25. chowclassifier-1.1.3/tests/test_examples.py +0 -5
  26. {chowclassifier-1.1.3 → chowclassifier-2.0.0}/chowclassifier.egg-info/dependency_links.txt +0 -0
  27. {chowclassifier-1.1.3 → chowclassifier-2.0.0}/chowclassifier.egg-info/entry_points.txt +0 -0
  28. {chowclassifier-1.1.3 → chowclassifier-2.0.0}/chowclassifier.egg-info/top_level.txt +0 -0
@@ -1,117 +1,117 @@
1
- Creative Commons Attribution-NonCommercial 4.0 International Public License
2
-
3
- By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
4
-
5
- Section 1 – Definitions.
6
-
7
- a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
8
-
9
- b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
10
-
11
- c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
12
-
13
- d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
14
-
15
- e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
16
-
17
- f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
18
-
19
- g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
20
-
21
- h. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
22
-
23
- i. NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
24
-
25
- j. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
26
-
27
- k. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
28
-
29
- l. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
30
-
31
- Section 2 – Scope.
32
-
33
- a. License grant.
34
- 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
35
- A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
36
- B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
37
- 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
38
- 3. Term. The term of this Public License is specified in Section 6(a).
39
- 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
40
- 5. Downstream recipients.
41
- A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
42
- B. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
43
- 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
44
-
45
- b. Other rights.
46
- 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
47
- 2. Patent and trademark rights are not licensed under this Public License.
48
- 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
49
-
50
- Section 3 – License Conditions.
51
-
52
- Your exercise of the Licensed Rights is expressly made subject to the following conditions.
53
-
54
- a. Attribution.
55
- 1. If You Share the Licensed Material (including in modified form), You must:
56
- A. retain the following if it is supplied by the Licensor with the Licensed Material:
57
- i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
58
- ii. a copyright notice;
59
- iii. a notice that refers to this Public License;
60
- iv. a notice that refers to the disclaimer of warranties;
61
- v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
62
- B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
63
- C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
64
- 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
65
- 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
66
- 4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
67
-
68
- Section 4 – Sui Generis Database Rights.
69
-
70
- Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
71
-
72
- a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
73
- b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
74
- c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
75
-
76
- For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
77
-
78
- Section 5 – Disclaimer of Warranties and Limitation of Liability.
79
-
80
- a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
81
-
82
- b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
83
-
84
- c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
85
-
86
- Section 6 – Term and Termination.
87
-
88
- a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
89
-
90
- b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
91
- 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
92
- 2. upon express reinstatement by the Licensor.
93
- For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
94
-
95
- c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
96
-
97
- d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
98
-
99
- Section 7 – Other Terms and Conditions.
100
-
101
- a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
102
-
103
- b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
104
-
105
- Section 8 – Interpretation.
106
-
107
- a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
108
-
109
- b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
110
-
111
- c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
112
-
113
- d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
114
-
115
- Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the "Licensor." The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark "Creative Commons" or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
116
-
117
- Creative Commons may be contacted at creativecommons.org.
1
+ Creative Commons Attribution-NonCommercial 4.0 International Public License
2
+
3
+ By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
4
+
5
+ Section 1 – Definitions.
6
+
7
+ a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
8
+
9
+ b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
10
+
11
+ c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
12
+
13
+ d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
14
+
15
+ e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
16
+
17
+ f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
18
+
19
+ g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
20
+
21
+ h. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
22
+
23
+ i. NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
24
+
25
+ j. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
26
+
27
+ k. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
28
+
29
+ l. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
30
+
31
+ Section 2 – Scope.
32
+
33
+ a. License grant.
34
+ 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
35
+ A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
36
+ B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
37
+ 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
38
+ 3. Term. The term of this Public License is specified in Section 6(a).
39
+ 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
40
+ 5. Downstream recipients.
41
+ A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
42
+ B. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
43
+ 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
44
+
45
+ b. Other rights.
46
+ 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
47
+ 2. Patent and trademark rights are not licensed under this Public License.
48
+ 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
49
+
50
+ Section 3 – License Conditions.
51
+
52
+ Your exercise of the Licensed Rights is expressly made subject to the following conditions.
53
+
54
+ a. Attribution.
55
+ 1. If You Share the Licensed Material (including in modified form), You must:
56
+ A. retain the following if it is supplied by the Licensor with the Licensed Material:
57
+ i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
58
+ ii. a copyright notice;
59
+ iii. a notice that refers to this Public License;
60
+ iv. a notice that refers to the disclaimer of warranties;
61
+ v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
62
+ B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
63
+ C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
64
+ 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
65
+ 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
66
+ 4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
67
+
68
+ Section 4 – Sui Generis Database Rights.
69
+
70
+ Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
71
+
72
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
73
+ b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
74
+ c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
75
+
76
+ For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
77
+
78
+ Section 5 – Disclaimer of Warranties and Limitation of Liability.
79
+
80
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
81
+
82
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
83
+
84
+ c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
85
+
86
+ Section 6 – Term and Termination.
87
+
88
+ a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
89
+
90
+ b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
91
+ 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
92
+ 2. upon express reinstatement by the Licensor.
93
+ For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
94
+
95
+ c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
96
+
97
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
98
+
99
+ Section 7 – Other Terms and Conditions.
100
+
101
+ a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
102
+
103
+ b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
104
+
105
+ Section 8 – Interpretation.
106
+
107
+ a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
108
+
109
+ b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
110
+
111
+ c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
112
+
113
+ d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
114
+
115
+ Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the "Licensor." The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark "Creative Commons" or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
116
+
117
+ Creative Commons may be contacted at creativecommons.org.
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.4
2
+ Name: chowclassifier
3
+ Version: 2.0.0
4
+ Summary: Classification of time trends using Chow test
5
+ Author-email: Luc Miaz <luc@miaz.ch>
6
+ License-Expression: CC-BY-NC-4.0
7
+ Project-URL: Homepage, https://github.com/LucMiaz/chowclassifier
8
+ Project-URL: Documentation, https://chowclassifier.readthedocs.io/en/latest/
9
+ Project-URL: Source, https://github.com/LucMiaz/chowclassifier
10
+ Project-URL: Issues, https://github.com/LucMiaz/chowclassifier/issues
11
+ Keywords: chow,time-trends,bayesian,censored-data,breakpoint
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Natural Language :: English
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Programming Language :: Python :: 3
16
+ Requires-Python: >=3.9
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: matplotlib>=3.5.0
20
+ Requires-Dist: numpy>=1.19.4
21
+ Requires-Dist: pandas>=1.1.5
22
+ Requires-Dist: openpyxl
23
+ Requires-Dist: scipy>=1.1.5
24
+ Requires-Dist: seaborn>=0.11.2
25
+ Requires-Dist: statsmodels>=0.13.1
26
+ Requires-Dist: tqdm>=4.65.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest; extra == "dev"
29
+ Provides-Extra: bayes
30
+ Requires-Dist: pymc>=5.10; extra == "bayes"
31
+ Requires-Dist: arviz; extra == "bayes"
32
+ Provides-Extra: nutpie
33
+ Requires-Dist: pymc>=5.10; extra == "nutpie"
34
+ Requires-Dist: arviz; extra == "nutpie"
35
+ Requires-Dist: nutpie; extra == "nutpie"
36
+ Provides-Extra: jax
37
+ Requires-Dist: pymc>=5.10; extra == "jax"
38
+ Requires-Dist: arviz; extra == "jax"
39
+ Requires-Dist: numpyro; extra == "jax"
40
+ Requires-Dist: jax; extra == "jax"
41
+ Dynamic: license-file
42
+
43
+ # ChowClassifier
44
+
45
+ ## Description
46
+ There are many application where it is useful to analyse rapidly a large number of time-series for overall trends and possible breakpoint at which the trend changes. For example, spotting increasing trends in potential contaminants concentration from the outputs of non-target screening from high resolution mass spectrometry.
47
+
48
+ ChowClassifier aims to solve this. It is a script that performs a series of Chow tests on a time-indexed dataset to determine if a breakpoint in the time trends is probable. Two classes `Chow` and `ChewData` enable to perform the tests (and, optionally, `BayesChow` a Bayesian classification that handles censored data, see below), generate plots and export the results in `csv` and `excel`. Dataset with groups can be ran simultaneously with `ChewData` indicating with `namecol` the name of the grouping column. Calling `run` on a `ChewData` instance will create an instance of `Chow` for each group and classify them into the following categories.
49
+
50
+ | Breakpoint ? | Category | Description |
51
+ |--------------|----------|-------------|
52
+ | No |N | non-significant overall trend |
53
+ | No | I | significant increasing overall trend |
54
+ | No | D | significant decreasing overall trend |
55
+ | Yes | NN | non-significant trend on set1 and non-significant trend on set2 |
56
+ | Yes | NI | non-significant trend on set1 and significant increasing trend on set2 |
57
+ | Yes | ND | non-significant trend on set1 ans significant decreasing trend on set2 |
58
+ | Yes | IN | significant increasing trend on set1 and non-significant trend on set2 |
59
+ | Yes | ID | significant increasing trend on set1 and significant decreasing trend on set2 |
60
+ | Yes | iI | significant increasing trend on both set1 and set2 with greater increase in set2 |
61
+ | Yes | Ii | significant increasing trend on both set1 and set2 with greater increase in set1 |
62
+ | Yes | DN | significant decreasing trend on set1 and non-significant trend on set2 |
63
+ | Yes | DI | significant decreasing trend on set1 and significant increasing trend on set2 |
64
+ | Yes | dD | significant decreasing trend on both set1 and set2 with greater decrease in set2 |
65
+ | Yes | Dd | significant decreasing trend on both set1 and set2 with greater decrease in set1 |
66
+
67
+ where set1 and set2 indicate respectively the data before the breakpoint and after. The decision process for this classification is shown in the following schema:
68
+
69
+
70
+ ![Image unavailable, see schema on readthedocs.](imgs/Categorisation_TT.svg)
71
+
72
+
73
+ ## Chow test
74
+ Chow test was first derived by Gregory Chow[^1] in 1960 and later by Franklin Fisher[^2]. We test the significance of the breakpoint at the Bonferroni-corrected level $\alpha/m$ ($m$ breakpoints tested) with the statistic $Z=\frac{S_c-(S_1+S_2)}{S_1+S_2}\cdot\frac{N_1+N_2-2\cdot k}{k}$, where $k=2$ is the number of parameters of each regression (intercept and slope). It follows an F-distribution with $k$ and $N_1+N_2-2k$ degrees of freedom, where $S_C$ is the sum of squared residuals of the regression on the full time series, $S_1$, $S_2$ are the sums of squared residuals of the regression on the first, and respectively, the second half of the time series and $N_1$, $N_2$ are the number of observation for each half. See also [^3].
75
+
76
+ ## Installation
77
+ ```
78
+ pip install chowclassifier
79
+ ```
80
+
81
+ ## Citation
82
+
83
+ If you use this package in your research, please cite:
84
+
85
+ Influence of Season on Biodegradation Rates in Rivers
86
+ Run Tian, Malte Posselt, Luc T. Miaz, Kathrin Fenner, and Michael S. McLachlan
87
+ Environmental Science & Technology 2024 58 (16), 7144-7153
88
+ DOI: [10.1021/acs.est.3c10541](https://doi.org/10.1021/acs.est.3c10541)
89
+
90
+ [Download citation](https://pubs.acs.org/action/downloadCitation?doi=10.1021%2Facs.est.3c10541&include=cit&format=ris&direct=true&downloadFileName=acs.est.3c10541)
91
+
92
+ ## Use
93
+ The script can be run on any file with `python -m chowclassifier -f path/to/file/filename.csv -X xcol -y ycol -n grouping_name` (`chowclassifier --help` lists all options) or it can be imported:
94
+
95
+ ```python
96
+ from chowclassifier import ChewData
97
+
98
+ C = ChewData(filename="example/data/stocks.csv",
99
+ timecol="Date", # name of the time column (x-axis)
100
+ ycol="Close", # name of the value column (y-axis)
101
+ namecol="name", # one time series per value of this column
102
+ groupcol="g", # optional: sub-groups plotted by plot_by_group
103
+ alpha=0.01) # significance level; a Bonferroni correction
104
+ # is applied when several breakpoints are tested
105
+
106
+ # If the time column holds dates, it is converted automatically when the
107
+ # format can be inferred; otherwise call C.parse_timecol(date_format="%Y-%m-%d").
108
+
109
+ C.run(initial_breakpoint=None) # None: midpoint of the time column
110
+ C.save_to_file("results.xlsx") # or .csv
111
+
112
+ C.plot(filename="example/fig/stocks.png", # all series in one figure
113
+ xlabel="time", ylabel="value",
114
+ figsize=(16, 8), sharey=True)
115
+ C.plot_individually(savingpath="example/fig", fmt="png", # one file per series
116
+ xlabel="time", ylabel="value")
117
+ C.plot_by_group(savingpath="example/fig", fmt="png", # one file per series, by group
118
+ xlabel="time", ylabel="value",
119
+ plot_overall=True, # overall trend across groups
120
+ plot_individual_fill=True) # confidence interval of each group
121
+ ```
122
+
123
+ ## Bayesian classification and censored data (optional)
124
+
125
+ `chowclassifier.bayes.BayesChow` classifies a series into the same 14 categories with a Bayesian
126
+ model instead of F-tests. It is an optional feature: the Chow test does not need it, and its
127
+ dependencies (PyMC, and optionally nutpie or JAX) are only installed on request:
128
+
129
+ ```
130
+ pip install chowclassifier[bayes] # PyMC
131
+ pip install chowclassifier[nutpie] # PyMC + nutpie sampler (faster)
132
+ pip install chowclassifier[jax] # PyMC + NumPyro/JAX sampler (CPU or GPU)
133
+ ```
134
+
135
+ **Censored data.** Environmental and analytical series often contain values below a detection or
136
+ quantification limit. `BayesChow` takes a boolean column (`censcol`) that marks these rows (the
137
+ value is then the limit, and the true value lies below it). They enter the likelihood through the
138
+ normal cumulative distribution function (Tobit model), instead of being dropped, set to half the
139
+ limit, or treated as measured values, which biases slopes when limits change over time.
140
+
141
+ **Model.** The series is fitted either with a single line or with one breakpoint, with the
142
+ breakpoint a discrete parameter over the candidate times (the same search as `Chow`, controlled
143
+ by `margin`), marginalised in the model. Both lines share their parameters (slope `b` before the
144
+ break and `b + delta` after it; continuous at the break by default, or with a jump in level as in
145
+ the Chow test with `continuous=False`), so that the sampler can move between "break" and
146
+ "no break". The output gives
147
+
148
+ * `p_break`: posterior probability of a breakpoint, and `breakpoint`, the most probable one
149
+ (a break is retained when `p_break >= break_threshold`, default 0.95);
150
+ * `treeclass`: the most probable category, and `class_probabilities` for all 14;
151
+ * the slopes before and after the break with 95 % credible intervals.
152
+
153
+ A trend is "N" when its slope lies within a region of practical equivalence `[-rope, rope]`, so
154
+ the absence of a trend can be supported by the data.. With `log_y=True` the model is fitted to
155
+ log(y) and `rope` is a relative change per time unit (e.g. 0.01 = 1 % per year).
156
+
157
+ ```python
158
+ from chowclassifier.bayes import BayesChow
159
+ bc = BayesChow(df, timecol="year", ycol="conc", censcol="below_limit",
160
+ log_y=True, rope=0.01, margin=None, sampler="nutpie")
161
+ bc.run()
162
+ print(bc.summary()) # e.g. "PFOS, Seine: class dD (P = 0.93), P(break) = 0.99 at 2016"
163
+ bc.class_probabilities # probability of each category
164
+ bc.plot(ylabel="ng/L") # open triangles: values below the limit
165
+ ```
166
+
167
+ `ChewData` runs it on every group with `method="bayes"`:
168
+
169
+ ```python
170
+ C = ChewData(df=df, namecol="site", timecol="year", ycol="conc", method="bayes",
171
+ censcol="below_limit", bayes_kwargs=dict(log_y=True, rope=0.01, sampler="nutpie"))
172
+ C.run()
173
+ C.results_df()
174
+ ```
175
+
176
+ Each series is sampled separately (tens of seconds for a few hundred points, minutes for
177
+ tens of thousands of censored points).
178
+
179
+ Here is the equivalent schema for the Bayes version:
180
+ ![Image unavailable, see schema on readthedocs.](imgs/Categorisation_TT_Bayes.svg)
181
+
182
+
183
+ ## Version changes
184
+
185
+ 2.0.0 Added the optional Bayesian classification `BayesChow` (`pip install chowclassifier[bayes]`), with support for censored data (values below a limit), and `ChewData(method='bayes')`.
186
+
187
+ 1.1.1 Fixed empty unused plots, added breakpoint-margin constraints, added test example, added CI.
188
+ 1.0.10 Minor addition, with show_legend option
189
+ 1.0.9 Correction of bugs, added jupyter notebook example.
190
+ 1.0.8 Correction of bugs.
191
+ 1.0.7 Split main classes and utilities in multiple files, added option to ChewData.plot to have grouped trends, corrected input parsing, corrected inconsistancy with intial_breakpoint/margin
192
+ Added option to change linestyle by trend individually
193
+ 1.0.5 Added option to plot confidence interval fill for individual group trends
194
+ 1.0.4 Added support for plotting individual trends by group
195
+ 1.0.3 Bug correction
196
+ 1.0.2 Added support to parse full csv/excel automatically
197
+ 1.0.1 First implementation of algorithm
198
+
199
+ ## References
200
+
201
+ [^1]: Chow, Gregory C. ‘Test of Equality Between Sets of Coefficients in Two Linear Regressions’. Econometrica 28, no. 3 (1960): 591–605. [jstor.org/stable/1910133](https://www.jstor.org/stable/1910133).
202
+
203
+ [^2]: Fisher, Franklin M. ‘Tests of Equality Between Sets of Coefficients in Two Linear Regressions: An Expository Note’. Econometrica2 38, no. 2 (1970): 361–66. [jstor.org/stable/1913018](https://www.jstor.org/stable/1913018).
204
+
205
+ [^3]: *Chow test* entry on Wikipedia: https://en.wikipedia.org/wiki/Chow_test
@@ -0,0 +1,163 @@
1
+ # ChowClassifier
2
+
3
+ ## Description
4
+ There are many application where it is useful to analyse rapidly a large number of time-series for overall trends and possible breakpoint at which the trend changes. For example, spotting increasing trends in potential contaminants concentration from the outputs of non-target screening from high resolution mass spectrometry.
5
+
6
+ ChowClassifier aims to solve this. It is a script that performs a series of Chow tests on a time-indexed dataset to determine if a breakpoint in the time trends is probable. Two classes `Chow` and `ChewData` enable to perform the tests (and, optionally, `BayesChow` a Bayesian classification that handles censored data, see below), generate plots and export the results in `csv` and `excel`. Dataset with groups can be ran simultaneously with `ChewData` indicating with `namecol` the name of the grouping column. Calling `run` on a `ChewData` instance will create an instance of `Chow` for each group and classify them into the following categories.
7
+
8
+ | Breakpoint ? | Category | Description |
9
+ |--------------|----------|-------------|
10
+ | No |N | non-significant overall trend |
11
+ | No | I | significant increasing overall trend |
12
+ | No | D | significant decreasing overall trend |
13
+ | Yes | NN | non-significant trend on set1 and non-significant trend on set2 |
14
+ | Yes | NI | non-significant trend on set1 and significant increasing trend on set2 |
15
+ | Yes | ND | non-significant trend on set1 ans significant decreasing trend on set2 |
16
+ | Yes | IN | significant increasing trend on set1 and non-significant trend on set2 |
17
+ | Yes | ID | significant increasing trend on set1 and significant decreasing trend on set2 |
18
+ | Yes | iI | significant increasing trend on both set1 and set2 with greater increase in set2 |
19
+ | Yes | Ii | significant increasing trend on both set1 and set2 with greater increase in set1 |
20
+ | Yes | DN | significant decreasing trend on set1 and non-significant trend on set2 |
21
+ | Yes | DI | significant decreasing trend on set1 and significant increasing trend on set2 |
22
+ | Yes | dD | significant decreasing trend on both set1 and set2 with greater decrease in set2 |
23
+ | Yes | Dd | significant decreasing trend on both set1 and set2 with greater decrease in set1 |
24
+
25
+ where set1 and set2 indicate respectively the data before the breakpoint and after. The decision process for this classification is shown in the following schema:
26
+
27
+
28
+ ![Image unavailable, see schema on readthedocs.](imgs/Categorisation_TT.svg)
29
+
30
+
31
+ ## Chow test
32
+ Chow test was first derived by Gregory Chow[^1] in 1960 and later by Franklin Fisher[^2]. We test the significance of the breakpoint at the Bonferroni-corrected level $\alpha/m$ ($m$ breakpoints tested) with the statistic $Z=\frac{S_c-(S_1+S_2)}{S_1+S_2}\cdot\frac{N_1+N_2-2\cdot k}{k}$, where $k=2$ is the number of parameters of each regression (intercept and slope). It follows an F-distribution with $k$ and $N_1+N_2-2k$ degrees of freedom, where $S_C$ is the sum of squared residuals of the regression on the full time series, $S_1$, $S_2$ are the sums of squared residuals of the regression on the first, and respectively, the second half of the time series and $N_1$, $N_2$ are the number of observation for each half. See also [^3].
33
+
34
+ ## Installation
35
+ ```
36
+ pip install chowclassifier
37
+ ```
38
+
39
+ ## Citation
40
+
41
+ If you use this package in your research, please cite:
42
+
43
+ Influence of Season on Biodegradation Rates in Rivers
44
+ Run Tian, Malte Posselt, Luc T. Miaz, Kathrin Fenner, and Michael S. McLachlan
45
+ Environmental Science & Technology 2024 58 (16), 7144-7153
46
+ DOI: [10.1021/acs.est.3c10541](https://doi.org/10.1021/acs.est.3c10541)
47
+
48
+ [Download citation](https://pubs.acs.org/action/downloadCitation?doi=10.1021%2Facs.est.3c10541&include=cit&format=ris&direct=true&downloadFileName=acs.est.3c10541)
49
+
50
+ ## Use
51
+ The script can be run on any file with `python -m chowclassifier -f path/to/file/filename.csv -X xcol -y ycol -n grouping_name` (`chowclassifier --help` lists all options) or it can be imported:
52
+
53
+ ```python
54
+ from chowclassifier import ChewData
55
+
56
+ C = ChewData(filename="example/data/stocks.csv",
57
+ timecol="Date", # name of the time column (x-axis)
58
+ ycol="Close", # name of the value column (y-axis)
59
+ namecol="name", # one time series per value of this column
60
+ groupcol="g", # optional: sub-groups plotted by plot_by_group
61
+ alpha=0.01) # significance level; a Bonferroni correction
62
+ # is applied when several breakpoints are tested
63
+
64
+ # If the time column holds dates, it is converted automatically when the
65
+ # format can be inferred; otherwise call C.parse_timecol(date_format="%Y-%m-%d").
66
+
67
+ C.run(initial_breakpoint=None) # None: midpoint of the time column
68
+ C.save_to_file("results.xlsx") # or .csv
69
+
70
+ C.plot(filename="example/fig/stocks.png", # all series in one figure
71
+ xlabel="time", ylabel="value",
72
+ figsize=(16, 8), sharey=True)
73
+ C.plot_individually(savingpath="example/fig", fmt="png", # one file per series
74
+ xlabel="time", ylabel="value")
75
+ C.plot_by_group(savingpath="example/fig", fmt="png", # one file per series, by group
76
+ xlabel="time", ylabel="value",
77
+ plot_overall=True, # overall trend across groups
78
+ plot_individual_fill=True) # confidence interval of each group
79
+ ```
80
+
81
+ ## Bayesian classification and censored data (optional)
82
+
83
+ `chowclassifier.bayes.BayesChow` classifies a series into the same 14 categories with a Bayesian
84
+ model instead of F-tests. It is an optional feature: the Chow test does not need it, and its
85
+ dependencies (PyMC, and optionally nutpie or JAX) are only installed on request:
86
+
87
+ ```
88
+ pip install chowclassifier[bayes] # PyMC
89
+ pip install chowclassifier[nutpie] # PyMC + nutpie sampler (faster)
90
+ pip install chowclassifier[jax] # PyMC + NumPyro/JAX sampler (CPU or GPU)
91
+ ```
92
+
93
+ **Censored data.** Environmental and analytical series often contain values below a detection or
94
+ quantification limit. `BayesChow` takes a boolean column (`censcol`) that marks these rows (the
95
+ value is then the limit, and the true value lies below it). They enter the likelihood through the
96
+ normal cumulative distribution function (Tobit model), instead of being dropped, set to half the
97
+ limit, or treated as measured values, which biases slopes when limits change over time.
98
+
99
+ **Model.** The series is fitted either with a single line or with one breakpoint, with the
100
+ breakpoint a discrete parameter over the candidate times (the same search as `Chow`, controlled
101
+ by `margin`), marginalised in the model. Both lines share their parameters (slope `b` before the
102
+ break and `b + delta` after it; continuous at the break by default, or with a jump in level as in
103
+ the Chow test with `continuous=False`), so that the sampler can move between "break" and
104
+ "no break". The output gives
105
+
106
+ * `p_break`: posterior probability of a breakpoint, and `breakpoint`, the most probable one
107
+ (a break is retained when `p_break >= break_threshold`, default 0.95);
108
+ * `treeclass`: the most probable category, and `class_probabilities` for all 14;
109
+ * the slopes before and after the break with 95 % credible intervals.
110
+
111
+ A trend is "N" when its slope lies within a region of practical equivalence `[-rope, rope]`, so
112
+ the absence of a trend can be supported by the data.. With `log_y=True` the model is fitted to
113
+ log(y) and `rope` is a relative change per time unit (e.g. 0.01 = 1 % per year).
114
+
115
+ ```python
116
+ from chowclassifier.bayes import BayesChow
117
+ bc = BayesChow(df, timecol="year", ycol="conc", censcol="below_limit",
118
+ log_y=True, rope=0.01, margin=None, sampler="nutpie")
119
+ bc.run()
120
+ print(bc.summary()) # e.g. "PFOS, Seine: class dD (P = 0.93), P(break) = 0.99 at 2016"
121
+ bc.class_probabilities # probability of each category
122
+ bc.plot(ylabel="ng/L") # open triangles: values below the limit
123
+ ```
124
+
125
+ `ChewData` runs it on every group with `method="bayes"`:
126
+
127
+ ```python
128
+ C = ChewData(df=df, namecol="site", timecol="year", ycol="conc", method="bayes",
129
+ censcol="below_limit", bayes_kwargs=dict(log_y=True, rope=0.01, sampler="nutpie"))
130
+ C.run()
131
+ C.results_df()
132
+ ```
133
+
134
+ Each series is sampled separately (tens of seconds for a few hundred points, minutes for
135
+ tens of thousands of censored points).
136
+
137
+ Here is the equivalent schema for the Bayes version:
138
+ ![Image unavailable, see schema on readthedocs.](imgs/Categorisation_TT_Bayes.svg)
139
+
140
+
141
+ ## Version changes
142
+
143
+ 2.0.0 Added the optional Bayesian classification `BayesChow` (`pip install chowclassifier[bayes]`), with support for censored data (values below a limit), and `ChewData(method='bayes')`.
144
+
145
+ 1.1.1 Fixed empty unused plots, added breakpoint-margin constraints, added test example, added CI.
146
+ 1.0.10 Minor addition, with show_legend option
147
+ 1.0.9 Correction of bugs, added jupyter notebook example.
148
+ 1.0.8 Correction of bugs.
149
+ 1.0.7 Split main classes and utilities in multiple files, added option to ChewData.plot to have grouped trends, corrected input parsing, corrected inconsistancy with intial_breakpoint/margin
150
+ Added option to change linestyle by trend individually
151
+ 1.0.5 Added option to plot confidence interval fill for individual group trends
152
+ 1.0.4 Added support for plotting individual trends by group
153
+ 1.0.3 Bug correction
154
+ 1.0.2 Added support to parse full csv/excel automatically
155
+ 1.0.1 First implementation of algorithm
156
+
157
+ ## References
158
+
159
+ [^1]: Chow, Gregory C. ‘Test of Equality Between Sets of Coefficients in Two Linear Regressions’. Econometrica 28, no. 3 (1960): 591–605. [jstor.org/stable/1910133](https://www.jstor.org/stable/1910133).
160
+
161
+ [^2]: Fisher, Franklin M. ‘Tests of Equality Between Sets of Coefficients in Two Linear Regressions: An Expository Note’. Econometrica2 38, no. 2 (1970): 361–66. [jstor.org/stable/1913018](https://www.jstor.org/stable/1913018).
162
+
163
+ [^3]: *Chow test* entry on Wikipedia: https://en.wikipedia.org/wiki/Chow_test