Last active
November 9, 2017 04:31
-
-
Save jaor/1327c4f5f0de38e531f2cb0c96f4376a to your computer and use it in GitHub Desktop.
Create batch prediction dataset with predictions from multiple models
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Muti-model predictions", | |
"kind": "script", | |
"description": "Generate predictions for a fixed number of models", | |
"source_code": "multibatch.whizzml", | |
"inputs":[ | |
{ | |
"name": "model1", | |
"type": "model-id", | |
"description": "first model" | |
}, | |
{ | |
"name": "model2", | |
"type": "model-id", | |
"description": "second model" | |
}, | |
{ | |
"name": "model3", | |
"type": "model-id", | |
"description": "third model" | |
}, | |
{ | |
"name": "model4", | |
"type": "model-id", | |
"description": "fourth model" | |
}, | |
{ | |
"name": "model5", | |
"type": "model-id", | |
"description": "fith model" | |
}, | |
{ | |
"name": "input-dataset", | |
"type": "dataset-id", | |
"description": "inputs used to create predictions" | |
}], | |
"outputs":[ | |
{ | |
"name": "result", | |
"type": "dataset-id", | |
"description": "output dataset with all predictions" | |
}] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (batch-dataset id) | |
((fetch (wait id)) "output_dataset_resource")) | |
(define (make-batch ds-id mod-id) | |
(let (mod (fetch mod-id) | |
name (str "prediction from " (mod "name"))) | |
(create-batchprediction ds-id mod-id {"all_fields" true | |
"output_dataset" true | |
"prediction_name" name}))) | |
(define (create-predictions models ds-id) | |
(reduce (lambda (did mid) (batch-dataset (make-batch did mid))) ds-id models)) | |
(define result (create-predictions [model1 model2 model3 model4 model5] input-dataset)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment