Skip to content

Commit

Permalink
Merge pull request #11 from Deep-Learning-and-Aging/fix_std
Browse files Browse the repository at this point in the history
Fix std
  • Loading branch information
theovincent authored Aug 4, 2021
2 parents 99aca67 + 2d551ee commit a3a58d0
Show file tree
Hide file tree
Showing 64 changed files with 3,348 additions and 1,405 deletions.
40 changes: 20 additions & 20 deletions .github/workflows/deploy_development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,30 @@ jobs:
AWS_SECRET_ACCESS_KEY:${{ secrets.GCP_PROJECT_ID }}/AWS_SECRET_ACCESS_KEY
- name: Download favicon.ico from AWS
uses: prewk/s3-cp-action@master
env:
AWS_ACCESS_KEY_ID: ${{ steps.gcp_secrets.outputs.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ steps.gcp_secrets.outputs.AWS_SECRET_ACCESS_KEY }}
SOURCE: 's3://age-prediction-site/favicon.ico'
DEST: './data/'
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ steps.gcp_secrets.outputs.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ steps.gcp_secrets.outputs.AWS_SECRET_ACCESS_KEY }}
source: 's3://age-prediction-site/favicon.ico'
dest: './data/'

- name: Download datasets/videos/ from AWS
uses: prewk/s3-cp-action@master
env:
AWS_ACCESS_KEY_ID: ${{ steps.gcp_secrets.outputs.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ steps.gcp_secrets.outputs.AWS_SECRET_ACCESS_KEY }}
SOURCE: 's3://age-prediction-site/datasets/videos/'
DEST: './data/datasets/videos/'
ENDPOINT_APPEND: --recursive
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ steps.gcp_secrets.outputs.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ steps.gcp_secrets.outputs.AWS_SECRET_ACCESS_KEY }}
source: 's3://age-prediction-site/datasets/videos/'
dest: './data/datasets/videos/'
flags: --recursive

- name: Download feature_importances/videos/ from AWS
uses: prewk/s3-cp-action@master
env:
AWS_ACCESS_KEY_ID: ${{ steps.gcp_secrets.outputs.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ steps.gcp_secrets.outputs.AWS_SECRET_ACCESS_KEY }}
SOURCE: 's3://age-prediction-site/feature_importances/videos/'
DEST: './data/feature_importances/videos/'
ENDPOINT_APPEND: --recursive
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ steps.gcp_secrets.outputs.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ steps.gcp_secrets.outputs.AWS_SECRET_ACCESS_KEY }}
source: 's3://age-prediction-site/feature_importances/videos/'
dest: './data/feature_importances/videos/'
flags: --recursive

- name: Build docker image
run: docker build -t local_gcr.io/age-prediction-306519/website:dev .
Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/deploy_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,30 @@ jobs:
AWS_SECRET_ACCESS_KEY:${{ secrets.GCP_PROJECT_ID }}/AWS_SECRET_ACCESS_KEY
- name: Download favicon.ico from AWS
uses: prewk/s3-cp-action@master
env:
AWS_ACCESS_KEY_ID: ${{ steps.gcp_secrets.outputs.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ steps.gcp_secrets.outputs.AWS_SECRET_ACCESS_KEY }}
SOURCE: 's3://age-prediction-site/favicon.ico'
DEST: './data/'
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ steps.gcp_secrets.outputs.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ steps.gcp_secrets.outputs.AWS_SECRET_ACCESS_KEY }}
source: 's3://age-prediction-site/favicon.ico'
dest: './data/'

- name: Download datasets/videos/ from AWS
uses: prewk/s3-cp-action@master
env:
AWS_ACCESS_KEY_ID: ${{ steps.gcp_secrets.outputs.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ steps.gcp_secrets.outputs.AWS_SECRET_ACCESS_KEY }}
SOURCE: 's3://age-prediction-site/datasets/videos/'
DEST: './data/datasets/videos/'
ENDPOINT_APPEND: --recursive
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ steps.gcp_secrets.outputs.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ steps.gcp_secrets.outputs.AWS_SECRET_ACCESS_KEY }}
source: 's3://age-prediction-site/datasets/videos/'
dest: './data/datasets/videos/'
flags: --recursive

- name: Download feature_importances/videos/ from AWS
uses: prewk/s3-cp-action@master
env:
AWS_ACCESS_KEY_ID: ${{ steps.gcp_secrets.outputs.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ steps.gcp_secrets.outputs.AWS_SECRET_ACCESS_KEY }}
SOURCE: 's3://age-prediction-site/feature_importances/videos/'
DEST: './data/feature_importances/videos/'
ENDPOINT_APPEND: --recursive
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ steps.gcp_secrets.outputs.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ steps.gcp_secrets.outputs.AWS_SECRET_ACCESS_KEY }}
source: 's3://age-prediction-site/feature_importances/videos/'
dest: './data/feature_importances/videos/'
flags: --recursive

- name: Build docker image
run: docker build -t local_gcr.io/age-prediction-306519/website:prod .
Expand Down
54 changes: 0 additions & 54 deletions clean_aws/age_prediction_performances/add_ci.py

This file was deleted.

60 changes: 40 additions & 20 deletions clean_aws/age_prediction_performances/scores.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,58 @@
from dash_website.pages.tools import load_csv
from dash_website.utils.aws_loader import load_csv, upload_file
import numpy as np


SAMPLE_DEFINITION_NAMING = {
"instances": "all_samples_per_participant",
"eids": "average_per_participant",
"*": "all_samples_when_possible_otherwise_average",
}
COLUMNS_TO_TAKE = {
"organ": "dimension",
"view": "subdimension",
"transformation": "sub_subdimension",
"architecture": "algorithm",
"N_all": "sample_size",
"RMSE_all": "rmse",
"RMSE_sd_all": "rmse_std",
"R-Squared_all": "r2",
"R-Squared_sd_all": "r2_std",
"R-Squared_str_all": "r2_and_std",
"C-Index_str_all": "c_index_and_std",
"RMSE_str_all": "rmse_and_std",
"C-Index-difference_str_all": "c_index_difference_and_std",
}
DICT_TO_CHANGE_DIMENSIONS = {"ImmuneSystem": "BloodCells"}
SELECTED_DIMENSIONS = {
"withEnsembles": "all_dimensions",
"tuned": "without_ensemble_models",
"bestmodels": "custom_dimensions",
DICT_TO_CHANGE_DIMENSIONS = {
"ImmuneSystem": "BloodCells",
"InceptionResNetV2": "inception_res_net_v2",
"InceptionV3": "inception_v3",
"ElasticNet": "elastic_net",
"LightGBM": "light_gbm",
"NeuralNetwork": "neural_network",
"1DCNN": "1dcnn",
"3DCNN": "3dcnn",
}


if __name__ == "__main__":
for sample_definition in ["instances", "eids"]:
for selected_dimensions in ["withEnsembles", "tuned", "bestmodels"]:
scores = load_csv(
f"page2_predictions/Performances/PERFORMANCES_{selected_dimensions}_alphabetical_{sample_definition}_Age_test.csv"
)[COLUMNS_TO_TAKE].rename(columns=COLUMNS_TO_TAKE)
scores.loc[
(scores["dimension"] == "Musculoskeletal") & (scores["sub_subdimension"] == "MRI"), "sub_subdimension"
] = "DXA"
scores.replace(DICT_TO_CHANGE_DIMENSIONS).to_feather(
f"all_data/age_prediction_performances/scores_{SAMPLE_DEFINITION_NAMING[sample_definition]}_{SELECTED_DIMENSIONS[selected_dimensions]}.feather"
scores = load_csv(
f"page2_predictions/Performances/PERFORMANCES_withEnsembles_withCI_alphabetical_{sample_definition}_Age_test.csv"
)[COLUMNS_TO_TAKE].rename(columns=COLUMNS_TO_TAKE)

for metric in ["r2", "rmse", "c_index", "c_index_difference"]:
scores[metric] = scores[f"{metric}_and_std"].str.split("+", expand=True)[0].astype(np.float32)
scores[f"{metric}_std"] = (
scores[f"{metric}_and_std"]
.str.split("+", expand=True)[1]
.str.split("-", expand=True)[1]
.astype(np.float32)
)

scores.drop(columns=f"{metric}_and_std", inplace=True)

scores.loc[
(scores["dimension"] == "Musculoskeletal") & (scores["sub_subdimension"] == "MRI"), "sub_subdimension"
] = "DXA"
scores.replace(DICT_TO_CHANGE_DIMENSIONS).to_feather(
f"all_data/age_prediction_performances/scores_{SAMPLE_DEFINITION_NAMING[sample_definition]}.feather"
)
upload_file(
f"all_data/age_prediction_performances/scores_{SAMPLE_DEFINITION_NAMING[sample_definition]}.feather",
f"age_prediction_performances/scores_{SAMPLE_DEFINITION_NAMING[sample_definition]}.feather",
)
Loading

0 comments on commit a3a58d0

Please sign in to comment.