Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify QLasso for frequencies and deploy it #89

Open
edvardlindelof opened this issue Aug 9, 2017 · 3 comments
Open

Modify QLasso for frequencies and deploy it #89

edvardlindelof opened this issue Aug 9, 2017 · 3 comments
Assignees
Milestone

Comments

@edvardlindelof
Copy link
Collaborator

QLasso is based on the assumption that the wait time is a linear transformation of features of the form WORKLOAD/PROCESSINGRATE and other things that have the dimension of time. To modify it for frequencies we could use these features:

  • categorical time-of-week features of the frequencies instead of the wait time
  • all the Q-features inverted
  • rolling averages of the frequencies instead of of the wait times
@edvardlindelof edvardlindelof added this to the Backlog milestone Aug 9, 2017
@edvardlindelof edvardlindelof self-assigned this Aug 9, 2017
@edvardlindelof edvardlindelof modified the milestones: ToDO, Backlog, InProgress Aug 12, 2017
edvardlindelof added a commit to edvardlindelof/ERICA-prediction that referenced this issue Aug 12, 2017
edvardlindelof added a commit to edvardlindelof/ERICA-prediction that referenced this issue Aug 14, 2017
edvardlindelof added a commit to edvardlindelof/ERICA-prediction that referenced this issue Aug 14, 2017
@edvardlindelof
Copy link
Collaborator Author

edvardlindelof commented Aug 14, 2017

FLasso feature engineering notes

Predicting number of patients receiving triage in the coming hour, having the lasso penalty set to 0 (i.e. just doing linear regression and not caring about overfitting).

  • Time of week feature on its own gives training mse 19.01.
  • Adding number of untreated low prio patients (which makes sense to include next in article but not here) gets it down to 18.96.
  • Adding workloads gets it down to 12.25. Having them as they are is better than inverting them.
  • Adding rolling frequencies, e.g. number of triages in past 30, 60 and 120 minutes, gets it down to 9.74.
  • Adding capacity/workload features (i.e. the inversions of the QLasso features) gets it down to 9.21. Inverting them is alot better than not inverting them.

Some fiddling with the Lasso penalty parameter gives a regularised model with 8 non-zero-weights (out of 40) and training mse 11.19. (I should do proper holdout validation at some point.)

edvardlindelof added a commit to edvardlindelof/ERICA-prediction that referenced this issue Aug 15, 2017
@edvardlindelof
Copy link
Collaborator Author

Modified the model to output several frequencies, ran a training session and uploaded it to a bucket. View it in tensorboard by installing tensorflow, running python -m tensorflow.tensorboard --logdir=gs://flasso_training/ and going to localhost:6006 in a browser

@edvardlindelof
Copy link
Collaborator Author

Deployed

A version of the model is deployed to Google Cloud. Try and request a prediction by putting some dummy json into a file then using the CLI:

echo "{\"epochseconds\": 1503668054, \"Kölapp30\": 1, \"Triage30\": 1, \"Läkare30\": 1, \"Klar30\": 1, \"Kölapp60\": 1, \"Triage60\": 1, \"Läkare60\": 1, \"Klar60\": 1, \"Kölapp120\": 1, \"Triage120\": 1, \"Läkare120\": 1, \"Klar120\": 1, \"UntreatedLowPrio\": 1, \"all\": 1, \"MEP\": 1, \"triaged\": 1, \"metdoctor\": 1, \"done\": 1, \"PRIO1\": 1, \"PRIO2\": 1, \"PRIO3\": 1, \"PRIO4\": 1, \"PRIO5\": 1, \"doctors60\": 1, \"teams60\": 1}" >> datapoint.json
gcloud  ml-engine predict --model "flasso" --version "v1" --json-instances "datapoint.json"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant