combatlearn 1.1.1__py3-none-any.whl → 1.1.2__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.
- combatlearn/__init__.py +1 -1
- combatlearn/combat.py +4 -6
- {combatlearn-1.1.1.dist-info → combatlearn-1.1.2.dist-info}/METADATA +1 -2
- combatlearn-1.1.2.dist-info/RECORD +7 -0
- combatlearn-1.1.1.dist-info/RECORD +0 -7
- {combatlearn-1.1.1.dist-info → combatlearn-1.1.2.dist-info}/WHEEL +0 -0
- {combatlearn-1.1.1.dist-info → combatlearn-1.1.2.dist-info}/licenses/LICENSE +0 -0
- {combatlearn-1.1.1.dist-info → combatlearn-1.1.2.dist-info}/top_level.txt +0 -0
combatlearn/__init__.py
CHANGED
combatlearn/combat.py
CHANGED
|
@@ -828,8 +828,7 @@ class ComBatModel:
|
|
|
828
828
|
"""Chen et al. (2022) CovBat."""
|
|
829
829
|
self._fit_fortin(X, batch, disc, cont)
|
|
830
830
|
X_meanvar_adj = self._transform_fortin(X, batch, disc, cont)
|
|
831
|
-
|
|
832
|
-
pca = PCA(svd_solver="full", whiten=False).fit(X_centered)
|
|
831
|
+
pca = PCA(svd_solver="full", whiten=False).fit(X_meanvar_adj)
|
|
833
832
|
|
|
834
833
|
# Determine number of components based on threshold type
|
|
835
834
|
if isinstance(self.covbat_cov_thresh, int):
|
|
@@ -841,7 +840,7 @@ class ComBatModel:
|
|
|
841
840
|
self._covbat_pca = pca
|
|
842
841
|
self._covbat_n_pc = n_pc
|
|
843
842
|
|
|
844
|
-
scores = pca.transform(
|
|
843
|
+
scores = pca.transform(X_meanvar_adj)[:, :n_pc]
|
|
845
844
|
scores_df = pd.DataFrame(scores, index=X.index, columns=[f"PC{i + 1}" for i in range(n_pc)])
|
|
846
845
|
self._batch_levels_pc = self._batch_levels
|
|
847
846
|
n_per_batch = self._n_per_batch
|
|
@@ -1091,8 +1090,7 @@ class ComBatModel:
|
|
|
1091
1090
|
) -> pd.DataFrame:
|
|
1092
1091
|
"""Chen transform implementation."""
|
|
1093
1092
|
X_meanvar_adj = self._transform_fortin(X, batch, disc, cont)
|
|
1094
|
-
|
|
1095
|
-
scores = self._covbat_pca.transform(X_centered)
|
|
1093
|
+
scores = self._covbat_pca.transform(X_meanvar_adj)
|
|
1096
1094
|
n_pc = self._covbat_n_pc
|
|
1097
1095
|
scores_adj = scores.copy()
|
|
1098
1096
|
|
|
@@ -1109,7 +1107,7 @@ class ComBatModel:
|
|
|
1109
1107
|
else:
|
|
1110
1108
|
scores_adj[idx, :n_pc] = (scores_adj[idx, :n_pc] - g) / np.sqrt(d)
|
|
1111
1109
|
|
|
1112
|
-
X_recon = self._covbat_pca.inverse_transform(scores_adj)
|
|
1110
|
+
X_recon = self._covbat_pca.inverse_transform(scores_adj)
|
|
1113
1111
|
return pd.DataFrame(X_recon, index=X.index, columns=X.columns)
|
|
1114
1112
|
|
|
1115
1113
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: combatlearn
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
4
4
|
Summary: Batch-effect harmonization for machine learning frameworks.
|
|
5
5
|
Author-email: Ettore Rocchi <ettoreroc@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -36,7 +36,6 @@ Dynamic: license-file
|
|
|
36
36
|
[](https://www.python.org/)
|
|
37
37
|
[](https://github.com/EttoreRocchi/combatlearn/actions/workflows/test.yaml)
|
|
38
38
|
[](https://combatlearn.readthedocs.io)
|
|
39
|
-
[](https://pepy.tech/projects/combatlearn)
|
|
40
39
|
[](https://pypi.org/project/combatlearn/)
|
|
41
40
|
[](https://github.com/EttoreRocchi/combatlearn/blob/main/LICENSE)
|
|
42
41
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
combatlearn/__init__.py,sha256=pxEMfuu86HIeV9w-7ODj__98E66YVgD_Zv9iNPKaVKk,100
|
|
2
|
+
combatlearn/combat.py,sha256=Bk1qlJe2THui1WMMyIzOAAR9x655MiSu93hnhl1PGUk,58852
|
|
3
|
+
combatlearn-1.1.2.dist-info/licenses/LICENSE,sha256=O34CBRTmdL59PxDYOa6nq1N0-2A9xyXGkBXKbsL1NeY,1070
|
|
4
|
+
combatlearn-1.1.2.dist-info/METADATA,sha256=q8cO7ftorW5ESGU9QnDk4F0FJ6_cC_Nl9NZoMVo1Q_I,8978
|
|
5
|
+
combatlearn-1.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
6
|
+
combatlearn-1.1.2.dist-info/top_level.txt,sha256=3cFQv4oj2sh_NKra45cPy8Go0v8W9x9-zkkUibqZCMk,12
|
|
7
|
+
combatlearn-1.1.2.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
combatlearn/__init__.py,sha256=ETYsrj1yK76UxKS8bfnTkzx5XPnk18XsNEgr-6tu6YY,100
|
|
2
|
-
combatlearn/combat.py,sha256=oiDtJv87PWRJHsWZVZfZ9_uLZbmzS0zl7j128kxIKdY,58992
|
|
3
|
-
combatlearn-1.1.1.dist-info/licenses/LICENSE,sha256=O34CBRTmdL59PxDYOa6nq1N0-2A9xyXGkBXKbsL1NeY,1070
|
|
4
|
-
combatlearn-1.1.1.dist-info/METADATA,sha256=ujWyvXi1loi_9Y6Qp-uP9HXUmrM_PPrKaM6Bnc1UfOU,9082
|
|
5
|
-
combatlearn-1.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
6
|
-
combatlearn-1.1.1.dist-info/top_level.txt,sha256=3cFQv4oj2sh_NKra45cPy8Go0v8W9x9-zkkUibqZCMk,12
|
|
7
|
-
combatlearn-1.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|