INNER CODE UNIT · Python

FR

SalvatoreRa/tutorial · machine learning/scripts/MCAR.py:181

            FR= np.sum(FR)
            print(FR)
            WA = metrics.dist_wasserstein(pd.DataFrame(np.array(df.iloc[:, :-1])[train_index]), 
                           pd.DataFrame(X_train_imp), pd.DataFrame(df_mask))
            WA= np.sum(WA)
            print(WA)

            m = [j, ms, perc, 'Mean', accuracy_score(y_test, y_test_pred), mae, 
                RMSR, KL, E, FR, WA, time.time() - algo_time]
            results.loc[len(results)] = m

            #### Imputing with the Median
            # we are using here just the median, the principle is the same for the mean
            # we are using the median because is common method
            print('Imputation with Median')
            imp = SimpleImputer(missing_values=np.nan, strategy='median')
            imp.fit(X_train)
            X_train_imp =imp.transform(X_train)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…