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_run_experiment_predict_no_output_dir():
'''
rsmpredict experiment where experiment_dir
does not containt output directory
'''
source = 'lr-predict-no-output-dir'
config_file = join(rsmtool_test_dir,
'data',
'experiments',
source,
'rsmpredict.json')
do_run_prediction(source, config_file)
def test_run_experiment_predict_no_output_dir():
# rsmpredict experiment where experiment_dir
# does not containt output directory
source = 'lr-predict-no-output-dir'
config_file = join(test_dir,
'data',
'experiments',
source,
'rsmpredict.json')
do_run_prediction(source, config_file)
def test_run_experiment_lr_predict_with_candidate():
# basic experiment using rsmpredict with candidate column
source = 'lr-predict-with-candidate'
config_file = join(test_dir,
'data',
'experiments',
source,
'rsmpredict.json')
do_run_prediction(source, config_file)
output_dir = join('test_outputs', source, 'output')
expected_output_dir = join(test_dir, 'data', 'experiments', source, 'output')
for csv_file in ['predictions.csv', 'preprocessed_features.csv']:
output_file = join(output_dir, csv_file)
expected_output_file = join(expected_output_dir, csv_file)
yield check_csv_output, output_file, expected_output_file
def test_run_experiment_predict_expected_scores_builtin_model():
'''
rsmpredict experiment for expected scores but with
a built-in model which is not supporte
'''
source = 'lr-predict-expected-scores-builtin-model'
config_file = join(rsmtool_test_dir,
'data',
'experiments',
source,
'rsmpredict.json')
do_run_prediction(source, config_file)
def test_run_experiment_lr_predict_with_score():
# rsmpredict experiment with human score
source = 'lr-predict-with-score'
config_file = join(test_dir,
'data',
'experiments',
source,
'rsmpredict.json')
do_run_prediction(source, config_file)
output_dir = join('test_outputs', source, 'output')
expected_output_dir = join(test_dir, 'data', 'experiments', source, 'output')
for csv_file in ['predictions.csv', 'preprocessed_features.csv']:
output_file = join(output_dir, csv_file)
expected_output_file = join(expected_output_dir, csv_file)
yield check_csv_output, output_file, expected_output_file
def test_run_experiment_lr_predict_missing_postprocessing_file():
# rsmpredict experiment with missing post-processing file
source = 'lr-predict-missing-postprocessing-file'
config_file = join(test_dir,
'data',
'experiments',
source,
'rsmpredict.json')
do_run_prediction(source, config_file)
def test_run_experiment_predict_no_experiment_id():
# rsmpredict experiment ehere the experiment_dir
# does not contain the experiment with the stated id
source = 'lr-predict-no-experiment-id'
config_file = join(test_dir,
'data',
'experiments',
source,
'rsmpredict.json')
do_run_prediction(source, config_file)
def test_run_experiment_lr_predict_tsv_input_files():
# rsmpredict experiment with input file in .tsv format
source = 'lr-predict-tsv-input-files'
config_file = join(test_dir,
'data',
'experiments',
source,
'rsmpredict.json')
do_run_prediction(source, config_file)
output_dir = join('test_outputs', source, 'output')
expected_output_dir = join(test_dir, 'data', 'experiments', source, 'output')
for csv_file in ['predictions.csv', 'preprocessed_features.csv']:
output_file = join(output_dir, csv_file)
expected_output_file = join(expected_output_dir, csv_file)
yield check_csv_output, output_file, expected_output_file
def test_run_experiment_lr_predict_missing_values():
# basic experiment using rsmpredict when the supplied feature file
# contains reponses with non-numeric feature values
source = 'lr-predict-missing-values'
config_file = join(test_dir,
'data',
'experiments',
source,
'rsmpredict.json')
do_run_prediction(source, config_file)
output_dir = join('test_outputs', source, 'output')
expected_output_dir = join(test_dir, 'data', 'experiments', source, 'output')
for csv_file in ['predictions.csv', 'predictions_excluded_responses.csv',
'preprocessed_features.csv']:
output_file = join(output_dir, csv_file)
expected_output_file = join(expected_output_dir, csv_file)
yield check_csv_output, output_file, expected_output_file
def test_run_experiment_lr_predict_no_numeric_feature_values():
'''
rsmpredict experiment with missing post-processing file
'''
source = 'lr-predict-no-numeric-feature-values'
config_file = join(rsmtool_test_dir,
'data',
'experiments',
source,
'rsmpredict.json')
do_run_prediction(source, config_file)