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))
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))
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))
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))
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
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
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])
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])
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))
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)
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))
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)