×
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!
Name clusters | 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
Name clusters
Details:
Created
Thu, 8 Oct 2026 14:59:17 +0000
Published
Thu, 8 Oct 2026 17:26:38 +0000
Description:
Script to give names to clusters using important field names and their values
Tags:
BigMLer
BigMLer_ThuOct0826_165916
URL:
https://bigml.com/user/whizzml/gallery/script/6ac7afc5a3e168c94aab4f86
Script
FREE
Source code
;; model-importances ;; ;; Returns importances from the model ;; ;; Inputs: ;; model-id: (map) Corresponding model ID ;; ;; Output: (list) String representing the field = value name (define (model-importances model-id) (let (model (fetch model-id) importances-ids (model ["model" "importance"])) (map head importances-ids))) ;; generate-models ;; ;; Returns a list of the model IDs for the clusters when finished ;; ;; Inputs: ;; cluster-id: (string) Cluster ID ;; centroid-ids: (list) List of centroid IDs ;; ;; Output: (list) String representing the field = value name (define (generate-models cluster-id centroid-ids) (let (cluster (fetch cluster-id) models (cluster "cluster_models" {}) model-ids (for (centroid-id centroid-ids) (if (models centroid-id false) (str "model/" (models centroid-id)) (create "model" {"cluster" cluster-id "centroid" centroid-id})))) (wait* model-ids))) ;; cluster-name ;; ;; Creates cluster name using the most important field names of its ;; correspondent model and the centroid values ;; ;; Inputs: ;; clusters: (map) Structure of changes to set the names ;; centroid: (map) Centroid info ;; fields: (map) Cluster fields ;; model-id: (map) Model ID ;; number-of-terms: (number) Number of terms to use in cluster name ;; separator: (string) Separator to join terms to form cluster names ;; ;; Outputs: (string) Cluster name ;; (define (cluster-name clusters centroid fields model-id number-of-terms separator) (let (importances-ids (model-importances model-id) name-strs (map (lambda (x) (str (fields [x "name"] "") " = " (centroid ["center" x]))) importances-ids) n (- number-of-terms 1) ;; List of already named clusters to avoid repeating names seen (map (lambda (c) (c "name")) (values clusters))) (loop (cs (tail name-strs)) (if (empty? cs) (head name-strs) (let (c (join separator (cons (head name-strs) (take n cs)))) (if (member? c seen) (recur (tail cs)) c)))))) ;; rename-clusters ;; ;; Retrieves a cluster and renames it using the most important ;; field names of its correspondent model ;; ;; Inputs: ;; cl-id: (resource-id) ID of the cluster model ;; number-of-terms: (number) Number of terms to use in cluster name ;; separator: (string) Separator to join terms to form cluster names ;; ;; Output: (list) List of cluster names ;; (define (rename-clusters cl-id number-of-terms separator) (let (cl (fetch cl-id) fields (cl ["clusters" "fields"]) centroids (cl ["clusters" "clusters"]) centroid-ids (map (lambda (c) (c "id")) centroids) _ (or (cl "model_clusters") (raise "Cluster doesn't have any model")) ;; generate models for all centroids model-ids (generate-models cl-id centroid-ids) clusters (iterate (ns {} centroid centroids model-id model-ids) (assoc ns (centroid "id") {"name" (cluster-name ns centroid fields model-id number-of-terms separator)}))) (update cl-id {"clusters" clusters}) (values clusters))) ;; result ;; ;; Updates clusters name using the importance of their fields in each ;; cluster model ;; Output: (list) List of cluster names (define result (rename-clusters cluster-id number-of-terms separator))
Description
Script to give names to clusters using important field names and their values
Script to give names to clusters using important field names and their values
Show more
Inputs
Outputs
License:
Creative Commons Zero V1.0
Script
FREE
Name clusters | BigML.com
Sending Request...
Sending Request...