×
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!
Items to features | 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
Items to features
Details:
Created
Thu, 8 Oct 2026 15:01:02 +0000
Published
Thu, 8 Oct 2026 17:26:19 +0000
Description:
Adds new features to a dataset based on the items in one of its fields
Tags:
BigMLer
BigMLer_ThuOct0826_170101
URL:
https://bigml.com/user/whizzml/gallery/script/6ac7b02ed323e2051d10e3ad
Script
FREE
Source code
;; Given a dataset and an items field, add one new feature per item ;; denoting whether the item is present or not. ;; Find field by either name or id (define (find-field* fields field) ;; When find-field enters the stdlib, this can be replaced by: ; (or (find-field fields field) ; (raise (str "Field not found: " field))) (or (fields field false) (loop (ids (keys fields)) (cond (empty? ids) (raise (str "Field not found: " field)) (= field (fields [(head ids) "name"] "")) (fields (head ids)) (recur (tail ids)))))) ;; Retrieves the list of items in the given field (define (get-items dataset-id field) (let (dataset (fetch (wait dataset-id)) field (find-field* (dataset "fields") field) items (map head (field ["summary" "items"] []))) (when (not (= "items" (field "optype" false))) (raise (str "Field '" field "' must have type 'items'"))) (when (empty? items) (raise (str "The field '" field "' contains no items"))) items)) ;; Creates the flatline generator for the list of items (define (item-flatline field item yes no) (flatline "(if (contains-items? {{field}} {{item}}) {{yes}} {{no}})")) ;; Main workflow function (define (generate-dataset dataset-id field yes no) (let (items (get-items dataset-id field) item-reqs (for (i items) {"field" (item-flatline field i yes no) "name" i})) (create-dataset {"origin_dataset" dataset-id "new_fields" item-reqs}))) (define output-dataset (wait (generate-dataset input-dataset items-field true-value false-value)))
Description
Adds new features to a dataset based on the items in one of its fields
Adds new features to a dataset based on the items in one of its fields
Show more
Inputs
Outputs
License:
Creative Commons Zero V1.0
Script
FREE
Items to features | BigML.com
Sending Request...
Sending Request...