Skip to content

Commit

Permalink
Added whitespace based on the suggestion from Stuart.
Browse files Browse the repository at this point in the history
"for consistency with other tools changed '-------taxa_' to '------ taxa_' "
  • Loading branch information
kspruthviraj committed Jul 28, 2022
1 parent 8d33f51 commit 3e27844
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions utils/model_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,16 +379,16 @@ def run_prediction_on_unseen(self, test_main, data_loader, name):

if test_main.params.threshold > 0:
print('I am using threshold value as : {}'.format(test_main.params.threshold))
To_write = [i + '------------------' + j + '\n' for i, j in zip(im_names[0], output_label)]
To_write = [i + '------------------ ' + j + '\n' for i, j in zip(im_names[0], output_label)]
np.savetxt(test_main.params.test_outpath + '/Single_model_Plankiformer_predictions.txt', To_write,
fmt='%s')

To_write = [i + '------------------' + j + '\n' for i, j in zip(im_names[0], output_corrected_label)]
To_write = [i + '------------------ ' + j + '\n' for i, j in zip(im_names[0], output_corrected_label)]
np.savetxt(test_main.params.test_outpath + '/Single_model_Plankiformer_predictions_thresholded.txt',
To_write, fmt='%s')
else:
print('I am using default value as threshold i.e. 0')
To_write = [i + '------------------' + j + '\n' for i, j in zip(im_names[0], output_label)]
To_write = [i + '------------------ ' + j + '\n' for i, j in zip(im_names[0], output_label)]
np.savetxt(test_main.params.test_outpath + '/Single_model_Plankiformer_predictions.txt', To_write,
fmt='%s')

Expand Down Expand Up @@ -453,16 +453,16 @@ def run_ensemble_prediction_on_unseen(self, test_main, data_loader, name):

if test_main.params.threshold > 0:
print('I am using threshold value as : {}'.format(test_main.params.threshold))
To_write = [i + '------------------' + j + '\n' for i, j in zip(im_names[0], Ens_DEIT_label)]
To_write = [i + '------------------ ' + j + '\n' for i, j in zip(im_names[0], Ens_DEIT_label)]
np.savetxt(test_main.params.test_outpath + '/Ensemble_models_Plankiformer_predictions_' + name2 + name +
'.txt', To_write, fmt='%s')

To_write = [i + '------------------' + j + '\n' for i, j in zip(im_names[0], Ens_DEIT_corrected_label)]
To_write = [i + '------------------ ' + j + '\n' for i, j in zip(im_names[0], Ens_DEIT_corrected_label)]
np.savetxt(test_main.params.test_outpath + '/Ensemble_models_Plankiformer_predictions_' + name2 + name +
'_thresholded.txt', To_write, fmt='%s')
else:
print('I am using default value as threshold i.e. 0')
To_write = [i + '------------------' + j + '\n' for i, j in zip(im_names[0], Ens_DEIT_label)]
To_write = [i + '------------------ ' + j + '\n' for i, j in zip(im_names[0], Ens_DEIT_label)]
np.savetxt(test_main.params.test_outpath + '/Ensemble_models_Plankiformer_predictions_' + name2 + name +
'.txt', To_write, fmt='%s')

Expand Down Expand Up @@ -520,17 +520,17 @@ def run_prediction_on_unseen_with_y(self, test_main, data_loader, name):

if test_main.params.threshold > 0:
print('I am using threshold value as : {}'.format(test_main.params.threshold))
To_write = [i + '------------------' + j + '\n' for i, j in zip(im_names[0], output_label)]
To_write = [i + '------------------ ' + j + '\n' for i, j in zip(im_names[0], output_label)]
np.savetxt(test_main.params.test_outpath + '/Single_model_Plankiformer_predictions.txt', To_write,
fmt='%s')

To_write = [i + '------------------' + j + '\n' for i, j in zip(im_names[0], output_corrected_label)]
To_write = [i + '------------------ ' + j + '\n' for i, j in zip(im_names[0], output_corrected_label)]
np.savetxt(test_main.params.test_outpath + '/Single_model_Plankiformer_predictions_thresholded.txt',
To_write, fmt='%s')

else:
print('I am using default value as threshold i.e. 0')
To_write = [i + '------------------' + j + '\n' for i, j in zip(im_names[0], output_label)]
To_write = [i + '------------------ ' + j + '\n' for i, j in zip(im_names[0], output_label)]
np.savetxt(test_main.params.test_outpath + '/Single_model_Plankiformer_predictions.txt', To_write,
fmt='%s')

Expand Down Expand Up @@ -618,7 +618,7 @@ def run_ensemble_prediction_on_unseen_with_y(self, test_main, data_loader, name)
print('I am using threshold value as : {}'.format(test_main.params.threshold))

## Original
To_write = [i + '------------------' + j + '\n' for i, j in zip(im_names[0], Ens_DEIT_label)]
To_write = [i + '------------------ ' + j + '\n' for i, j in zip(im_names[0], Ens_DEIT_label)]
np.savetxt(test_main.params.test_outpath + '/Ensemble_models_predictions_' + name2 + name +
'.txt', To_write, fmt='%s')

Expand All @@ -645,7 +645,7 @@ def run_ensemble_prediction_on_unseen_with_y(self, test_main, data_loader, name)

## Thresholded

To_write = [i + '------------------' + j + '\n' for i, j in zip(im_names[0], Ens_DEIT_corrected_label)]
To_write = [i + '------------------ ' + j + '\n' for i, j in zip(im_names[0], Ens_DEIT_corrected_label)]
np.savetxt(test_main.params.test_outpath + '/Ensemble_models_predictions_' + name2 + name +
'_thresholded_' + str(test_main.params.threshold) + '.txt', To_write, fmt='%s')

Expand Down Expand Up @@ -675,7 +675,7 @@ def run_ensemble_prediction_on_unseen_with_y(self, test_main, data_loader, name)

else:
print('I am using default value as threshold i.e. 0')
To_write = [i + '------------------' + j + '\n' for i, j in zip(im_names[0], Ens_DEIT_label)]
To_write = [i + '------------------ ' + j + '\n' for i, j in zip(im_names[0], Ens_DEIT_label)]
np.savetxt(test_main.params.test_outpath + '/Ensemble_models_predictions_' + name2 + name +
'.txt', To_write, fmt='%s')

Expand Down

0 comments on commit 3e27844

Please sign in to comment.