Skip to content

Instantly share code, notes, and snippets.

@whizzmler
Forked from jaor/create_batchcentroid.whizzml
Last active June 7, 2016 17:42
Show Gist options
  • Save whizzmler/bb82e5edeb08e7eb9d228a21b6e6c421 to your computer and use it in GitHub Desktop.
Save whizzmler/bb82e5edeb08e7eb9d228a21b6e6c421 to your computer and use it in GitHub Desktop.
One click batchcentroid dataset
{
"name": "Batch-centroid",
"description": "Create a dataset with a new column showing the cluster each instance belongs to",
"inputs": [
{
"name": "source-id",
"type": "source-id",
"description": "Identifier of the input source"
}
],
"outputs": [
{
"name": "dataset-id",
"type": "dataset-id",
"description": "Identifier for new dataset with cluster labels"
}
]
}
(define (one-click-batch-centroid src-id)
(let (ds-id (create-and-wait-dataset {"source" src-id})
cl-id (create-and-wait-cluster {"dataset" ds-id
"default_numeric_value" "median"})
bc-id (create-and-wait-batchcentroid {"cluster" c-id
"dataset" ds-id
"output_dataset" true
"all_fields" true}))
(get (fetch bc-id) "output_dataset_resource")))
(define dataset-id (one-click-batch-centroid source-id))
@rasensio1
Copy link

@jaor
There's a typo in here.

.whizzml line#5. Should be "cl-id", not "c-id"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment