Label | Explanation | Data Type |
Input Features | The features or table from which subsets will be created. | Table View |
Output Training Feature Class | The subset of training features that will be created. | Feature Class; Table |
Output Test Feature Class (Optional) | The subset of test features that will be created. | Feature Class; Table |
Size of Training Feature Subset (Optional) | The size of the output training feature class, entered either as a percentage of the input features or as an absolute number of features. | Double |
Subset Size Units (Optional) | Specifies whether the subset size value will be used as a percentage of the input features or as an absolute number of features.
| Boolean |
Summary
Divides the records of a feature class or table into two subsets: one subset to be used as training data, and one subset to be used as test features to compare and validate the output surface.
Usage
-
In the Random number generator environment, only the Mersenne Twister option is supported. If other options are chosen, Mersenne twister will be used instead.
Splitting a dataset into training and test features is common in interpolation, machine learning, and other analytical workflows that involve estimating and building models from data.
If multipart features are used as input, the output will be a subset of multipart features, not individual features.
Parameters
arcpy.ga.SubsetFeatures(in_features, out_training_feature_class, {out_test_feature_class}, {size_of_training_dataset}, {subset_size_units})
Name | Explanation | Data Type |
in_features | The features or table from which subsets will be created. | Table View |
out_training_feature_class | The subset of training features that will be created. | Feature Class; Table |
out_test_feature_class (Optional) | The subset of test features that will be created. | Feature Class; Table |
size_of_training_dataset (Optional) | The size of the output training feature class, entered either as a percentage of the input features or as an absolute number of features. | Double |
subset_size_units (Optional) | Specifies whether the subset size value will be used as a percentage of the input features or as an absolute number of features.
| Boolean |
Code sample
Randomly split the features into two feature classes.
import arcpy
arcpy.env.workspace = "C:/gapyexamples/data"
arcpy.SubsetFeatures_ga("ca_ozone_pts", "C:/gapyexamples/output/training",
"", "", "PERCENTAGE_OF_INPUT")
Randomly split the features into two feature classes.
# Name: SubsetFeatures_Example_02.py
# Description: Randomly split the features into two feature classes.
# Requirements: Geostatistical Analyst Extension
# Import system modules
import arcpy
# Set environment settings
arcpy.env.workspace = "C:/gapyexamples/data"
# Set local variables
inPointFeatures = "ca_ozone_pts.shp"
outtrainPoints = "C:/gapyexamples/output/training.shp"
outtestPoints = ""
trainData = ""
subsizeUnits = "PERCENTAGE_OF_INPUT"
# Execute SubsetFeatures
arcpy.SubsetFeatures_ga(inPointFeatures, outtrainPoints, outtestPoints,
trainData, subsizeUnits)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes