Class Probability (Spatial Analyst)
Summary
Creates a multiband raster of probability bands, with one band being created for each class represented in the input signature file.
Usage
-
Any signature file created by the Create Signature, Edit Signature, or Iso Cluster tools is a valid entry for the input signature file. These will have a .gsg extension.
-
This tool employs Bayesian statistics to estimate class probabilities. Bayesian statistics involves starting with prior information about the data, then updating that information after the data is collected. The prior information about the data values is quantified with a priori probabilities, which are then adjusted by the likelihood function to receive posterior probabilities (the updated information). The likelihood function is defined by the data values for each class/cluster.
The input a priori probability file must be an ASCII file consisting of two columns. The values in the left column represent class IDs. The values in the right column represent the a priori probabilities for the respective classes. Valid values for class a priori probabilities must be greater than or equal to zero. If zero is specified as a probability, no associated probability band will be created for the class in the output multiband raster. The sum of the specified a priori probabilities must be less than or equal to one. An example showing the format of the file as follows:
1 .3 2 .1 4 .0 5 .15 7 .05 8 .2
The classes omitted in the file will receive the average a priori probability of the remaining portion of the value of one. In the above example, all classes from 1 to 8 are represented in the signature file. The a priori probabilities of classes 3 and 6 are missing in the input a priori probability file. Since the sum of all probabilities specified in the above file is equal to 0.8, the remaining portion of the probability (0.2) is divided by the number of classes not specified (2). Therefore, classes 3 and 6 will each be assigned a probability of 0.1.
The extension for the input a priori probability file can be .txt or .asc.
-
If the input is a layer created from a multiband raster with more than three bands, the operation will consider all the bands associated with the source dataset, not just the three bands that were loaded (symbolized) by the layer. If you want to process a subset of the bands in the source dataset, you can use the Make Raster Layer tool to create an input layer containing the desired bands.
-
The value entered for maximum output value sets the upper range of the values in the output probability bands. The default value of 100 creates a multiband raster with each band containing integer values ranging from 0 to 100. Any integer value greater than zero is valid for maximum output value. Only the value of one for the maximum output value argument will result in bands having floating-point values.
Syntax
Parameter | Explanation | Data Type |
in_raster_bands [in_raster_band,...] |
The input raster bands. Raster bands can be integer or floating point. | Raster Layer |
in_signature_file |
Input signature file whose class signatures are used to generate the a priori probability bands. A .gsg extension is required. | File |
maximum_output_value (Optional) |
Factor for scaling the range of values in the output probability bands. By default, the values range from 0 to 100. | Long |
a_priori_probabilities (Optional) | Specifies how a priori probabilities will be determined.
| String |
in_a_priori_file (Optional) | A text file containing a priori probabilities for the input signature classes. An input for the a priori probability file is only required when the FILE option is used. The extension for the a priori file can be .txt or .asc. | File |
Return Value
Name | Explanation | Data Type |
out_multiband_raster |
The output multiband raster dataset. If the output is an ESRI GRID, the filename cannot have more than 9 characters. | Raster |
Code Sample
This example creates a multiband raster of probability bands for each class in a signature file.
import arcpy from arcpy import env from arcpy.sa import * env.workspace = "C:/sapyexamples/data" outClassProbability = ClassProbability("redlands","C:/sapyexamples/data/wedit5.gsg", 100,"EQUAL","") outClassProbability.save("c:/sapyexamples/output/classprob")
This example creates a multiband raster of probability bands for each class in a signature file.
# Name: ClassProbability_Ex_02.py # Description: Creates probability layers for each class in a signature file. # Requirements: Spatial Analyst Extension # Author: ESRI # Import system modules import arcpy from arcpy import env from arcpy.sa import * # Set environment settings env.workspace = "C:/sapyexamples/data" # Set local variables inRaster = "redl123" inSigFile = "c:/sapyexamples/data/wedit5.gsg" maxValue = 100 aPrioriWeight = "EQUAL" aPrioriFile = "" # Check out the ArcGIS Spatial Analyst extension license arcpy.CheckOutExtension("Spatial") # Execute ClassProbability outClassProbability = ClassProbability(inRaster,inSigFile, maxValue, aPrioriWeight, aPrioriFile) # Save the output outClassProbability.save("c:/sapyexamples/output/classprob01")