extensionoutputnode properties

Extension Output node iconWith the Extension Output node, you can analyze data and the results of model scoring using your own custom R or Python for Spark script. The output of the analysis can be text or graphical.

Note that many of the properties on this page are for streams from SPSS Modeler desktop.

Python for Spark example

#### script example for Python for Spark
import modeler.api
stream = modeler.script.stream()
node = stream.create("extension_output", "extension_output")
node.setPropertyValue("syntax_type", "Python")

python_script = """
import json
import spss.pyspark.runtime

cxt = spss.pyspark.runtime.getContext()
df = cxt.getSparkInputData()
schema = df.dtypes[:]
print df
"""

node.setPropertyValue("python_syntax", python_script)

R example

#### script example for R
node.setPropertyValue("syntax_type", "R")
node.setPropertyValue("r_syntax", "print(modelerData$Age)")
Table 1. extensionoutputnode properties
extensionoutputnode properties Data type Property description
syntax_type R Python Specify which script runs: R or Python (R is the default).
r_syntax string R scripting syntax for model scoring.
python_syntax string Python scripting syntax for model scoring.
convert_flags
StringsAndDoubles
LogicalValues
Option to convert flag fields.
convert_missing flag Option to convert missing values to the R NA value.
convert_datetime flag Option to convert variables with date or datetime formats to R date/time formats.
convert_datetime_class
POSIXct
POSIXlt
Options to specify to what format variables with date or datetime formats are converted.
output_to
Screen
File
Specify the output type (Screen or File).
output_type
Graph
Text
Specify whether to produce graphical or text output.
full_filename string File name to use for the generated output.
graph_file_type
HTML
COU
File type for the output file (.html or .cou).
text_file_type
HTML
TEXT
COU
Specify the file type for text output (.html, .txt, or .cou).