kristoferB / SP

Sequence Planner
MIT License
12 stars 5 forks source link

Modify QLasso for frequencies and deploy it #89

Open edvardlindelof opened 6 years ago

edvardlindelof commented 6 years ago

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:

edvardlindelof commented 6 years ago

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).

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 commented 6 years ago

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 commented 6 years ago

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"