Giter VIP home page Giter VIP logo

cxr_covid's Issues

python train_covid.py --dataset 1 returns a ROC AUC ValueError

Ran on environment provided.

-------- Epoch 000 --------
Traceback (most recent call last):                                                                                                               
  File "train_covid.py", line 202, in <module>
    main()
  File "train_covid.py", line 193, in main
    train_githubcxr14(args.seed, 
  File "train_covid.py", line 52, in train_githubcxr14
    classifier.train(trainds,
  File "/uss/xrai/nick_folder/cxr_covid/models/cxrclassifier.py", line 178, in train
    valloss, valauroc = self._val_epoch(val_dataloader)
  File "/uss/xrai/nick_folder/cxr_covid/models/cxrclassifier.py", line 261, in _val_epoch
    auroc = sklearn.metrics.roc_auc_score(true[:,-1], probs[:,-1])
  File "/datasets/home/00/300/nil021/.conda/envs/cxr_covid/lib/python3.8/site-packages/sklearn/metrics/_ranking.py", line 387, in roc_auc_score
    return _average_binary_score(partial(_binary_roc_auc_score,
  File "/datasets/home/00/300/nil021/.conda/envs/cxr_covid/lib/python3.8/site-packages/sklearn/metrics/_base.py", line 77, in _average_binary_score
    return binary_metric(y_true, y_score, sample_weight=sample_weight)
  File "/datasets/home/00/300/nil021/.conda/envs/cxr_covid/lib/python3.8/site-packages/sklearn/metrics/_ranking.py", line 221, in _binary_roc_auc_score
    raise ValueError("Only one class present in y_true. ROC AUC score "
ValueError: Only one class present in y_true. ROC AUC score is not defined in that case.

compile error: make_csv.py

(1)
Replicate Error: run make_csv.py

Error Message:

  File "make_csv.py", line 109
    contains_CR_DX = lambda x: return ('CR' in x) or ('DX' in x)
                               ^
SyntaxError: invalid syntax

Problem:
lambda statement doesn't allow return statement

FIX:
Before: contains_CR_DX = lambda x: return ('CR' in x) or ('DX' in x)
After: contains_CR_DX = lambda x: ('CR' in x) or ('DX' in x)

(2)
Replicate Error: run make_csv.py

Error Message:

  File "make_csv.py", line 113
    is_dir = os.path.isdir(os.path.join(datapath, subject, sessionfile))
    ^
SyntaxError: invalid syntax

Problem:
Missing closing parentheses

FIX:
Before: image_candidates_dir = os.listdir(os.path.join(datapath, subject, sessionfile, 'mod-rx')
After: image_candidates_dir = os.listdir(os.path.join(datapath, subject, sessionfile, 'mod-rx'))

Update githubcovid.py

Error Replication
Running python train_models.py --dataset 1 gives the following Error

Traceback (most recent call last):                                                                                                                    
  File "train_covid.py", line 202, in <module>
    main()
  File "train_covid.py", line 193, in main
    train_githubcxr14(args.seed, 
  File "train_covid.py", line 52, in train_githubcxr14
    classifier.train(trainds,
  File "/uss/xrai/nick_folder/cxr_covid/models/cxrclassifier.py", line 178, in train
    valloss, valauroc = self._val_epoch(val_dataloader)
  File "/uss/xrai/nick_folder/cxr_covid/models/cxrclassifier.py", line 262, in _val_epoch
    auroc = sklearn.metrics.roc_auc_score(true[:,-1], probs[:,-1])
  File "/datasets/home/00/300/nil021/.conda/envs/cxr_covid/lib/python3.8/site-packages/sklearn/metrics/_ranking.py", line 387, in roc_auc_score
    return _average_binary_score(partial(_binary_roc_auc_score,
  File "/datasets/home/00/300/nil021/.conda/envs/cxr_covid/lib/python3.8/site-packages/sklearn/metrics/_base.py", line 77, in _average_binary_score
    return binary_metric(y_true, y_score, sample_weight=sample_weight)
  File "/datasets/home/00/300/nil021/.conda/envs/cxr_covid/lib/python3.8/site-packages/sklearn/metrics/_ranking.py", line 221, in _binary_roc_auc_score
    raise ValueError("Only one class present in y_true. ROC AUC score "
ValueError: Only one class present in y_true. ROC AUC score is not defined in that case.

Problem Identification
Looking at the metadata, we see that values in finding columns may have been updated to new values.
Github-COVID feature engineering datasets/githubcovid.py needs to be updated
Current solution gives false for every datapoint, because of line 71: covid_set = ['COVID-19','COVID-19, ARDS']

Solution
Patients w/ COVID now have the following string 'Pneumonia/Viral/COVID-19' instead of 'COVID-19','COVID-19, ARDS']
Pneumonia patients and healthy set must also be updated to correspond with the new changes

Update make_csv.py

include these into series_description_map:

'TORAX  AP': 'AP',
'TÓRAX AP': 'AP',
'TORAX BIPE AP': 'AP',
'W034 TÓRAX LAT': 'LAT',
'W033 TÓRAX P.A.': 'PA',

Add another exception to series_description:

try:
    series_description = metadata['0008103E']['Value'][0]
except Exception as e:
    try:
        series_description = metadata['00081032']['Value'][0]['00080104']['Value'][0]
    except Exception as e:
        try:
            series_description = metadata["00185101"]["Value"][0]
        except Exception as e:
            raise e

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.