About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Last updated: Feb 11, 2025
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)")
properties |
Data type | Property description |
---|---|---|
|
R Python | Specify which script runs: R or Python (R is the default). |
|
string | R scripting syntax for model scoring. |
|
string | Python scripting syntax for model scoring. |
|
|
Option to convert flag fields. |
|
flag | Option to convert missing values to the R NA value. |
|
flag | Option to convert variables with date or datetime formats to R date/time formats. |
|
|
Options to specify to what format variables with date or datetime formats are converted. |
|
|
Specify the output type ( or ). |
|
|
Specify whether to produce graphical or text output. |
|
string | File name to use for the generated output. |
|
|
File type for the output file (.html or .cou). |
|
|
Specify the file type for text output (.html, .txt, or .cou). |
Was the topic helpful?
0/1000