Forest-based Classification and Regression - Error 110194: The Variable type

2004
4
03-02-2020 05:54 AM
BartłomiejGajc
Emerging Contributor

I am trying to use Forest-based Classification and Regression tool in ArcGIS Pro and have all explanatory values as rasters. One of them is categorical (land use), the rest are double data type. It works well for Train only prediction type but fails when I try to predict to raster. For now I want to create an output raster for exact the same area as explanatory rasters using .... the same rasters so I actually do not match any explanatory rasters. but I get the error: 110194: The Variable type in the training dataset <value> dataset is different than the variable <value> in the predicted dataset.

When looking at the error description page I find this reason: The most likely reason that a field cannot be represented as categorical is that it is stored as a Double or Long type.

The thing is that my land use raster is represented as long integers with associated string descriptions in the attribute table.

Does anyone know the practical solution for that?

Thanks,

Bart

0 Kudos
4 Replies
WilliamBaker1
Emerging Contributor

I am having the same problem, getting error 110194. Since that error message says "The most likely reason that a field cannot be represented as categorical is that it is stored as a Double or Long type." That seems quite odd, since yes the usual expectation is that a categorical raster would be "Long type" as are the 6 rasters I am trying to use. But, given this message, I tried the following: I created a new field called "Text" in each raster's attribute table, then Saved edits. Then, I selected the Text field and used Field Calculator to set it equal to the "Value" field. Then, I deleted the "Value" field. Then, I added a new "Value" field and used the Field Calculator to set it equal to the "Text" field. This turns the "Value" field from Double to Text data type. Then, I went back and reran the Forest program with these 6 rasters NOT checked as Categorical. Everything ran fine with no more error 110194. The summary of the model seems to show that the 6 rasters are used as though they are categorical, but I have no way to confirm that this is really the case. However, oddly, if I check Categorical for the 6 rasters, then the model fails again with error 110194. Something seems to me to be wrong in the coding or the explanation for how to use categorical variables. It seems to me that it should be possible to have a Categorical raster with data type Long, check the categorical box, and have everything run correctly, but in ArcGIS Pro 2.6, this does not appear to work for me. If anyone else has ideas about this problem, please chime in. I am no expert, just fooled around a little and seem to have found a little more out about this problem.

0 Kudos
WilliamBaker1
Emerging Contributor

Oops forgot to mention that when I created those fields called "Text" I also set their data type to Text and when I finally created the new "Value" field I also set that data type to "Text"

0 Kudos
by Anonymous User
Not applicable

Hello Bartłomiej,

Thank you for reaching out about this issue. The main problem here is the misleading error message. This problem arises when some categories in the prediction dataset does not exist in the training dataset. For instance, say one of your predictors in training is land-use with categories Forest, Water, Built and the prediction land-use raster has categories Forest, Water, Built, Farm. The extra category in your prediction raster triggers this error message which is a misleading error message. Since Forest-Based Classification and Regression (FBCR) cannot use the unseen category, Farm, in prediction, it throws this error. This is a known issue and we are working on a fix.

We also have a workaround for this problem.

1. Extract categories used in training. Run the FBCR tool in training mode and output "Output Training Features". The tool automatically extracts all the category values used in training to this feature class.

2. Find unique categories. Run Summary Statistics tool on the Output Training Feature Class from Step 1, with the field defined as the field containing extracted land use categories with statistic type Count and define the same field as the case field in the tool. This creates a feature class that contains counts of unique categories. Alternatively,  you can do a Ascending Sort on the Output Training Feature Class from Step 1 and make a note of all the unique categories.

3. Make a raster mask for the unique categories from Step 2 on the prediction raster. For this step, you would use run the raster calculator on your prediction raster with the following expression. Code below assumes that in step 2 you found that unique categories were Forest, Water and Built in your training dataset

InList("name_of_pred_raster", ['Forest', 'Water', 'Built'])

The output of this tool will be the masked prediction raster that only contains the categories in your training raster.

4. Go back to FBCR and switch the mode over to Predict to Raster. For the land use raster use the raster output from Step 3.

Please reach out if the workaround does not work.

Best,

Orhun

WilliamBaker1
Emerging Contributor

Orhun,

Great, I tried your workaround and it ran perfectly. Thank you so much!

Bill Baker

0 Kudos