The Altair Community is migrating to a new platform to provide a better experience for you. The RapidMiner Community will merge with the Altair Community at the same time. In preparation for the migration, both communities are on read-only mode from July 15th - July 24th, 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.

How to create dummy variable intervals, such as for times?

mcmorri7mcmorri7 Member Posts: 1 Newbie
I am trying to use the nominal to numerical operator to create dummy variables. One of the attributes I want to convert is time (e.g. 12:30), but there are over 600 different times in the attribute data. I would like to assign each time data to an hour interval. Such as, all times from 7:00-7:59 would convert to a single dummy variable. Is there a way to have RapidMiner do this? Thank you for your help.


  • Options
    MarcoBarradasMarcoBarradas Administrator, Employee, RapidMiner Certified Analyst, Member Posts: 272 Unicorn
    You may use Day to Nominal if your attribute is identified as a day-time attribute. 
    With it you can extract only the Hour of your data and use it as a new attribute.

  • Options
    kypexinkypexin Moderator, RapidMiner Certified Analyst, Member Posts: 291 Unicorn
    Hi @mcmorri7
    all times from 7:00-7:59 would convert to a single dummy variable
    Do you actually want to convert this interval to, say, '7' regardless of the day? Or it should count different days also, like Feb 13 7:00 - 7:59 and Feb 14 7:00 - 7:59 should be counted as different time periods?

    If you don't want to distinguish between dates and only need time of day, simple way to do that is to use GENERATE ATTRIBUTES operator, create a new attribute called 'hour' and use an expression like date_get(date, DATE_UNIT_HOUR), which will generate corresponding hour variable. 

    In the second case it would be done in a different way. I'd suggest that you use DATE TO NUMERICAL to convert dates to milliseconds elapsed since 1970, then divide that by 1000*60*60 and round the result to get an absolute hour value.

    Hope this helps.  
Sign In or Register to comment.