Member-only story

Predict on wine using Jax’s decision tree classifier

Crystal X
4 min readSep 19, 2023

--

In my last blog post I discussed how to create a decision tree classifier in Jax, a Python library created by Google. In this post I intend to fit the algorithm into a machine learning project, to show how it works.

I have used sklearn’s wine dataset as the data to make predictions on because it is an easy dataset to obtain a reasonable accuracy on. I did try to use the decision tree classifier referenced in this post on Kaggle’s horse health dataset but I did not obtain satisfactory results. It is for that reason that, when working on any dataset, to try out several different algorithms and select the one that works the best.

I have written the program in this project in Google Colab, which is a free, online Jupyter Notebook hosted by Google. Google Colab is a great platform to use to write code in Python, with the exception that it does not have an adequate undo function. Care should be taken, therefore, not to accidentally overwrite or delete valuable code because if that happens, it could be lost forever(which I have done in the past).

Once the Jupyter Notebook was created, I imported the libraries that I would need for this project, being:-

  1. Jax to create the algorithm,
  2. Jax.numpy is a module that closely resembles numpy, and
  3. Sklearn to provide machine learning functionality.

I then used Jax to set up the random key for the program, which makes the output of the…

--

--

Crystal X
Crystal X

Written by Crystal X

I have over five decades experience in the world of work, being in fast food, the military, business, non-profits, and the healthcare sector.

Responses (1)