Options

Replace missing values with random values?

tektek Member Posts: 19 Contributor II
edited November 2018 in Help
Hi there,

is it possible to replace missing values in nominal attributes with random values?

I have a nominal ID (every feature has its own value, like a name), but some of them are missing. If I replace the missing values with average, min or max values, it would destroy the uniqueness of each feature. Can I tell RM to replace each of the missing values by a different value?

Thanks for the help!

Answers

  • Options
    Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    yes this is possible in the latest version of RapidMiner. You can add a "Generate Attributes" operator to your process and then click on edit list, and add.
    attribute name: choose the exact attribute name that contains missing values
    function expressions: if(missing(YOUR_ATTRIBUTE_NAME), round(rand()*YOUR_DESIRED_NUMBER), YOUR_ATTRIBUTE_NAME)

    this will replace all missing values with a random value in the range of your choice.

    Regards,
    Marco
  • Options
    tektek Member Posts: 19 Contributor II
    Hey there!

    This solution actually does not work. The problem is, it replaces missing values with random values of a range of that attribute. But I would like to replace missing values with random values that do not occour in the other values of this attribute. This is important because this attribute will become the ID, later in the process.

    So the replaced values have to be: not included in this attribute beforehand, may not repeat themselfes, should be random (so in case the count of missing values increases from one execution to another).

    I hope this specifies the problem a little better. : )

    Best regards!
  • Options
    Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    I'm afraid in that case you will have no choice but to use the Execute Script operator and write your own code.

    Regards,
    Marco
Sign In or Register to comment.