Now that it's live, don't forget to accept your certification badge on Credly today! Learn more here.
We are currently experiencing an issue with Email verification at this time and working towards a solution. Should you encounter this issue, please click on the "Send Verification Button" a second time and the request should go through. If the issue still persists for you, please email support@alteryx.com for assistance.

Alteryx Designer Knowledge Base

Definitive answers from Designer experts.

How to Create a Plot of an Alteryx Neural Network Model

SydneyF
Alteryx Alumni (Retired)
Created

Neural Networks are frequently referred to as "black box" predictive models. This is because the actual inner workings of why a Neural Network sorts data the way it does are not explicitly available for interpretation.A wide variety of work has been conducted to make Neural Networks more transparent, ranging from visualization methods to developing a Neural Network model that can “show it’s work”.

 

If you’re using the Neural Network Tool in Alteryx, you have different plots that demonstrate the efficacy of the model included in the Report (R) output Anchor. These plots are very helpful for interpretation but don’t provide a schematic for how the network looks.

 

There is an R package on CRAN calledNeuralNetToolswhich creates a whole bunch of handy plots of a trained neural network model. It works on a few different R packages, includingnnet(the package Alteryx uses). The author and maintainer of the NeuralNetTools package, Marcus W. Beck, also has a blog calledR is my friend, where he discusses the plotting functions included in his package (along with other cool neural network stuff, and general fun in R).

 

You can use this package to create visualizations of your Alteryx-created Neural Networks by bringing the model object created by the Neural Network tool into the mighty R tool. The steps to do so are as follows:

 

1. Train a Neural Network model with the Neural Network tool.

 

trainNeuralNetwork.png

 

2.Once the model is trained, add an R tool on to the canvas, and connect the O anchor to the R tool’s input.

 

addRtool.png

 

Now we can start coding!Because the NeuralNetTools package is not installed with the Alteryx Predictive Tools by default, you will need to install the package yourself. You can do this a few different ways, including anAlteryx Analytic Application,through a command prompt, or with a customconditional install function in the R tool. No matter how you do it, once this package is installed and available for use in your R installation connected to Alteryx, you only need a few lines of code in your R tool to create a Neural Networkvisualization.

 

First, you will need to load both thennetand NeuralNetTools packages.

 

#load needed R packages library(nnet) library(NeuralNetTools)

Next, you will need to read in the Neural Network Model object (the outputin the O anchor of the Neural Network tool) into the R tool, confirm that it is a model object, and unserialize the model object.

 

#read in the Alteryx stream containing the model object the.model  

The last step is to create a plot in the first output anchor of the R tool, and populate it with a plot of the neural network with theplotnet() function from the NeuralNetTools package.

 

#create a slot for an output graph in anchor 1 AlteryxGraph(1, width=576, height=576)  #plot the neural network plotnet(mod.obj) 

3. Now you can add a couple of Browse tools, and run your workflow!

 

addbrowse.png

 

The plot generated by the R tool returned in the first output anchor will be a diagram of the neural network you trained with the Neural Network tool!

 

neuralnetoutput.png

 

You can apply this same process to create additional visualizations of any of the Predictive Tool models with an appropriate R package.

 

No ratings