The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Why does the Replace operator accepts only nominal values?
Christos_Karapapas
Member Posts: 25 Contributor II
The general concept of what I am trying to do is that I have trained a model and now I want to apply it on a single example.
My original dataset has too many attributes, so I thought, in order not to write all those values by hand, to just Store a part of it during training and then Retrieve and Filter by range 1-1 to get a single example.
And then just replace the values for just a few of its attributes and see the prediction.
So, when I use the Replace operator to replace the value of a nominal attribute everything is fine.
But when I use it to replace the value of an Integer attribute I get the following error "Wrong value type The attribute has value type Integer, should be Nominal".
Is there a way to avoid changing the type of the non-Nominal attributes to Nominal, just to perform a Replace operation and then changing them back to their original type?
The work around that I am trying is to convert from Numerical to Polynomial before the Replacement and then convert from Nominal to Numerical after the Replacement, for those specific attributes. However, this gives me an error during the Apply model that "The input ExampleSet does not match the training ExampleSet. Misfitting Attribute:myIntegerAttribute".
My original dataset has too many attributes, so I thought, in order not to write all those values by hand, to just Store a part of it during training and then Retrieve and Filter by range 1-1 to get a single example.
And then just replace the values for just a few of its attributes and see the prediction.
So, when I use the Replace operator to replace the value of a nominal attribute everything is fine.
But when I use it to replace the value of an Integer attribute I get the following error "Wrong value type The attribute has value type Integer, should be Nominal".
Is there a way to avoid changing the type of the non-Nominal attributes to Nominal, just to perform a Replace operation and then changing them back to their original type?
The work around that I am trying is to convert from Numerical to Polynomial before the Replacement and then convert from Nominal to Numerical after the Replacement, for those specific attributes. However, this gives me an error during the Apply model that "The input ExampleSet does not match the training ExampleSet. Misfitting Attribute:myIntegerAttribute".
0
Best Answer
-
sgenzer Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager@chris_skg the Discretize operators take numerical attributes as input and nominal attributes as output. So you will not get an error saying that you have numerical inputs when nominal are required.
For example, in the Golf sample data set, Temperature and Humidity are numerical attributes:
Discretize by Binning turns them into discrete nominal attributes:
You can of course customize a lot HOW the discretization happens.
Scott
7
Answers
So with that, I would say that if you really want to reduce the number of unique values in a numerical attribute, the more typical method is to use binning. See the whole series of "Discretize" operators in the Cleansing -> Binning folder of the operator panel.
Does that help?
Scott
So, if I understand it correctly, I will use one of the Discretize operators to convert the non-Nominal values of an attribute to a specific range of nominal values in order to make my Replacements. But then, after the Replacement, won't I stumble once again upon the same error of "The input ExampleSet does not match the training ExampleSet. Misfitting Attribute..." ?