python-clired 6.0.7__tar.gz → 6.0.9__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 (100) hide show
  1. {python-clired-6.0.7 → python_clired-6.0.9}/CHANGELOG +9 -0
  2. {python-clired-6.0.7 → python_clired-6.0.9}/MANIFEST.in +0 -1
  3. python_clired-6.0.9/PKG-INFO +33 -0
  4. {python-clired-6.0.7 → python_clired-6.0.9}/README.md +1 -1
  5. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/common_details.py +4 -4
  6. python_clired-6.0.9/blocks/mine/actions_rdefs_basic.xml +196 -0
  7. python_clired-6.0.9/blocks/mine/bellman.py +60 -0
  8. python_clired-6.0.9/blocks/mine/classAction.py +449 -0
  9. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classCandidates.py +45 -22
  10. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classCharbon.py +23 -9
  11. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classCharbonGMiss.py +77 -42
  12. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classCharbonGStd.py +135 -67
  13. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classCharbonGreedy.py +168 -70
  14. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classCharbonTAlt.py +83 -89
  15. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classCharbonTLayer.py +40 -33
  16. python_clired-6.0.9/blocks/mine/classCharbonXFIM.py +139 -0
  17. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classCol.py +237 -69
  18. python_clired-6.0.9/blocks/mine/classConstraints.py +451 -0
  19. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classContent.py +244 -210
  20. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classData.py +114 -42
  21. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classMiner.py +51 -433
  22. python_clired-6.0.9/blocks/mine/classMultiprocMiner.py +311 -0
  23. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classPackage.py +349 -247
  24. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classPreferencesManager.py +79 -34
  25. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classProps.py +200 -166
  26. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classQuery.py +678 -550
  27. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classRedescription.py +120 -33
  28. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classSParts.py +50 -12
  29. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/csv_reader.py +20 -9
  30. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/exec_clired.py +74 -21
  31. python_clired-6.0.9/blocks/mine/factMiner.py +94 -0
  32. python_clired-6.0.9/blocks/mine/fields_rdefs_basic.xml +224 -0
  33. python_clired-6.0.9/blocks/mine/fields_rdefs_more.xml +13 -0
  34. python_clired-6.0.9/blocks/mine/fields_vdefs_basic.xml +27 -0
  35. python_clired-6.0.9/blocks/mine/fields_vdefs_more.xml +22 -0
  36. python-clired-6.0.7/blocks/mine/classCharbonXFIM.py → python_clired-6.0.9/blocks/mine/fim_mod_eclat.py +1 -82
  37. python_clired-6.0.9/blocks/mine/fim_mod_fpgrowth.py +1037 -0
  38. python_clired-6.0.9/blocks/mine/fim_org_fpgrowth.py +279 -0
  39. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/inout_confdef.xml +21 -10
  40. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/miner_confdef.xml +162 -14
  41. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/prepare_polygons.py +2 -2
  42. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/redquery_parser.py +25 -6
  43. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/toolLog.py +16 -2
  44. python_clired-6.0.9/blocks/mine/toolXML.py +112 -0
  45. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/work/classWorkClient.py +1 -1
  46. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/work/classWorkLocal.py +1 -1
  47. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/work/classWorkServer.py +1 -1
  48. {python-clired-6.0.7 → python_clired-6.0.9}/exec_client.py +2 -3
  49. python_clired-6.0.9/python_clired.egg-info/PKG-INFO +33 -0
  50. {python-clired-6.0.7 → python_clired-6.0.9}/python_clired.egg-info/SOURCES.txt +12 -5
  51. {python-clired-6.0.7 → python_clired-6.0.9}/python_clired.egg-info/entry_points.txt +0 -1
  52. {python-clired-6.0.7 → python_clired-6.0.9}/python_clired.egg-info/requires.txt +3 -3
  53. python-clired-6.0.7/PKG-INFO +0 -17
  54. python-clired-6.0.7/blocks/mine/actions_rdefs_basic.txt +0 -27
  55. python-clired-6.0.7/blocks/mine/classConstraints.py +0 -779
  56. python-clired-6.0.7/blocks/mine/fields_rdefs_basic.txt +0 -57
  57. python-clired-6.0.7/blocks/mine/fields_rdefs_more.txt +0 -3
  58. python-clired-6.0.7/blocks/mine/fields_vdefs_basic.txt +0 -16
  59. python-clired-6.0.7/blocks/mine/fields_vdefs_more.txt +0 -13
  60. python-clired-6.0.7/blocks/mine/toolXML.py +0 -62
  61. python-clired-6.0.7/python_clired.egg-info/PKG-INFO +0 -17
  62. {python-clired-6.0.7 → python_clired-6.0.9}/LICENSE +0 -0
  63. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/__init__.py +0 -0
  64. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/__init__.py +0 -0
  65. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classDTreeTools.py +0 -0
  66. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classDataExtension.py +0 -0
  67. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classRndFactory.py +0 -0
  68. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/classSouvenirs.py +0 -0
  69. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/confdef.xsl +0 -0
  70. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/dataext_confdef.xml +0 -0
  71. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/folds_confdef.xml +0 -0
  72. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/__init__.py +0 -0
  73. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/__main__.py +0 -0
  74. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/ast.py +0 -0
  75. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/bootstrap.py +0 -0
  76. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/buffering.py +0 -0
  77. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/codegen.py +0 -0
  78. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/contexts.py +0 -0
  79. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/diagrams.py +0 -0
  80. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/exceptions.py +0 -0
  81. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/grammars.py +0 -0
  82. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/model.py +0 -0
  83. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/parsing.py +0 -0
  84. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/rendering.py +0 -0
  85. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/semantics.py +0 -0
  86. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/tool.py +0 -0
  87. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/grako/util.py +0 -0
  88. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/mkPartsTypes.py +0 -0
  89. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/rnd_confdef.xml +0 -0
  90. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/toolICDict.py +0 -0
  91. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/mine/toolICList.py +0 -0
  92. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/work/__init__.py +0 -0
  93. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/work/classWorkInactive.py +0 -0
  94. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/work/network_confdef.xml +0 -0
  95. {python-clired-6.0.7 → python_clired-6.0.9}/blocks/work/toolWP.py +0 -0
  96. {python-clired-6.0.7 → python_clired-6.0.9}/exec_server.py +0 -0
  97. {python-clired-6.0.7 → python_clired-6.0.9}/python_clired.egg-info/dependency_links.txt +0 -0
  98. {python-clired-6.0.7 → python_clired-6.0.9}/python_clired.egg-info/top_level.txt +0 -0
  99. {python-clired-6.0.7 → python_clired-6.0.9}/setup.cfg +0 -0
  100. {python-clired-6.0.7 → python_clired-6.0.9}/setup.py +0 -0
@@ -1,6 +1,15 @@
1
1
  CHANGELOG for Clired/Siren
2
2
  =============================
3
3
 
4
+ v6.0.9
5
+ ------
6
+ * Fixed command-line `exec_clired` entry point
7
+ * Pushing edits to pypi release
8
+
9
+ v6.0.8
10
+ ------
11
+ * Renamed folders
12
+
4
13
  v6.0.7
5
14
  ------
6
15
  * Adding a command-line client
@@ -1,7 +1,6 @@
1
1
  include blocks/mine/*.py
2
2
  include blocks/mine/*.xml
3
3
  include blocks/mine/*.xsl
4
- include blocks/mine/*.txt
5
4
  include blocks/mine/grako/*.py
6
5
  include blocks/work/*.py
7
6
  include CHANGELOG
@@ -0,0 +1,33 @@
1
+ Metadata-Version: 2.2
2
+ Name: python-clired
3
+ Version: 6.0.9
4
+ Summary: Command-line Redescription Mining
5
+ Home-page: http://cs.uef.fi/siren/
6
+ Author: Esther Galbrun and Pauli Miettinen
7
+ Author-email: esther.galbrun@inria.fr
8
+ License: Apache_2.0
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Topic :: Scientific/Engineering
14
+ Requires-Python: >=3
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: python-dateutil>=2.7.3
18
+ Requires-Dist: shapely>=1.7.0
19
+ Requires-Dist: numpy>=1.13.0
20
+ Requires-Dist: scipy>=0.19.0
21
+ Requires-Dist: scikit-learn>=0.19.0
22
+ Dynamic: author
23
+ Dynamic: author-email
24
+ Dynamic: classifier
25
+ Dynamic: description
26
+ Dynamic: description-content-type
27
+ Dynamic: home-page
28
+ Dynamic: license
29
+ Dynamic: requires-dist
30
+ Dynamic: requires-python
31
+ Dynamic: summary
32
+
33
+ This provides the Clired command-line tool for redescription mining including, in particular, the greedy ReReMi algorithm and tree-based algorithms. Once installed, Clired can be run by calling the command 'exec_clired'.
@@ -8,7 +8,7 @@ Clired is a command-line tool for redescription mining.
8
8
  #### Dependencies
9
9
  `python-clired` requires several other Python utilities, including Numpy, Scipy and Scikit-learn.
10
10
 
11
- * python-dateutil (>= 2.8.1)
11
+ * python-dateutil (>= 2.7.3)
12
12
  * shapely (>= 1.7.0)
13
13
  * numpy (>= 1.13.0)
14
14
  * scipy (>= 0.19.0)
@@ -9,14 +9,14 @@ def getVersion():
9
9
  ctime = time.strftime("%a, %d %b %Y %T", time.localtime(os.path.getmtime(CHANGELOG_FILE)))
10
10
  with open(CHANGELOG_FILE) as fp:
11
11
  for line in fp:
12
- tmp = re.match("^v(?P<version>[0-9\.]*)$", line)
12
+ tmp = re.match(r"^v(?P<version>[0-9\.]*)$", line)
13
13
  if tmp is not None:
14
14
  if version is None:
15
15
  version = tmp.group("version")
16
16
  else:
17
17
  return version, changes, ctime
18
- elif version is not None and len(line.strip("[\n\*\- ]")) > 0:
19
- changes.append(line.strip("[\n\*\- ]"))
18
+ elif version is not None and len(line.strip("\n*- ")) > 0:
19
+ changes.append(line.strip("\n*- "))
20
20
 
21
21
  return "", [], time.strftime("%a, %d %b %Y %T", time.localtime())
22
22
 
@@ -38,7 +38,7 @@ home_eg = "https://members.loria.fr/EGalbrun/"
38
38
  web_siren = "http://cs.uef.fi/siren/"
39
39
  gitlab_siren = "https://gitlab.inria.fr/egalbrun/siren"
40
40
 
41
- dependencies_clired = [("python-dateutil", "python3-dateutil", "(>= 2.8.1)"),
41
+ dependencies_clired = [("python-dateutil", "python3-dateutil", "(>= 2.7.3)"),
42
42
  ("shapely", "python3-shapely", "(>= 1.7.0)"),
43
43
  ("numpy", "python3-numpy", "(>= 1.13.0)"),
44
44
  ("scipy", "python3-scipy", "(>= 0.19.0)"),
@@ -0,0 +1,196 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <root>
3
+ <actionlist>
4
+ <name>redundant</name>
5
+ <action what="filterPairs">
6
+ <reverse><cstr>redundancy_reverse</cstr></reverse>
7
+ <max>0</max>
8
+ <comparison>
9
+ <value type="pair">active:<cstr>redundancy_how</cstr>:<cstr>redundancy_which</cstr></value>
10
+ <operator><![CDATA[>]]></operator>
11
+ <value><cstr>redundancy_threshold</cstr></value>
12
+ </comparison>
13
+ </action>
14
+ </actionlist>
15
+ <actionlist>
16
+ <name>_nextge</name>
17
+ <action what="filterSingle">
18
+ <comparison>
19
+ <value type="item">:nbAvC:</value>
20
+ <operator><![CDATA[=]]></operator>
21
+ <value type="int">0</value>
22
+ </comparison>
23
+ </action>
24
+ <action what="sort" reverse="true">
25
+ <value type="item">:acc:</value>
26
+ </action>
27
+ <action what="cut">
28
+ <max><cstr>batch_cap</cstr></max>
29
+ <direction>0</direction>
30
+ <comparison><value type="item">:acc:</value></comparison>
31
+ </action>
32
+ </actionlist>
33
+ <actionlist>
34
+ <name>_tree_rectangles</name>
35
+ <action what="filterPairs">
36
+ <max>0</max>
37
+ <value type="pair">:sameRectangles:</value>
38
+ </action>
39
+ </actionlist>
40
+ <actionlist>
41
+ <name>_partial</name>
42
+ <action what="filterSingle" reverse="true">
43
+ <comparison>
44
+ <value type="item">:len:O</value>
45
+ <operator><![CDATA[>=]]></operator>
46
+ <value><cstr>min_itm_out</cstr></value>
47
+ </comparison>
48
+ <comparison>
49
+ <value type="item">:len:I</value>
50
+ <operator><![CDATA[>=]]></operator>
51
+ <value><cstr>min_itm_in</cstr></value>
52
+ </comparison>
53
+ <comparison>
54
+ <value type="item">:pval:</value>
55
+ <operator><![CDATA[<=]]></operator>
56
+ <value><cstr>max_fin_pval</cstr></value>
57
+ </comparison>
58
+ </action>
59
+ <action what="sort" reverse="true">
60
+ <value type="item">:acc:</value>
61
+ <value type="item" flip="true">BOTH:len:q</value>
62
+ <value type="item" flip="true">:diffLengthQs:</value>
63
+ </action>
64
+ <action what="filterPairs">
65
+ <max>0</max>
66
+ <value type="pair">:superceding:</value>
67
+ </action>
68
+ <action what="cut">
69
+ <max><cstr>batch_out</cstr></max>
70
+ <direction>1</direction>
71
+ <comparison><value type="item">:acc:</value></comparison>
72
+ <comparison><value type="item" flip="true">BOTH:len:q</value></comparison>
73
+ <comparison><value type="item" flip="true">:diffLengthQs:</value></comparison>
74
+ </action>
75
+ </actionlist>
76
+ <actionlist>
77
+ <name>_final</name>
78
+ <action what="filterSingle" reverse="true">
79
+ <comparison>
80
+ <value type="item">BOTH:len:q</value>
81
+ <operator><![CDATA[>=]]></operator>
82
+ <value><cstr>min_fin_var</cstr></value>
83
+ </comparison>
84
+ <comparison>
85
+ <value type="item">:len:O</value>
86
+ <operator><![CDATA[>=]]></operator>
87
+ <value><cstr>min_fin_out</cstr></value>
88
+ </comparison>
89
+ <comparison>
90
+ <value type="item">:len:I</value>
91
+ <operator><![CDATA[>=]]></operator>
92
+ <value><cstr>min_fin_in</cstr></value>
93
+ </comparison>
94
+ <comparison>
95
+ <value type="item">:acc:</value>
96
+ <operator><![CDATA[>=]]></operator>
97
+ <value><cstr>min_fin_acc</cstr></value>
98
+ </comparison>
99
+ <comparison>
100
+ <value type="item">:pval:</value>
101
+ <operator><![CDATA[<=]]></operator>
102
+ <value><cstr>max_fin_pval</cstr></value>
103
+ </comparison>
104
+ </action>
105
+ <action what="sort" reverse="true">
106
+ <value type="item">:acc:</value>
107
+ <value type="item" flip="true">BOTH:len:q</value>
108
+ <value type="item" flip="true">:diffLengthQs:</value>
109
+ </action>
110
+ <action what="filterPairs">
111
+ <max>0</max>
112
+ <value type="pair">:superceding:</value>
113
+ </action>
114
+ </actionlist>
115
+ <actionlist>
116
+ <name>_fim</name>
117
+ <action what="sort" reverse="true">
118
+ <value type="item" flip="true">:len:O</value>
119
+ <value type="item" flip="true">BOTH:len:q</value>
120
+ </action>
121
+ </actionlist>
122
+ <actionlist>
123
+ <name>_fimg</name>
124
+ <action what="filterSingle" reverse="true">
125
+ <comparison>
126
+ <value type="item">:len:O</value>
127
+ <operator><![CDATA[>=]]></operator>
128
+ <value><cstr>min_itm_out</cstr></value>
129
+ </comparison>
130
+ <comparison>
131
+ <value type="item">:len:I</value>
132
+ <operator><![CDATA[>=]]></operator>
133
+ <value><cstr>min_itm_in</cstr></value>
134
+ </comparison>
135
+ <comparison>
136
+ <value type="item">:pval:</value>
137
+ <operator><![CDATA[<=]]></operator>
138
+ <value><cstr>max_fin_pval</cstr></value>
139
+ </comparison>
140
+ <comparison>
141
+ <value type="item">BOTH:len:q</value>
142
+ <operator><![CDATA[>=]]></operator>
143
+ <value><cstr>min_fin_var</cstr></value>
144
+ </comparison>
145
+ <comparison>
146
+ <value type="item">:len:O</value>
147
+ <operator><![CDATA[>=]]></operator>
148
+ <value><cstr>min_fin_out</cstr></value>
149
+ </comparison>
150
+ <comparison>
151
+ <value type="item">:len:I</value>
152
+ <operator><![CDATA[>=]]></operator>
153
+ <value><cstr>min_fin_in</cstr></value>
154
+ </comparison>
155
+ <comparison>
156
+ <value type="item">:acc:</value>
157
+ <operator><![CDATA[>=]]></operator>
158
+ <value><cstr>min_fin_acc</cstr></value>
159
+ </comparison>
160
+ <comparison>
161
+ <value type="item">:pval:</value>
162
+ <operator><![CDATA[<=]]></operator>
163
+ <value><cstr>max_fin_pval</cstr></value>
164
+ </comparison>
165
+ </action>
166
+ <action what="sort" reverse="true">
167
+ <value type="item">:acc:</value>
168
+ <value type="item" flip="true">BOTH:len:q</value>
169
+ <value type="item" flip="true">:diffLengthQs:</value>
170
+ </action>
171
+ </actionlist>
172
+ <actionlist>
173
+ <name>final_selection</name>
174
+ <list><name>_final</name></list>
175
+ </actionlist>
176
+ <actionlist>
177
+ <name>partial_selection</name>
178
+ <list><name>_partial</name></list>
179
+ </actionlist>
180
+ <actionlist>
181
+ <name>prune</name>
182
+ <action what="applyBulk">
183
+ <function>getPruned</function>
184
+ </action>
185
+ </actionlist>
186
+ <actionlist>
187
+ <name>normalize</name>
188
+ <action what="applyBulk">
189
+ <function>getNormalized</function>
190
+ </action>
191
+ </actionlist>
192
+ <actionlist>
193
+ <name>_postprocess</name>
194
+ <list><name>_final</name></list>
195
+ </actionlist>
196
+ </root>
@@ -0,0 +1,60 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ import numpy as np
4
+ from scipy import stats
5
+
6
+
7
+ def bin_segments(V_,max_k,criterion):
8
+ V = stats.zscore(V_)
9
+ T,I,J = np.unique(V,return_index=True,return_inverse=True)
10
+ occurrences = np.histogram(J,max(J+1))
11
+ n = len(T)
12
+ cumocc = np.insert(np.cumsum(occurrences[0]),0,0)
13
+ cs = np.insert(np.cumsum(np.multiply(T,occurrences[0])),0,0)
14
+ css = np.insert(np.cumsum(np.multiply(np.power(T,2),occurrences[0])),0,0)
15
+ sigma = np.zeros((n,n))
16
+ for i in range(n):
17
+ for j in range(i+1,n):
18
+ sigma[i,j] = (css[j+1] - css[i]) - (1/(cumocc[j+1]-cumocc[i]))*np.power((cs[j+1]-cs[i]),2)
19
+ E = np.zeros((max_k,n))
20
+ E[0,:] = sigma[0,:]
21
+ B = np.zeros((max_k,n))
22
+ cost = np.inf
23
+ for k in range(1,max_k):
24
+ for cutp in range(k,n):
25
+ E[k,cutp] = np.min(np.add(E[k-1,0:cutp],sigma[1:cutp+1,cutp]))
26
+ B[k,cutp] = int(np.argmin(np.add(E[k-1,0:cutp],sigma[1:cutp+1,cutp])))
27
+ if criterion == "manual":
28
+ c = E[k,n-1]
29
+ elif criterion == "BIC":
30
+ c = E[k,n-1] + k*np.log(len(V))
31
+ elif criterion == "AIC":
32
+ c = E[k,n-1] + 2*k
33
+ if c < cost:
34
+ opt_k = k
35
+ cost = c
36
+ else:
37
+ opt_k = k-1
38
+ break
39
+ B = B.astype(int)
40
+ cuts = [B[opt_k,n-1],n-1]
41
+ for j in range(opt_k-1,0,-1):
42
+ tmp = B[j,cuts[0]]
43
+ cuts = np.insert(cuts,0,tmp)
44
+ cuts = np.insert(np.unique(cuts),0,0)
45
+ buckets = np.zeros(n)
46
+ bounds = []
47
+ U = np.unique(V_)
48
+ for i in range(len(cuts)-1):
49
+ buckets[cuts[i]+1:cuts[i+1]+1] = i
50
+ bounds.append(U[cuts[i]+1])
51
+ bounds = bounds[1:]
52
+ assign = buckets[J]
53
+
54
+ return assign, bounds, cost, opt_k
55
+
56
+
57
+
58
+
59
+
60
+