How to Create a WhizzML Script (Part 1)
How to Create a WhizzML Script (Part 1)
In the first post of this series where you'll learn WhizzML from scratch, learn where to find WhizzML scripts and how you can use them.
Join the DZone community and get the full member experience.Join For Free
WhizzML is a domain-specific language (DSL) developed by BigML. It's a powerful tool for automating machine learning (ML) workflows and implementing high-level ML algorithms. In this series of blog posts, you will learn WhizzML from scratch. In this post, we’ll explain where to find WhizzML scripts and how you can use them. Let’s start!
What Is a Script?
First, we’ll remind you of some definitions to clarify some important WhizzML concepts.
Workflow: The series of activities that are necessary to solve a machine learning problem by using the resources provided by BigML.
Script: A workflow specification that uses WhizzML source code.
Library: A shared collection of WhizzML functions and definitions usable by any script that imports them.
Execution: A specific run of a script, i.e. the actual realization of all the steps codified by its WhizzML source.
You may be wondering what’s inside a WhizzML script and how it’s structured. Let’s explore that next. WhizzML scripts have four components:
- Source: The original script, the code creating the WhizzML script itself.
- Imports: The list of libraries with the code used by the script.
- Inputs: The list of input values that parameterize the workflow.
- Outputs: The list of values computed by the script and returned to the user.
How to Create a WhizzML Script
There are different ways to create a WhizzML script depending on what tools you use. BigML offers several options:
- Script editor
Let's focus on the gallery and the Scriptify methods in this blog post. You’ll learn how to use the other methods in future blog posts. BigML provides a public gallery with scripts, datasets, and models for your benefit. By choosing a resource and cloning it, you will have it in your dashboard, where you can run it or create an execution. The gallery is great for getting inspired by high-level workflows from other users. It can also save you time by eliminating the need to recreate basic scripts from scratch.
Scriptify is another convenient tool for creating scripts. With Scriptify, you can create a WhizzML script for any machine learning workflow in a single click. All BigML resources (datasets, models, evaluations, etc.) have a menu option named Scriptify that allows you to automatically generate a script that can regenerate a resource (or generate a similar one if it is used with different inputs but with the same field structure). Here is an example of Scriptify applicable to a Model resource.
What About the Execution?
Executing a WhizzML script is easy. Given a script and a complete set of inputs, you can execute your workflow and watch it generate the output. There are also different tools you can use to do just that:
- Web UI
Let’s focus on the first method and leave the others for later blog posts. When you’re in the dashboard, you can go to the WhizzML menu, where you will find your scripts, libraries, and executions.
Let’s use the script we just imported from the gallery as an example of an execution. In this script, we just have to choose one input before we execute it. Once it finishes, we will find it under Executions. You can then find the output information, seen below with the name result. You can also see the resources that have been created to execute this script under the Resources section. You can execute a script as many times as you want in a repeatable and traceable way.
How to Add a Script to the Resources Menu
You can easily add a script to your resources menu. This lets you use your favorite scripts as many times as you want. Simply follow these steps:
- When you’re viewing a script, find the option Add a Script to this Menu.
- Choose the resource this script is for (i.e. Datasets, Models, Ensembles, Evaluations).
- Once added, you can find it in the script menu of that resource view. For example, if I add a script for datasets, I will be able to use it in the Dataset tab. The ability to use the same script many times helps you be more productive.
Now you know the basics of creating a WhizzML script — but this is just the beginning. In the next post, we’ll discover other ways to create and use scripts.
Published at DZone with permission of Barbara Martin , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.