Table of contents

SPSS model visualizations

SPSS visualizations offer interactive tables and charts to help you evaluate and improve a predictive analytics model.

These SPSS visualizations provide one comprehensive set of output so that you don't need to create multiple charts and tables to determine model performance.

Example of visualization charts

Prerequisites

To use the SPSS visualizations, in a Scala notebook, set up the environment and build your model:

  • You will use the ModelViewer class to generate output.
  • You must pass a ProjectContext object as the first parameter when you call the ModelViewer.toHTML() command. For example, ModelViewer.toHTML(pc, myModel).
  • Import the ensemble package from the classification and regression library. This library contains the Random Trees model. You also need to import the SQLContext that will help prepare data. Use this code in your notebook:

     import com.ibm.spss.ml.classificationandregression.ensemble.RandomTrees
     import org.apache.spark.sql.SQLContext
    
  • Establish the SQLContext to use the SQL methods for working with your data. Use this code:

     val sqlContext = new SQLContext(sc)
    
  • Load your data into a data frame.

  • Build your model.

To view the SPSS visualizations, you use the following code in your Scala notebook:

    
    val html = ModelViewer.toHTML(pc,myModel)
    kernel.magics.html(html) 

where myModel is the model that you created in the earlier cells in the notebook.

The following models are supported:

For predictive models without built-in predictor importance measures, such as linear and logistic regression: