def impute_datawig_iterative(X, mask): X_incomplete = X.copy() X_incomplete[mask] = np.nan df = pd.DataFrame(X_incomplete) df.columns = [str(c) for c in df.columns] df = SimpleImputer.complete(df, hpo=False, verbose=0, iterations=5) mse = evaluate_mse(df.values, X, mask) return mse
def impute_datawig(X, mask): X_incomplete = X.copy() X_incomplete[mask] = np.nan df = pd.DataFrame(X_incomplete) df.columns = [str(c) for c in df.columns] dw_dir = os.path.join(DIR_PATH,'datawig_imputers') df = SimpleImputer.complete(df, output_path=dw_dir, hpo=True, verbose=0, iterations=1) for d in glob.glob(os.path.join(dw_dir,'*')): shutil.rmtree(d) mse = evaluate_mse(df.values, X, mask) return mse