ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Train Maximum Likelihood Classifier

Available with Spatial Analyst license.

  • Summary
  • Usage
  • Syntax
  • Code Sample
  • Environments
  • Licensing Information

Summary

Generate an Esri classifier definition (.ecd) file using the Maximum Likelihood Classifier (MLC) classification definition.

Usage

  • To complete the maximum likelihood classification process, use the same input raster and the output .ecd file from this tool in the Classify Raster tool.

  • The input raster can be any Esri-supported raster with any valid bit depth.

  • To create a segmented raster dataset, use the Segment Mean Shift tool.

  • To create the training sample file, use the Training Sample Manager from the Image Classification toolbar. For information on how to use the Image Classification toolbar, see What is image classification?

  • Output Classifier Definition file (.ecd) contains attribute statistics suitable for the Maximum Likelihood Classification tool.

  • Segment Attributes is enabled only if one of the raster layer inputs is a segmented image.

Syntax

TrainMaximumLikelihoodClassifier (in_raster, in_training_features, out_classifier_definition, {in_additional_raster}, {used_attributes})
ParameterExplanationData Type
in_raster

Select the raster dataset you want to classify.

Raster Dataset | Segmented Raster | Mosaic Dataset | Raster Layer | Mosaic Layer | Image Service Layer
in_training_features

Select the training sample file or layer that delineates your training sites.

The input training sample file is the standard training sample file created using the existing training tools from the Spatial Analyst Image Classification toolbar, in either shapefile or feature class format.

Feature Layer | Raster Catalog Layer
out_classifier_definition

This is a JSON file that contains attribute information, statistics, hyperplane vectors and other information needed for the classifier. A file with an .ecd extension is created.

File
in_additional_raster
(Optional)

Optionally incorporate ancillary raster datasets, such as a segmented image or DEM.

Raster Dataset | Segmented Raster | Mosaic Dataset | Raster Layer | Mosaic Layer | Image Service Layer
used_attributes
(Optional)

Specify the attributes to be included in the attribute table associated with the output raster.

This parameter is only enabled if the SEGMENTED key property is set to true on the input raster. If the only input into the tool is a segmented image, the default attributes are COLOR, COUNT, COMPACTNESS, and RECTANGULARITY. If an in_additional_raster is also included as an input along with a segmented image, then MEAN and STD are available as options.

  • COLOR —The average chromaticity color, on a per-segment basis.
  • MEAN —The average digital number (DN), derived from the optional pixel image, on a per-segment basis.
  • STD —The standard deviation, derived from the optional pixel image, on a per-segment basis.
  • COUNT —The number of pixels comprising the segment, on a per-segment basis.
  • COMPACTNESS —The degree to which a segment is compact or circular, on a per-segment basis. The values range from 0 to 1, where 1 is a circle.
  • RECTANGULARITY —The degree to which the segment is rectangular, on a per-segment basis. The values range from 0 to 1, where 1 is a rectangle.
String

Code Sample

TrainMaximumLikelihoodClassifier example 1 (Python window)

The following Python window script demonstrates how to use this tool.

import arcpy
from arcpy.sa import *

TrainMaximumLikelihoodClassifier(
    "c:/test/moncton_seg.tif", "c:/test/train.gdb/train_features", 
    "c:/output/moncton_sig.ecd", "c:/test/moncton.tif", 
    "COLOR;MEAN;STD;COUNT;COMPACTNESS;RECTANGULARITY")
TrainMaximumLikelihoodClassifier example 2 (stand-alone script)

This example shows how to train a maximum likelihood classifier.

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


# Set local variables
inSegRaster = "c:/test/moncton_seg.tif"
train_features = "c:/test/train.gdb/train_features"
out_definition = "c:/output/moncton_sig.ecd"
in_additional_raster = "c:/moncton.tif"
attributes = "COLOR;MEAN;STD;COUNT;COMPACTNESS;RECTANGULARITY"

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

# Execute 
TrainMaximumLikelihoodClassifier(inSegRaster, train_features, out_definition, 
                                 in_additional_raster, attributes)

Environments

  • Compression
  • Current Workspace
  • Extent
  • NoData
  • Output CONFIG Keyword
  • Output Coordinate System
  • Pyramid
  • Raster Statistics
  • Scratch Workspace
  • Snap Raster

Licensing Information

  • ArcGIS for Desktop Basic: Requires Spatial Analyst
  • ArcGIS for Desktop Standard: Requires Spatial Analyst
  • ArcGIS for Desktop Advanced: Requires Spatial Analyst

Related Topics

  • An overview of the Segmentation and Classification toolset
  • What is image classification?
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal