Predict Using Regression Model (Image Analyst)

Available with Image Analyst license.

Summary

Predicts data values using the output from the Train Random Trees Regression Model tool.

Usage

  • If the Input Raster value is a multiband raster, each band represents an explanatory variable. The sequence of the bands in the multiband raster must be consistent with the inputs used for training the model with the Train Random Trees Regression Model tool.

  • If the Input Rasters value is a multidimensional raster (a multidimensional raster layer, multidimensional CRF, or multidimensional mosaic dataset), all multidimensional variables must be single band and have a StdTime or StdZ dimension value. Each multidimensional variable is treated as a predictor variable. All multidimensional variables will be used.

  • The regression model is defined in an Esri Regression Definition file (.ecd). It contains all the information for a specific dataset, or a set of datasets, and a regression model. It is generated by the regression model training tools, such as the Train Random Trees Regression tool.

  • The input rasters must be in the same form as when the regression model was trained. For example, the input must contain the same number of items in the list, in the same order, and each item must match (including the variables of a multidimensional raster).

  • If any of the explanatory variables are NoData at a location, the corresponding pixel in the output will be NoData.

  • The output cell size is determined by the first input raster or the environment settings.

  • If the output is a multidimensional raster, use CRF or NetCDF format. Other raster formats such as TIFF can store a single raster dataset. A dimensionless raster cannot store multidimensional raster output information.

Parameters

LabelExplanationData Type
Input Rasters

The single-band, multidimensional, or multiband raster datasets, or mosaic datasets containing explanatory variables.

Raster Dataset; Raster Layer; Mosaic Dataset; Mosaic Layer; Image Service; String
Input Regression Definition File

A JSON format file that contains attribute information, statistics, or other information from the regression model. The file has an .ecd extension. The file is the output of the Train Random Trees Regression Model tool.

File
Output predicted raster

A raster of the predicted values.

Raster Dataset

PredictUsingRegressionModel(in_rasters, in_regression_definition, out_raster_dataset)
NameExplanationData Type
in_rasters
[in_rasters,...]

The single-band, multidimensional, or multiband raster datasets, or mosaic datasets containing explanatory variables.

Raster Dataset; Raster Layer; Mosaic Dataset; Mosaic Layer; Image Service; String
in_regression_definition

A JSON format file that contains attribute information, statistics, or other information from the regression model. The file has an .ecd extension. The file is the output of the Train Random Trees Regression Model tool.

File
out_raster_dataset

A raster of the predicted values.

Raster Dataset

Code sample

PredictUsingRegressionModel example 1 (Python window)

This Python window script predicts data values using the output from the PredictUsingRegressionModel function.

# Import system modules 
import arcpy 
from arcpy.ia import * 

# Check out the ArcGIS Image Analyst extension license 
arcpy.CheckOutExtension("ImageAnalyst") 

predicted_raster = arcpy.ia.PredictUsingRegressionModel("weather_variables.crf";"dem.tif", r"c:\data\pm_trained.ecd") 
predicted_raster.save("C:/data/pm2.5_prediction.crf")
PredictUsingRegressionModel example 2 (stand-alone script)

This Python stand-alone script predicts data values using the output from the PredictUsingRegressionModel function.

# Import system modules 
import arcpy 
from arcpy.ia import *  

# Check out the ArcGIS Image Analyst extension license 
arcpy.CheckOutExtension("ImageAnalyst") 

# Define input parameters 
in_weather_variables = "C:/Data/ClimateVariables.crf" 
in_dem_varaible = "C:/Data/dem.tif" 
in_target = "C:/Data/pm2.5_observations.shp" 
target_value_field = "mean_pm2.5" 
Target_date_field = "date_collected" 
Raster_dimension = “StdTime” 
out_model_definition = "C:/Data/pm2.5_trained_model.ecd" 
Out_importance_table = "C:/Data/pm2.5_importance_table.csv" 
max_num_trees = 50 
max_tree_depth = 30 
max_num_samples = 10000    

# Execute - train with random tree regression model 
arcpy.ia.TrainRandomTreesRegressionModel(in_weather_variables;in_dem_varaible, in_target, out_model_definition,  target_value_field, Target_date_field, Raster_dimension, max_num_trees, max_tree_depth, max_num_samples)

Licensing information

  • Basic: Requires Image Analyst
  • Standard: Requires Image Analyst
  • Advanced: Requires Image Analyst

Related topics