Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_check_feature_subset_file_no_sign_column(self):
feature_specs = pd.DataFrame({'feature': ['f1', 'f2', 'f3'],
'subset1': [0, 1, 0]})
FeatureSubsetProcessor.check_feature_subset_file(feature_specs, sign='subset1')
def test_check_feature_subset_file_multiple_sign_columns(self):
feature_specs = pd.DataFrame({'feature': ['f1', 'f2', 'f3'],
'sign_SYS': ['+', '-', '+'],
'Sign_SYS': ['-', '+', '-']})
FeatureSubsetProcessor.check_feature_subset_file(feature_specs,
sign='SYS')
def test_check_feature_subset_file_sign_named_with_Sign(self):
feature_specs = pd.DataFrame({'feature': ['f1', 'f2', 'f3'],
'Sign_SYS': ['+', '-', '+']})
FeatureSubsetProcessor.check_feature_subset_file(feature_specs,
sign='SYS')
def test_check_feature_subset_file_no_subset_column(self):
feature_specs = pd.DataFrame({'Feature': ['f1', 'f2', 'f3'], 'subset1': [0, 1, 0]})
FeatureSubsetProcessor.check_feature_subset_file(feature_specs, 'subset2')
def test_check_feature_subset_file_sign_named_with_sign(self):
feature_specs = pd.DataFrame({'feature': ['f1', 'f2', 'f3'],
'sign_SYS': ['+', '-', '+']})
FeatureSubsetProcessor.check_feature_subset_file(feature_specs,
sign='SYS')
def test_check_feature_subset_file_subset_only(self):
feature_specs = pd.DataFrame({'feature': ['f1', 'f2', 'f3'],
'subset1': [0, 1, 0]})
FeatureSubsetProcessor.check_feature_subset_file(feature_specs, 'subset1')
def test_check_feature_subset_file_wrong_values_in_sign(self):
feature_specs = pd.DataFrame({'Feature': ['f1', 'f2', 'f3'],
'sign_SYS1': ['+1', '-1', '+1']})
FeatureSubsetProcessor.check_feature_subset_file(feature_specs, sign='SYS1')
def test_check_feature_subset_file_sign_named_something_else(self):
feature_specs = pd.DataFrame({'feature': ['f1', 'f2', 'f3'],
'SYS_sign': ['+', '-', '+']})
FeatureSubsetProcessor.check_feature_subset_file(feature_specs,
sign='SYS')
special_report_sections,
custom_report_sections,
section_order,
subgroups,
model_type=model_type,
context='rsmtool')
# Location of feature file
feature_field = config_obj['features']
feature_subset_field = config_obj['feature_subset']
# if the user requested feature_subset file and feature subset,
# read the file and check its format
if feature_subset is not None and feature_subset_field:
FeatureSubsetProcessor.check_feature_subset_file(feature_subset)
# Do we need to automatically find the best transformations/change sign?
select_transformations = config_obj['select_transformations']
feature_sign = config_obj['sign']
requested_features = []
generate_feature_specs_automatically = True
# if the feature field is a list, then simply
# assign it to `requested_features`
if isinstance(feature_field, list):
requested_features = feature_field
elif feature_field is not None:
generate_feature_specs_automatically = False
feature_specs = FeatureSpecsProcessor.validate_feature_specs(feature_specs,
use_truncations)