Set Spatial Statistics Model File Properties (Spatial Statistics)

Summary

Adds descriptions and units to the variables stored in a spatial statistics model file.

Learn more about spatial statistics model files

Usage

  • The following are potential applications of the tool:

    • Set variable descriptions to provide background and information for the variables stored in the model file.
    • Add units to the variables so that they can be matched when using the model file in the Predict Using Spatial Statistics Model File tool to make predictions.

  • The outputs of this tool include geoprocessing output messages that describe the characteristics and contents of the input model file. You can access the messages by hovering over the progress bar, clicking the pop-out button, or expanding the messages section in the Geoprocessing pane. You can also access the messages for a previous run of the tool through the Geoprocessing history.

    The messages include the following information and tables:

    • The tool and method used to create the spatial statistics model file.
    • The Model Parameters table describes the variable to predict and explanatory variables used to create the model. The table also contains units for each variable to help ensure that they align with the prediction variables when using the model to make predictions.
    • The messages and model diagnostics from the tool used to create the model file. See the documentation for the associated tool for explanations of the messages and diagnostics.

  • You can create the model file using the Output Trained Model File parameter in the Generalized Linear Regression, Forest-based and Boosted Classification and Regression, or Presence-only Prediction tools.

    For models created by the Generalized Linear Regression, the messages will display the model type that was used (continuous, binary, or count). For the Forest-based and Boosted Classification and Regression tool, the messages will display whether a forest-based or gradient boosted model for regression or classification was used. For the Presence-only Prediction tool, the messages will display whether background points were used.

  • The units for explanatory training distance features cannot be edited by the tool. The distance unit displayed in the tool dialog box is determined by the distance units that were used to train the model.

    Note:

    It is recommended that you set the units for variables before sharing the model file for prediction with different data. Inadvertent unit mismatches can cause incorrect analysis results, so it is important to document the units for each variable. For example, if you train a model using income measured in United States dollars but use income measured in Indian rupees when making predictions, the ranges of values and meaning of the coefficients will be inconsistent, resulting in incorrect predictions.

Parameters

LabelExplanationData Type
Input Model File

The spatial statistics model file.

File
Variable To Predict
(Optional)

The name, description, and unit of the variable that will be predicted at new locations.

Value Table
Explanatory Training Variables
(Optional)

The name, description, and unit of the explanatory variables that will be used to train the input model.

Value Table
Explanatory Training Distance Features
(Optional)

The name, description, and unit of the explanatory training distance features that will be used to train the input model.

Value Table
Explanatory Training Rasters
(Optional)

The name, description, and unit of the explanatory training rasters that will be used to train the input model.

Value Table

Derived Output

LabelExplanationData Type
Updated Model File

The spatial statistics model file updated with variable descriptions and units.

File

arcpy.stats.SetSSMFileProperties(input_model, {variable_predict}, {explanatory_variables}, {distance_features}, {explanatory_rasters})
NameExplanationData Type
input_model

The spatial statistics model file.

File
variable_predict
[[var1, desc1, unit1], [var2, desc2, unit2],...]
(Optional)

The name, description, and unit of the variable that will be predicted at new locations.

Value Table
explanatory_variables
[[var1, desc1, unit1], [var2, desc2, unit2],...]
(Optional)

The name, description, and unit of the explanatory variables that will be used to train the input model.

Value Table
distance_features
[[var1, desc1, unit1], [var2, desc2, unit2],...]
(Optional)

The name, description, and unit of the explanatory training distance features that will be used to train the input model.

Value Table
explanatory_rasters
[[var1, desc1, unit1], [var2, desc2, unit2],...]
(Optional)

The name, description, and unit of the explanatory training rasters that will be used to train the input model.

Value Table

Derived Output

NameExplanationData Type
updated_model_file

The spatial statistics model file updated with variable descriptions and units.

File

Code sample

SetSSMFileProperties example 1 (Python window)

The following Python window script demonstrates how to use the SetSSMFileProperties function.


arcpy.stats.SetSSMFileProperties ("C:/MyData/input_modelfile.ssm", 
      [["CORN", "Presence of Corn Prediction", "No Units"]], 
      [["RASTER1", "Rainfall", "millimeter"], ["RASTER2", "Temperature", "Celsius"], 
       ["RASTER3", "Crop Type", "No units']])
SetSSMFileProperties example 2 (stand-alone script)

The following stand-alone Python script demonstrates how to use the SetSSMFileProperties function.

# Set the properties of a spatial statistics model file 

# Import modules 
import arcpy 

# Set the current workspace 
arcpy.env.workspace = "C:/MyData" 

# Set Variable Description and units 
var_predict = [["FatalityPresence", "Binary value to show presence of fatality", "No Units"]]
var_exp = [["ALCOHOL_RELATED", "Number of accidents related to alcohol usage", "Count"], 
           ["SPEED", "Speed of the vehicle", "Miles per hour"]]
var_distance = [["INTERSECTION", "Distance to a road intersection", "Miles"]]

# Run tool  
arcpy.stats.SetSSMFileProperties("input_modelfile.ssm", var_predict, var_exp, 
          var_distance) 

# Print geoprocessing messages 
print(arcpy.GetMessages)

Environments

This tool does not use any geoprocessing environments.