How to create a WhizzML Script – Part 3

In this third post about WhizzML basics, you’ll learn more about tools to create WhizzML scripts. We already covered how to manipulate WhizzML scripts from the Gallery. We also learned how to do the same via Scriptify and the Script Editor. For a quick reminder, go to the previous posts, How to create a WhizzML script – Part1and Part 2. In this tutorial, you’ll discover two new powerful scripting scenarios that will help you build complicated workflows: GitHub and BigMLer. Let’s dive in!

GitHub & WhizzML

Once you are in the scripts section, you can create a new script by using the editor, create a new script from an existing one, or (you guessed it) import one from GitHub.

It’s easy as pie! You just have to go to the WhizzML Script section and click on the ‘IMPORT SCRIPT FROM GITHUB’ button in the top right menu. Then you enter a WhizzML Github URL. You’ll see the script uploaded in your dashboard window ready be created upon clicking the ‘Create’ button. You may be wondering where you can find a WhizzML Github URL. No problem! There is a WhizzML example repository in Github with a lot of handy example scripts.

1- Import script from Github

2- Enter a Github URL

3- Create the script

BigMLer

Using BigMLer (BigML’s command line tool), you can execute WhizzML scripts too. You just have to remember to use the sub command execute. Let’s see some examples.

In this first example, you will execute the code written directly in the command line by using the --code option. The code has to be written between the quotation marks. Below, we execute a real basic piece of code: adding two numbers. In this example, the output will be stored in the simple_exe directory, because we used the flag --output-dir. This directory will contain whizzml_result.txt, where you can easily read the output of your code.

bigmler execute --code “(+ 1 2)” --output-dir simple_exe

You can execute a script that you already have in your dashboard by using the script ID. For this, you have to use the flag --script:

bigmler execute --script script/50a2bb64035d0706db000643

If your script has inputs, you can pass it as a JSON file (my_inputs.json) by using the flag --inputs:

where the my_inputs.json file can contain something like below. The inputs would be a with value 1 and b with value 2 :

In the following example of a BigMLer command, you will create your script but you won’t execute it through the flag --no-execute. In this script, you are declaring inputs and outputs and specifying them in the corresponding JSON files, with the flags --declare-inouts and --declare outputs

In this example, the my_inputs_dec.json file could contain:and the my_outputs_dec.json file could be like the example below. The value of the addition variable would then be returned as output in the execution results:

So it isn’t rocket science. Now it’s your turn to try it! Of course, remember to install and authenticate yourself before typing your BigMLer command lines.

Now you know how to create a WhizzML script in more ways. But we’re not quite finished yet! The next step will be discovering how to use the bindings to create scripts and libraries. Stay tuned.