extensionoutputnode properties
With 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
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
node.setPropertyValue("syntax_type", "R")
node.setPropertyValue("r_syntax", "print(modelerData$Age)")
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 |
|
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 |
|
Options to specify to what format variables with date or datetime formats are converted. |
output_to |
|
Specify the output type (Screen or File ). |
output_type |
|
Specify whether to produce graphical or text output. |
full_filename |
string | File name to use for the generated output. |
graph_file_type |
|
File type for the output file (.html or .cou). |
text_file_type |
|
Specify the file type for text output (.html, .txt, or .cou). |