From f2e4a816a52457ebf12d5fd7c354e5140164a960 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 13 Aug 2024 19:55:10 +0100 Subject: [PATCH] Fix Bugs in MNAR mechanism in both univariate and multivariate --- setup.py | 2 +- src/mdatagen/multivariate/mMNAR.py | 8 ++++---- src/mdatagen/univariate/uMNAR.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 77ce7eb..e84e792 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name='mdatagen', - version='0.1.61', + version='0.1.62', keywords=['machine learning', 'preprocessing data'], packages=find_packages(where="src"), package_dir={"": "src"}, diff --git a/src/mdatagen/multivariate/mMNAR.py b/src/mdatagen/multivariate/mMNAR.py index 84f555f..0bcbabe 100644 --- a/src/mdatagen/multivariate/mMNAR.py +++ b/src/mdatagen/multivariate/mMNAR.py @@ -109,7 +109,7 @@ def random(self, missing_rate: int = 10, deterministic:bool = False): x_miss = np.random.choice(options_xmiss) if x_miss not in xmiss_multiva: - x_f = self.dataset.loc[:, x_miss].values + x_f = self.dataset.loc[:, x_miss] if deterministic: # Observed feature @@ -184,7 +184,7 @@ def correlated(self, missing_rate: int = 10, deterministic:bool = False): N = round(len(self.dataset) * cutK) - x_f = self.dataset.loc[:, x_miss].values + x_f = self.dataset.loc[:, x_miss] if deterministic: # Observed feature @@ -267,9 +267,9 @@ def median(self, missing_rate: int = 10, deterministic:bool = False): choice = np.random.choice([0, 1]) if choice == 0: - x_f = self.dataset.loc[g1_index, col].values + x_f = self.dataset.loc[g1_index, col] else: - x_f = self.dataset.loc[g2_index, col].values + x_f = self.dataset.loc[g2_index, col] if deterministic: # Observed feature diff --git a/src/mdatagen/univariate/uMNAR.py b/src/mdatagen/univariate/uMNAR.py index b3bf144..e8fd271 100644 --- a/src/mdatagen/univariate/uMNAR.py +++ b/src/mdatagen/univariate/uMNAR.py @@ -91,7 +91,7 @@ def run(self, deterministic:bool = False): """ - x_f = self.dataset.loc[:, self.x_miss].values + x_f = self.dataset.loc[:, self.x_miss] if deterministic: # Observed feature