SURE-tools 2.1.40__py3-none-any.whl → 2.1.42__py3-none-any.whl
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.
- SURE/perturb/perturb.py +6 -13
- {sure_tools-2.1.40.dist-info → sure_tools-2.1.42.dist-info}/METADATA +1 -1
- {sure_tools-2.1.40.dist-info → sure_tools-2.1.42.dist-info}/RECORD +7 -7
- {sure_tools-2.1.40.dist-info → sure_tools-2.1.42.dist-info}/WHEEL +0 -0
- {sure_tools-2.1.40.dist-info → sure_tools-2.1.42.dist-info}/entry_points.txt +0 -0
- {sure_tools-2.1.40.dist-info → sure_tools-2.1.42.dist-info}/licenses/LICENSE +0 -0
- {sure_tools-2.1.40.dist-info → sure_tools-2.1.42.dist-info}/top_level.txt +0 -0
SURE/perturb/perturb.py
CHANGED
|
@@ -117,15 +117,14 @@ def matrix_to_labels(matrix, unique_labels):
|
|
|
117
117
|
def _numba_fill_matrix(dose_matrix, label_indices, label_doses):
|
|
118
118
|
"""Numba 加速的矩阵填充函数"""
|
|
119
119
|
for i in range(len(label_indices)):
|
|
120
|
-
|
|
121
|
-
dose_matrix[i, j] = dose
|
|
120
|
+
dose_matrix[i, label_indices[i]] = label_doses[i]
|
|
122
121
|
|
|
123
122
|
def dose_to_matrix(labels, label_dose, all_labels=None):
|
|
124
123
|
"""
|
|
125
124
|
使用 Numba 的终极加速版本(需预先安装 numba)
|
|
126
125
|
"""
|
|
127
126
|
if all_labels is None:
|
|
128
|
-
all_labels = sorted(set().union(
|
|
127
|
+
all_labels = sorted(set().union(labels))
|
|
129
128
|
|
|
130
129
|
label_to_idx = {label: idx for idx, label in enumerate(all_labels)}
|
|
131
130
|
n_samples = len(labels)
|
|
@@ -135,16 +134,10 @@ def dose_to_matrix(labels, label_dose, all_labels=None):
|
|
|
135
134
|
# 预处理为 Numba 兼容格式
|
|
136
135
|
label_indices = []
|
|
137
136
|
label_doses = []
|
|
138
|
-
for
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if sample_labels:
|
|
142
|
-
for label in sample_labels:
|
|
143
|
-
indices.append(label_to_idx[label])
|
|
144
|
-
doses.append(label_dose[label])
|
|
145
|
-
label_indices.append(np.array(indices, dtype=np.int64))
|
|
146
|
-
label_doses.append(np.array(doses, dtype=np.float64))
|
|
137
|
+
for i, label in enumerate(labels):
|
|
138
|
+
label_indices.append(label_to_idx[label])
|
|
139
|
+
label_doses.append(label_dose[i])
|
|
147
140
|
|
|
148
141
|
# 调用 Numba 加速函数
|
|
149
142
|
_numba_fill_matrix(dose_matrix, label_indices, label_doses)
|
|
150
|
-
return dose_matrix,all_labels
|
|
143
|
+
return dose_matrix,np.array(all_labels)
|
|
@@ -12,14 +12,14 @@ SURE/flow/__init__.py,sha256=rsAjYsh1xVIrxBCuwOE0Q_6N5th1wBgjJceV0ABPG3c,183
|
|
|
12
12
|
SURE/flow/flow_stats.py,sha256=cBBsPEDpWNMpbzlyQ3f0385RSrX6_5RCH2caOyi4ihM,9908
|
|
13
13
|
SURE/flow/plot_quiver.py,sha256=UbmuScUcgbQHeMmjKmgqxjrIjHhiHx0VWct16UMMwuE,8110
|
|
14
14
|
SURE/perturb/__init__.py,sha256=8TP1dSUhXiZzKpFebHZmm8XMMGbUz_OfQ10xu-6uPPY,43
|
|
15
|
-
SURE/perturb/perturb.py,sha256=
|
|
15
|
+
SURE/perturb/perturb.py,sha256=ICs-yMIuT0tZtyx9R7tkzzhAcurs_eActv2v3uyjreE,5038
|
|
16
16
|
SURE/utils/__init__.py,sha256=QJUOfrXzdWSmoM0P3LH8oKEHttzCWqpDy2UF0F0dtN4,673
|
|
17
17
|
SURE/utils/custom_mlp.py,sha256=rHnx9jEef02zfCUdbYVCmbuHcDdIBmRgt__wpdpZvYg,8104
|
|
18
18
|
SURE/utils/queue.py,sha256=E_5PA5EWcBoGAZj8BkKQnkCK0p4C-4-xcTPqdIXaPXU,1892
|
|
19
19
|
SURE/utils/utils.py,sha256=IUHjDDtYaAYllCWsZyIzqQwaLul6fJRvHRH4vIYcR-c,8462
|
|
20
|
-
sure_tools-2.1.
|
|
21
|
-
sure_tools-2.1.
|
|
22
|
-
sure_tools-2.1.
|
|
23
|
-
sure_tools-2.1.
|
|
24
|
-
sure_tools-2.1.
|
|
25
|
-
sure_tools-2.1.
|
|
20
|
+
sure_tools-2.1.42.dist-info/licenses/LICENSE,sha256=TFHKwmrAViXQbSX5W-NDItkWFjm45HWOeUniDrqmnu0,1065
|
|
21
|
+
sure_tools-2.1.42.dist-info/METADATA,sha256=hwV5P2BtOm4qQ-v0seI9yavlU5zNiHr0_jKovfBl-0E,2651
|
|
22
|
+
sure_tools-2.1.42.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
23
|
+
sure_tools-2.1.42.dist-info/entry_points.txt,sha256=-nJI8rVe_qqrR0HmfAODzj-JNfEqCcSsyVh6okSqyHk,83
|
|
24
|
+
sure_tools-2.1.42.dist-info/top_level.txt,sha256=BtFTebdiJeqra4r6mm-uEtwVRFLZ_IjYsQ7OnalrOvY,5
|
|
25
|
+
sure_tools-2.1.42.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|