Code Monkey home page Code Monkey logo

Comments (4)

ycq091044 avatar ycq091044 commented on May 18, 2024

Thanks for the question. sequential_drug_recommendation works as an example to show how to define a healthcare task in pyhealth. By definition:

Sequential drug recommendation aims at predicting the drug set of the current visit given the history of diagnosis and procedure information as well as past drug information.

We want to use the diagnosis and procedures of visit-1 up to visit-N and the drug information from visit-1 up to visit-(N-1) to predict the drug in visit-N. A sample in this task looks like this:

{
   "patient_id": xxx,
   "visit_id": xxx,
   "sequential_conditions": [diagnoses-visit-1, diagnosis-visit-2, ..., diagnosis-visit-N],
   "sequential_procedures": [procedure-visit-1, procedure-visit-2, ..., procedure-visit-N],
   "sequential_drugs": [drug-visit-1, drug-visit-2, ..., drug-visit-(N-1)],
   "label": [drug-visit-N],
}

Some explanations for the task:

  1. The current drugs are what we want to predict, so they cannot be included in the feature lists. Thus, we use
sequential_conditions.append(conditions)
sequential_procedures.append(drugs)
sequential_drugs.append([])
  1. If the current drugs (i.e., predicted targets are empty, we ignore this visit).
if len(drugs) == 0: 
    sequential_drugs[-1] = drugs
    continue
  1. After we obtain the sample for the current visit, we will have to add the drugs back for the next visit. Thus we have the following line in the end.
sequential_drugs[-1] = drugs
  1. For the question "It seems 'sequential_drugs' is always empty." Because many patients only have one visit.

from pyhealth.

bbb801 avatar bbb801 commented on May 18, 2024

from pyhealth.

bbb801 avatar bbb801 commented on May 18, 2024

Thank you. I still have a question about the following codes. May I know why 'drug' is in 'sequential_procedures.append(drugs)' instead of ' procedures'?

"""
Some explanations for the task:

The current drugs are what we want to predict, so they cannot be included in the feature lists. Thus, we use
sequential_conditions.append(conditions)
sequential_procedures.append(drugs)
sequential_drugs.append([])
"""

from pyhealth.

ycq091044 avatar ycq091044 commented on May 18, 2024

Good findings. This is a typo, just corrected.

from pyhealth.

Related Issues (20)

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.