Beyond Binary: Unlocking Business Insights with the Power of Multinomial Classifiers: “The Lab” – Part 4

5
(3)

This is a continuation of the previous blog post Beyond Binary: Unlocking Business Insights with the Power of Multinomial Classifiers: “The Lab” – Part 3. In this blog post, we will integrate binary predictors into a comprehensive multinomial classifier

Part 4: Assemble the results from the Ensemble of Binary Classifiers

To integrate binary predictors into a comprehensive multinomial classifier, the following steps should be followed:

  1. Activate the Binary Models: Ensure the binary models are operational for use in Data Transforms.
  2. Create Data Transform to start predicting: Utilize Data Transforms to structure the functional flow of the data to be predicted.
  3. Calculate Softmax Results: Compute the Softmax results to ensure the outputs are probabilistically coherent.

Let us see how we can perform each step.

1. Activate the Binary Models

Once the models are trained, they must be activated to assemble them into the final multinomial classifier.

To activate the models, navigate to the Einstein Studio tab, Open the desired models, click on “Activate” and confirm Activation.

Please refresh your screen and ensure the model is activated.

2. Create Data Transform to start predicting

For this exercise, the same data used to prep for the binary training dataset will be re-used. It’s called “Streaming Media Data” in my example. We will do this for illustrative purposes, as it aids in backtesting the results and we use it as a validation dataset. Validation datasets are usually taken from an original training dataset and sequestered, or hidden during training time and used at validation time as we will be dong in this part.

In actual deployment, new, incoming data that you would like predictions on will be fed to the models. The process (data flows and calculations) will be the same. Let’s move on.

  1. Create a New Batch Transform
  2. Add the ‘binary training dataset’ in the input node. In my case, the dataset is called “Streaming Media Data”
  3. Connect the input node to “AI Model” node
  4. Select the first prediction model we created in Part 2 of the series. If the required model is not found, it is likely because it has not been activated. In such cases, return to Einstein Studio to activate the model.

  5. Click on Next. ssign a suitable name to the model, such as “AI disengagement,” and click “Apply.” The Transformation graph should appear as follows:

  6. Cascade the remaining four AI models by repeating the previous step, selecting the subsequent prediction model each time. The cascade graph should appear as follows:

3. Calculate Softmax Results:

The Softmax function converts raw scores into probabilities. For each class i, its Softmax score S(i) is calculated by taking e (Euler’s number) raised to the power of its raw score xi​, and then dividing by the sum of e raised to the power of all raw scores in the dataset. This ensures that all scores are positive and sum up to 1, making them easier to compare as probabilities.

This is the formula for Softmax:

The Softmax has the nice property of amplifying the differences between the scores, making the highest score stand out more. In essence, the Softmax helps to normalize and differentiate scores in a meaningful and mathematically elegant way.

In order to calculate softmax in data transofrm, we will break down the calculations into two steps.

3.1 Calculate the denominator –

Calculating the denominator first is recommended so it is only done once per row. The denominator is just the sum of all the exponentiated raw scores. To achieve this, utilize the math function within a Transform node.

Name the Transform “denominator calc.” Click on the function symbol and select Custom Formula.

Navigate to Numeric Functions, choose EXP for exponential, and click on the plus sign. The Exp function will appear in the “enter your formula” panel to the right-hand side of the scroll list.

As discussed, the denominator is the sum of all five exponentiated predicted values from the binary classifiers. Simply add them up using the plus sign on the keyboard to enter the addition operation. The partially defined math formula should now appear as follows:

Replace the “field” part in the formual above with the output of the AI Model node. Simply double click on the “Field”, jump to “Columns” section and choose the output variable from the AI prediction node.

Very important: It is crucial to divide the predictions by 100 to convert the percentages into decimal probabilities → illustrated in the next screenshot.

Repeat this process for the remaining predicted values.
Your completed math formula for the denominator should look like the following:

In the Output Type:

  1. Select Number, set precision to 5, and scale to 4, with no default value
  2. Choose Show Results as “New Column (and Keep Original).”
  3. Set the Column Label to “Denominator” and
  4. Modify the API name accordingly, note: maintaining the _c_formula_c format is recommended for consistency

Click on “Apply”.

3.2 Calculate Numberator and Softmax scores

As per the softmax formula, we have already calculated the denominator. Now, to calculate softmax score for each binary prediction, we need to find the numerator – exponentiation of the original predicted score. The numerator divided by the denominator will give us the softmax score for each binary classifier we created.

Create a transform node and utilise math function of the transform node. Create the numerator using exp() function and divide this by the denominator we calculated in the previous step.

Please look at the screenshot below for all details.

Repeat the aforementioned steps four additional times, ensuring the numerator parts are divided by 100 to convert the probability scores for each binary prediction into decimal form.

Finally, connect an output node for the entire Transformation graph. Here are the details for the output node. Make sure you designate the FQK and Primary Key:

The final data transform should appear as follows:

Save and run the transform.

When the “Last Run Status” indicates “Success” (a browser refresh may be necessary to update the status), the results can be viewed.

With this, we have successfully created softmax scores. Lets us now view the results.

Check out the results:

You can use data explorer to view the results of the data transform. Simply navigate to the “Data explorer” and locate your output DMO. In my case, it is called “Multinomical Churn Reasons”.

Data Explorer shows some fields by default. You may have to use “Edit Columns” and drop some columns from the view to add new ones. The ones we definitely need are the columns we created, along with churn reason. In my case, this is the final list of columns I needed:

For each row in the dataset, identify the column with the highest score/probability. This column is predicted to be the primary churn reason. Visually compare it with the ground truth, as the experiment involved predicting on a dataset with known outcomes to evaluate the predictions.

In the screenshot below, the disengagement score is 0.4 or 40% probability of disengagement. The other scores are approximately 0.15 or 15%. Therefore, disengagement is the predicted outcome, which can be verified against the known outcome in the Churn Reason column.

Similarly, a randomly selected row for ‘content gap’ shows ‘content score’ prevailing with a 39% probability, compared to the other columns at 15% or 16% probability.

Next, we will construct a basic confusion matrix to view the aggregate results in the final part of this blog series in Part 5.

How useful was this post?

Click on a star to rate useful the post is!

Written by


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.