iita-python 1.4__tar.gz → 1.4.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iita_python
3
- Version: 1.4
3
+ Version: 1.4.1
4
4
  Summary: IITA algorithm in python
5
5
  Author-email: Aliaksei Badnarchuk <alexejbodnarchuk@gmail.com>
6
6
  Requires-Python: >=3.9
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '1.4'
22
- __version_tuple__ = version_tuple = (1, 4)
21
+ __version__ = version = '1.4.1'
22
+ __version_tuple__ = version_tuple = (1, 4, 1)
23
23
 
24
- __commit_id__ = commit_id = 'g8439da544'
24
+ __commit_id__ = commit_id = 'gbd4c17f18'
@@ -21,6 +21,36 @@ class QuasiOrder:
21
21
  edge_list.append([i+buff, j+buff])
22
22
 
23
23
  return edge_list
24
+
25
+ def get_knowledge_space(self):
26
+ """
27
+ Returns the knowledge space described by the quasiorder as a numpy matrix\n
28
+ In the output matrix, the rows represent the elements of the knowledge space,
29
+ and the columns represent the items. An entry is 1 if the item is in the knowledge state, and 0 otherwise.
30
+ """
31
+
32
+ n = self.full_matrix.shape[0]
33
+
34
+ bits = 1 << np.arange(n, dtype=object)
35
+ predecessors = np.array([int(np.packbits(self.full_matrix[:, j], bitorder='little')[0]) | (1 << j) for j in range(n)])
36
+
37
+ knowledge_space_set = {0}
38
+ queue = [0]
39
+
40
+ while queue:
41
+ current = queue.pop()
42
+
43
+ absent = (current & bits) == 0
44
+ candidates = (current | predecessors)[absent]
45
+
46
+ for new_set in candidates:
47
+ if new_set not in knowledge_space_set:
48
+ knowledge_space_set.add(new_set)
49
+ queue.append(new_set)
50
+
51
+ masks = np.array(sorted(knowledge_space_set), dtype=object)
52
+ knowledge_space_matrix = ((masks[:, None] & bits) != 0).astype(np.int_)
53
+ return knowledge_space_matrix
24
54
 
25
55
  def ind_gen(counterexamples: pd.DataFrame, n: int) -> list[QuasiOrder]:
26
56
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iita_python
3
- Version: 1.4
3
+ Version: 1.4.1
4
4
  Summary: IITA algorithm in python
5
5
  Author-email: Aliaksei Badnarchuk <alexejbodnarchuk@gmail.com>
6
6
  Requires-Python: >=3.9
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes