Skip to content

Commit

Permalink
More f prints
Browse files Browse the repository at this point in the history
  • Loading branch information
niklases committed Nov 20, 2024
1 parent 5d48bd6 commit d9eaf68
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ datasets/ANEH/ML_Model_Performance_WEBA780101_ELASTICNET.png
datasets/ANEH/ML_Model_Performance_WEBA780101_PLS_LOOCV.png
datasets/ANEH/ML_Model_Performance_WEBA780101_PLS.png
datasets/ANEH/ML_Model_Performance_WEBA780101_RIDGE.png
datasets/ANEH/ML_Model_Performance_CHAM830104_PLS_LOOCV.png
datasets/ANEH/ML_Model_Performance_OOBM850104_PLS_LOOCV.png
datasets/ANEH/ml_pls_37_ANEH_variants_aaidx_encoded_train_concat_lvls_extrapolation.png
datasets/ANEH/ml_pls_37_ANEH_variants_aaidx_encoded_train_lvl_1_extrapolation.png
datasets/ANEH/ml_pls_37_ANEH_variants_gremlin_dca_encoded_train_concat_lvls_extrapolation.png
Expand Down Expand Up @@ -250,6 +252,11 @@ datasets/ANEH/CV_performance/WEBA780101_PLS_LOOCV_5-fold-CV.png
datasets/ANEH/CV_performance/WEBA780101_PLS_LOOCV_CV_Results.txt
datasets/ANEH/CV_performance/WEBA780101_RIDGE_5-fold-CV.png
datasets/ANEH/CV_performance/WEBA780101_RIDGE_CV_Results.txt
datasets/ANEH/CV_performance/CHAM830104_PLS_LOOCV_5-fold-CV.png
datasets/ANEH/CV_performance/CHAM830104_PLS_LOOCV_CV_Results.txt
datasets/ANEH/CV_performance/OOBM850104_PLS_LOOCV_5-fold-CV.png
datasets/ANEH/CV_performance/OOBM850104_PLS_LOOCV_CV_Results.txt
datasets/ANEH/Pickles/OOBM850104
datasets/ANEH/Diverse_Double_Split/Diverse_Double_Split1.fasta
datasets/ANEH/Diverse_Double_Split/Predictions_FAUJ880104_TopDiverse_Double_Split.txt
datasets/ANEH/Diverse_Double_Split/Predictions_MLgremlin_TopDiverse_Double_Split.txt
Expand Down
1 change: 1 addition & 0 deletions pypef/dca/gremlin_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ def plot_predicted_ssm(gremlin: GREMLIN):
wt_score = gremlin.get_wt_score()[0]
aas = "".join(sorted(gremlin.char_alphabet.replace("-", "")))
variantss, variant_sequencess, variant_scoress = [], [], []
logger.info("Predicting all SSM effects using the unsupervised GREMLIN model...")
for i, aa_wt in enumerate(tqdm(wt_sequence)):
variants, variant_sequences, variant_scores = [], [], []
for aa_sub in aas:
Expand Down
17 changes: 8 additions & 9 deletions pypef/ml/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,11 +649,11 @@ def formatted_output(
for (idx, val, val2, val3, val4, val5, r_m, pam) in performance_list:
if val >= minimum_r2:
index.append(get_basename(idx))
value.append('{:f}'.format(val))
value2.append('{:f}'.format(val2))
value3.append('{:f}'.format(val3))
value4.append('{:f}'.format(val4))
value5.append('{:f}'.format(val5))
value.append(f'{val:.6f}')
value2.append(f'{val2:.6f}')
value3.append(f'{val3:.6f}')
value4.append(f'{val4:.6f}')
value5.append(f'{val5:.6f}')
regression_model.append(r_m.upper())
params.append(pam)

Expand Down Expand Up @@ -853,10 +853,9 @@ def crossval_on_all(x_train, x_test, y_train, y_test, regressor: str, parameter,
get_performances(y_test_total, y_predicted_total)

with open(cv_filename, 'a') as f:
f.write('Regression type: {}; Parameter: {}; Encoding index: {}\n'.format(
regressor.upper(), parameter, name))
f.write('R2 = {:.5f}; RMSE = {:.5f}; NRMSE = {:.5f}; Pearson\'s r = {:.5f};'
' Spearman\'s rho = {:.5f}\n\n'.format(r_squared, rmse, nrmse, pearson_r, spearman_rho))
f.write(f'Regression type: {regressor.upper()}; Parameter: {parameter}; Encoding index: {name}\n')
f.write(f'R2 = {r_squared:.6f}; RMSE = {rmse:.6f}; NRMSE = {nrmse:.6f}; Pearson\'s r = {pearson_r:.6f}; '
f'Spearman\'s rho = {spearman_rho:.6f}\n\n')

figure, ax = plt.subplots()
legend = r'$R^2$' + f' = {r_squared:.3f}' + f'\nRMSE = {rmse:.3f}' + f'\nNRMSE = {nrmse:.3f}' + \
Expand Down
Empty file modified scripts/CLI/run_cli_tests_linux.sh
100644 → 100755
Empty file.

0 comments on commit d9eaf68

Please sign in to comment.