コード例 #1
0
 def test_ttest_one_target(self, idadf):
     data = idadf._table_def() 
     columns = list(data.loc[data['VALTYPE'] == "NUMERIC"].index)
     if len(columns) > 1:
         result = ttest(idadf, target = columns[0])
         assert(isinstance(result, pandas.core.series.Series))
         assert(len(result) == (len(columns)-1))
コード例 #2
0
 def test_ttest_one_target(self, idadf):
     data = idadf._table_def()
     columns = list(data.loc[data['VALTYPE'] == "NUMERIC"].index)
     if len(columns) > 1:
         result = ttest(idadf, target=columns[0])
         assert (isinstance(result, pandas.core.series.Series))
         assert (len(result) == (len(columns) - 1))
コード例 #3
0
 def test_ttest_multiple_target(self, idadf):
     data = idadf._table_def() 
     columns = list(data.loc[data['VALTYPE'] == "NUMERIC"].index)
     if len(columns) > 1:
         result = ttest(idadf, target = [columns[0],columns[1]])
         assert(isinstance(result, pandas.core.frame.DataFrame))
         assert(len(result.columns) == 2)
         assert(len(result.index) == len(columns))
コード例 #4
0
 def test_ttest_multiple_target(self, idadf):
     data = idadf._table_def()
     columns = list(data.loc[data['VALTYPE'] == "NUMERIC"].index)
     if len(columns) > 1:
         result = ttest(idadf, target=[columns[0], columns[1]])
         assert (isinstance(result, pandas.core.frame.DataFrame))
         assert (len(result.columns) == 2)
         assert (len(result.index) == len(columns))
コード例 #5
0
 def test_ttest_default(self, idadf):
     data = idadf._table_def() 
     columns = list(data.loc[data['VALTYPE'] == "NUMERIC"].index)
     if len(columns) > 1:
         result = ttest(idadf, features = columns)
         assert(isinstance(result, pandas.core.frame.DataFrame))
         assert(len(result.columns) == len(columns))
         assert(len(result.index) == len(columns))
         result = result.fillna(0) # np.nan values are not equal when compared
         result = result[result.index]
         assert(all(result != result.T)) # asymmetry
コード例 #6
0
 def test_ttest_default(self, idadf):
     data = idadf._table_def()
     columns = list(data.loc[data['VALTYPE'] == "NUMERIC"].index)
     if len(columns) > 1:
         result = ttest(idadf, features=columns)
         assert (isinstance(result, pandas.core.frame.DataFrame))
         assert (len(result.columns) == len(columns))
         assert (len(result.index) == len(columns))
         result = result.fillna(
             0)  # np.nan values are not equal when compared
         result = result[result.index]
         assert (all(result != result.T))  # asymmetry
コード例 #7
0
 def test_ttest_valueError(self, idadf):
     data = idadf._table_def() 
     columns = list(data.loc[data['VALTYPE'] != "NUMERIC"].index)
     if len(columns) > 0: # Raise no numerical features
         with pytest.raises(ValueError):
             ttest(idadf, features = columns)
     if len(idadf.columns) > 0: 
         with pytest.raises(ValueError): # Cannot compute correlation coefficients of only one column (...), need at least 2
             ttest(idadf, features = idadf.columns[0])
         with pytest.raises(ValueError): # The correlation value of two same columns is always maximal
             ttest(idadf, target= idadf.columns[0], features = idadf.columns[0])
コード例 #8
0
 def test_ttest_valueError(self, idadf):
     data = idadf._table_def()
     columns = list(data.loc[data['VALTYPE'] != "NUMERIC"].index)
     if len(columns) > 0:  # Raise no numerical features
         with pytest.raises(ValueError):
             ttest(idadf, features=columns)
     if len(idadf.columns) > 0:
         with pytest.raises(
                 ValueError
         ):  # Cannot compute correlation coefficients of only one column (...), need at least 2
             ttest(idadf, features=idadf.columns[0])
         with pytest.raises(
                 ValueError
         ):  # The correlation value of two same columns is always maximal
             ttest(idadf,
                   target=idadf.columns[0],
                   features=idadf.columns[0])
コード例 #9
0
 def test_ttest_one_target_one_feature(self, idadf):
     data = idadf._table_def() 
     columns = list(data.loc[data['VALTYPE'] == "NUMERIC"].index)
     if len(columns) > 1:
         result = ttest(idadf, target = columns[0], features=[columns[1]])
         assert(isinstance(result, float))
コード例 #10
0
 def test_ttest_TypeError(self, idadf):
     data = idadf._table_def() 
     columns = list(data.loc[data['VALTYPE'] != "NUMERIC"].index)
     if len(columns) > 1:
         with pytest.raises(TypeError):
             ttest(idadf, features = columns)
コード例 #11
0
 def test_ttest_one_target_one_feature(self, idadf):
     data = idadf._table_def()
     columns = list(data.loc[data['VALTYPE'] == "NUMERIC"].index)
     if len(columns) > 1:
         result = ttest(idadf, target=columns[0], features=[columns[1]])
         assert (isinstance(result, float))
コード例 #12
0
 def test_ttest_TypeError(self, idadf):
     data = idadf._table_def()
     columns = list(data.loc[data['VALTYPE'] != "NUMERIC"].index)
     if len(columns) > 1:
         with pytest.raises(TypeError):
             ttest(idadf, features=columns)