Commit 4aa5f0d8 authored by Aneesh Pappu's avatar Aneesh Pappu
Browse files

fixing tests

parent d0d5ca83
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ class StratifiedSplitter(Splitter):
        index_list = self.__generate_required_index(w, required_hits_list)
        X_train = X_test = X
        y_train = y_test = y
        w_train = w_test = np.zeroes(w.shape)
        w_train = w_test = np.zeros(w.shape)
        ids_train = ids_test = ids

        #chunk appropriate values into weights matrices
@@ -146,8 +146,8 @@ class StratifiedSplitter(Splitter):
          w_test[index:, colIndex] = w[index:, colIndex]

        #check out if any rows in either w_train or w_test are just zeros
        rowsToKeepTrain = np.where(w_train.any(axis=1))[0]
        rowsToKeepTest = np.where(w_test.any(axis=1))[0]
        rowsToKeepTrain = w_train.any(axis=1)
        rowsToKeepTest = w_test.any(axis=1)

        #prune train sets
        w_train = w_train[rowsToKeepTrain]
+3 −8
Original line number Diff line number Diff line
@@ -130,15 +130,10 @@ class TestSplitters(TestDatasetAPI):
        datasets = [train_data, valid_data, test_data]
        datasetIndex = 0
        for dataset in datasets:
            np_list = dataset.to_numpy()
            y = np_list[1]
            X, y, w, ids = dataset.to_numpy()
            # verify that each task in the train dataset has some hits
            y_df = pd.DataFrame(data=y)
            totalRows = len(y_df.index)
            for col in y_df:
                column = y_df[col]
                NaN_count = column.isnull().sum()
                if NaN_count == totalRows:
            for col in w.T:
                if not np.any(col):
                    print("fail -- one column doesn't have results")
                    if datasetIndex == 0:
                        print("train_data failed")