×
BigML is working hard to support a wide range of browsers. Your experience will be better with:
English
Sign up / in
Sign up
Sign in
or Sign in with...
Amazon
Github
GitLab
Google
Toggle navigation
PRODUCT
Features
Releases
What's New
GETTING STARTED
PRICING
Subscriptions
Private Deployments
Training
Certifications
BigML for Education
SUPPORT
Toggle navigation
PRODUCT
Features
Releases
What's New
GETTING STARTED
PRICING
Subscriptions
Private Deployments
Training
Certifications
BigML for Education
SUPPORT
License
Oops!
We could not process your request!
Create cluster models | BigML.com
×
Embed this Script in your web site
Copy & Paste this code into your HTML code:
whizzml
Public
whizzml's
Scripts
77
Models
0
Datasets
0
0
FREE
BUY
Create cluster models
Details:
Created
Thu, 8 Oct 2026 15:02:41 +0000
Published
Thu, 8 Oct 2026 17:25:58 +0000
Description:
Generate a cluster and a set of models from its centroid datasets
Tags:
BigMLer
BigMLer_ThuOct0826_170238
URL:
https://bigml.com/user/whizzml/gallery/script/6ac7b091d323e2051d10e3b6
Script
FREE
Source code
;; Given a source, finds out clusters using G-means, and creates ;; predictive models for each cluster. ;; Samples a dataset with a given rate (between 0 and 1) and getting ;; the sampled rows (oob = false) or the complementary ones (oob = true), ;; using a fixed seed. (define (sample-dataset ds-id rate oob) (create-dataset {"sample_rate" rate "origin_dataset" ds-id "out_of_bag" oob "seed" "whizzml-example"})) ;; Creates a model with 80% of the input dataset, evaluates it ;; with the remaining 20%. Returns the model and evaluation ids. (define (evaluate-model-on-dataset ds-id) (let (training-id (sample-dataset ds-id 0.8 false) test-id (sample-dataset ds-id 0.8 true) _ (wait training-id) model-id (create-model {"dataset" training-id}) _ (wait* [test-id model-id]) ev-id (create-evaluation {"model" model-id "dataset" test-id})) {"model" model-id "training" training-id "test" test-id "evaluation" ev-id})) (define (create-evaluations ds-ids) (let (mds (map evaluate-model-on-dataset ds-ids)) (for (md mds) (let (mid (md "model") eid (md "evaluation")) (wait eid) (delete* [mid (md "training") (md "test")]) (fetch eid))))) (define (create-centroid-datasets cluster-id centroid-ids) (wait* (create* "dataset" (for (id centroid-ids) {"cluster" cluster-id "centroid" id})))) (define (create-centroid-models dataset-ids) (create* "model" (for (id dataset-ids) {"dataset" id}))) (define (centroids-prop cluster prop) (let (cs (cluster ["clusters" "clusters"])) (map (lambda (c) (c prop)) cs))) ;; Given a dataset id, creates a cluster and models for each of the ;; resulting centroid datasets. Returns the cluster-id, a map from ;; centroid id to its model, a map to centroid id to their names, and ;; a map from centroid id to the evaluation. (define (make-cluster-models ds-id) (let (cluster-id (create-and-wait-cluster {"dataset" ds-id}) cluster (fetch cluster-id) cid (cluster "resource") cids (centroids-prop cluster "id") cnames (centroids-prop cluster "name") ds-ids (create-centroid-datasets cid cids) mod-ids (create-centroid-models ds-ids) evs (create-evaluations ds-ids)) [cid (make-map cids mod-ids) (make-map cids cnames) (make-map cids evs)])) (define dataset-id (create-and-wait-dataset {"source" source-id})) (define full-result (make-cluster-models dataset-id)) (define cluster-id (nth full-result 0)) (define models (nth full-result 1)) (define names (nth full-result 2)) (define evaluations (nth full-result 3))
Description
Generate a cluster and a set of models from its centroid datasets
Generate a cluster and a set of models from its centroid datasets
Show more
Inputs
Outputs
License:
Creative Commons Zero V1.0
Script
FREE
Create cluster models | BigML.com
Sending Request...
Sending Request...