Replace missing values with random values?

tek
tek New Altair Community Member
edited November 5 in Community Q&A
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!
Tagged:

Answers

  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    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
  • tek
    tek New Altair Community Member
    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!
  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    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