×
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 item 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 item models
Details:
Created
Thu, 8 Oct 2026 15:00:53 +0000
Published
Thu, 8 Oct 2026 17:26:19 +0000
Description:
Generate models for a multi-labeled items field
Tags:
BigMLer
BigMLer_ThuOct0826_170052
URL:
https://bigml.com/user/whizzml/gallery/script/6ac7b0255ada585217a2f27c
Script
FREE
Source code
;; Given a dataset, an items field and a model kind, generates a new ;; binary field per item and ;; uses the result to create models of the given kind per item. ;; Find field by either name or id (define (find-field* fields field) (or (when (contains? fields field) [(fields field) field]) (loop (ids (keys fields)) (cond (empty? ids) (raise (str "Field not found: " field)) (= field (fields [(head ids) "name"] "")) [(fields (head ids)) (head ids)] (recur (tail ids)))))) ;; Given a dataset and a items field id or name, find ;; the associated list of items and the missing count. (define (list-items dataset-id field-id) (let ([f id] (find-field* ((fetch dataset-id) "fields") field-id)) (when (not (= "items" (f "optype"))) (raise (str "Field '" field-id "' has not the items type"))) (let (items (map head (f ["summary" "items"] []))) (when (empty? items) (raise (str "Field '" field-id "' does not contain any item"))) [items (f ["summary" "missing_count"] 0) id (f "name")]))) ;; Given a dataset and an items field, create binary features per item (define (expand-ds dataset field) (let (script (head (list-scripts {"limit" 1 "name" "Items to features"})) ex-items (create-and-wait-execution {"script" (script "resource") "inputs" [["input-dataset" dataset] ["items-field" field] ["true-value" "Y"] ["false-value" "N"]]})) ((fetch ex-items) ["execution" "result"]))) ;; Adapt parameters to each items objective field (define (per-item-conf item items parms objective) (let (other-items (filter (lambda (x) (not (= x item))) items)) (merge parms {"objective_field" item "excluded_fields" (append other-items objective)}))) ;; Creates a model and returns the corresponding ID. When the kind of model ;; is an optiml, the best model is returned (define (model-create kind dataset parameters) (let (model (create kind dataset parameters)) (if (= kind "optiml") (head ((fetch (wait model)) "models")) model))) ;; Final workflow for multi-label models generation (define (m-l-models dataset objective kind parameters) (let ([items missings id name] (list-items dataset objective) ds-name ((fetch dataset) "name") ext-ds (expand-ds dataset objective) ps (map (lambda (x) (per-item-conf x items parameters objective)) items) ms (map (lambda (p) (model-create kind ext-ds p)) ps)) (wait* ms) {"items" items "objective-id" id "objective-name" name "models" ms "kind" kind})) (define multi-label-models (m-l-models dataset objective model-kind model-parameters))
Description
Generate models for a multi-labeled items field
Generate models for a multi-labeled items field
Show more
Inputs
Outputs
License:
Creative Commons Zero V1.0
Script
FREE
Create item models | BigML.com
Sending Request...
Sending Request...