SPSS model visualizations in notebooks
SPSS visualizations offer interactive tables and charts to help you evaluate and improve a predictive analytics model in a notebook.
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.
To see these SPSS models built and visualized in a notebook, open the "Generating SPSS model visualizations in Scala" sample notebook (LINK TO BE PROVIDED).
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. (To use this class, your notebook must have a project token. If it does not already have one, follow these instructions to insert it.)
- In addition to the project token, you must pass a ProjectContext object as the first parameter when you call the ModelViewer.toHTML() command. For example, ModelViewer.toHTML(pc, myModel). For more information about inserting the ProjectContext object, see Inserting the project context.
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: