Last active
December 20, 2018 04:57
-
-
Save jaor/f6845ba6b4bf9fb5746ab9915df8c4f0 to your computer and use it in GitHub Desktop.
Create a model using only the most important features in another one
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": "select-important", | |
"kind": "script", | |
"description": "Select the important features from an existig moddel to create a new one", | |
"source_code": "script.whizzml", | |
"imports":[ | |
], | |
"inputs":[ | |
{ | |
"name": "model-id", | |
"type": "model-id", | |
"description": "Known model from which to infer important features" | |
}, | |
{ | |
"name": "feature-no", | |
"type": "number", | |
"description": "Number of important features to retain" | |
}, | |
{ | |
"name": "dataset-id", | |
"type": "dataset-id", | |
"description": "Dataset to model uisng the most important features" | |
}], | |
"outputs":[ | |
{ | |
"name": "model-id", | |
"type": "model-id", | |
"description": "The newly created model" | |
}] | |
} |
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 (mark-fields ds-id prefix) | |
(let (fields (resource-fields ds-id) | |
ids (keys fields) | |
len (count prefix) | |
flags (for (f (values fields)) | |
{"preferred" (not (= prefix (subs (f "name") 0 len)))})) | |
(update ds-id {"fields" (make-map ids flags)}))) | |
(define result (mark-fields dataset-id prefix)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The input should be any of the "models" and I see no difference between the input and output model. :-)