def test_feature_selection_target_binary_features_binary( self, minimal_p_value_for_unsignificant_features, binary_feature, binary_target_not_related): """ Test if the p_value returned by target_binary_feature_binary_test is large enough for highly unsignificant features. """ p_value = target_binary_feature_binary_test(binary_feature, binary_target_not_related) assert minimal_p_value_for_unsignificant_features < p_value
def test_feature_selection_target_binary_features_binary( self, maximal_p_value_for_significant_features, binary_feature): """ Test if the p_value returned by target_binary_feature_binary_test is low enough for highly significant features. """ y = binary_feature - pd.Series( np.random.binomial(1, 0.1, 250) + np.random.binomial(1, 0.1, 250)) y[y == -1] = 0 y[y == -2] = 0 y[y == 2] = 1 p_value = target_binary_feature_binary_test(binary_feature, y) assert maximal_p_value_for_significant_features > p_value
def test_checks_target_is_series(self, binary_series): with pytest.raises(TypeError): target_binary_feature_binary_test(x=binary_series, y=binary_series.values)
def test_checks_target_nan(self, binary_series_with_nan, binary_series): with pytest.raises(ValueError): target_binary_feature_binary_test(x=binary_series, y=binary_series_with_nan)
def test_checks_target_is_binary(self, binary_series, real_series): with pytest.raises(ValueError): target_binary_feature_binary_test(x=binary_series, y=real_series)