nimblebox logo
Docs
v3.3.1b

Run a Scikit Learn Job

Here's the code for this specimen on Github

A job is an execution of code with a fixed start and end unlike a serving which is an endless process. With that clear, we will try to run a simple job using sklearn. This is taken from the sklearn documentation and we extend it to connect to Relics which is used to store all the artifacts generated by the job.

Code

Let's start by creating a file main.py and add code from here:

Python
Loading...

Note that we want to run benchmark function as job, it can take in a couple of arguments like n_init which determines the number of times the k-means algorithm will be run with different centroid seeds. The final results will be the best output of n_init consecutive runs in terms of inertia.

It also takes in another argument save_to_relic which if passed as True will save the matplotlib plot to Relics. We will see how to use Relics in the next section.

To deploy this job all we need to run is this single command on shell terminal or you can use the "Compute Fabric" strategy as well.

ShellPython
Loading...

We have also ensure that you can pass arguments to the running function through CLI as well. So if you want to save the resulting image in the Relics, you can simply append --save_to_relic True to the above command.

On the dashboard you will see logs that look like this:

Log
Loading...

Conclusion

In this demo we saw how you can run a job on the NimbleBox platform.

nbox SDKnbox provides built in access to all the APIs and packages them in the most user friendly manner.Star 0