🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

(Poly)Nominal to Numeric: Keep Value

User: "btibert"
New Altair Community Member
Updated by Jocelyn
I do not want to recode nominal datatypes for coding in machine learning, but simply take the nominal value and convert it to it's numeric equivalent.  I often do this in my teaching to show how if a data type is read incorrectly, we can convert it to a new type.  From what I see, the options are more inline with converting for modeling purposes, which is great, but if Age, for example, comes in as polynominal, I dont want to recode the age of 21 to 0 given the range of values. 

Simply, I want the Age to be converted to numeric 21, an age of 34 to be converted to numeric 34, etc.

Find more posts tagged with

Sort by:
1 - 5 of 51
    User: "btibert"
    New Altair Community Member
    OP
    I could use Execute R to do this for mapping for me, but that seems overkill for something as simple as changing text to numeric (a basic option in Excel).  Thanks for your help on this.
    User: "varunm1"
    New Altair Community Member
    Updated by varunm1
    Hello @btibert

    I can think of two ways. One way is to try "Guess Type" operator. It re guesses the type of attribute. If guess types doesn't work, the other way is to use nominal to numerical operator. This doesn't change numerical values in the nominal attribute but changes attribute type to numerical.
    User: "btibert"
    New Altair Community Member
    OP
    Thanks @varunm1.

    Guess Type kept things as Nominal, and Nominal to Numerical requires a coding type, all of which attempt to transform the data for modeling.  In my case, all I need to do is retain the value but just change the type.  Optionally, if I want the column to be numeric and the value can't be cast to numeric, have the data missing.  In R, this is often done with as.numeric(), and is something easily done in point-and-click tools like Excel.  The ability to cast for modeling is fantastic, but I am looking for something even more elementary.


    User: "varunm1"
    New Altair Community Member
    Thanks for your response. There is one other way to just change the type. If your data is in the repository, you can right-click and click on edit. Then you can see data in Data editor, here you can right-click on attribute name and select "modify attribute", then change the attribute type to "numeric" and save. I am not exactly sure what is happening in backend for this. @mschmitz might suggest.
    User: "MartinLiebig"
    Altair Employee
    Accepted Answer
    Hi @btibert and @varunm1,

    i think the operator 'Parse Numbers' is just straight up solving your problem.

    Cheers,
    Martin