×
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!
Single predictions with per-category 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
Single predictions with per-category models
Details:
Created
Thu, 8 Oct 2026 14:59:51 +0000
Published
Thu, 8 Oct 2026 17:26:28 +0000
Description:
Perform a single prediction using category models
Tags:
BigMLer
BigMLer_ThuOct0826_165950
category models
URL:
https://bigml.com/user/whizzml/gallery/script/6ac7afe79639eabb37d7526e
Script
FREE
Source code
;; Extracts the result of the given execution, signaling an ;; error if it's not of the expected kind. (define (exec-result eid) (let (res ((fetch eid) ["execution" "result"] {}) ks (if (res "binary" false) ["category"] ["categories" "missings-model"])) (for (k (concat ["models" "field-id" "field-name" "kind"] ks)) (when (not (contains? res k)) (raise (str "Invalid execution: Missing field " k " in result")))) res)) ;; Find the model to use from execution result (define (find-model cat res) (if (res "binary") (let ([m nm] (res "models")) (if (= cat (res "category")) m nm)) (let (models (make-map (cons "" (res "categories")) (cons (res "missings-model") (res "models")))) (models cat false)))) ;; Final workflow (define (predict-by-category eid input) (let (res (exec-result eid) cat (or (input (res "field-id") false) (input (res "field-name") "")) model (or (find-model cat res) (raise (if (empty? cat) (str "No model for category " cat) "No model for missing category")))) (log-info "Creating prediction for " (if (empty? cat) "missing category" (str "'" cat "'")) " using " model) (create-and-wait-prediction {"model" model "input_data" input}))) (define prediction (predict-by-category execution input))
Description
Perform a single prediction using category models
Perform a single prediction using category models
Show more
Inputs
Outputs
License:
Creative Commons Zero V1.0
Script
FREE
Single predictions with per-category models | BigML.com
Sending Request...
Sending Request...