Count the total of a specific value per Example

571131
571131 New Altair Community Member
edited November 2024 in Community Q&A

Hi,

 

I'm a Dutch student and have to work with Rapidminer, but can't figure something out.

I have a list of 140 restaurants. The restaurants have an option to provide a certain or multiple diets. There are 7 types of a diet they can provide (dairy-free/vegan/halal etc.). The values are shown as : 'True' or 'False'.

 

So this is how it looks:

Restaurant           Diet 1           Diet 2           Diet 3           Diet 4          ................................................etc

1                          True             False           False            False

2                          False            True            False            True

3                          False            False           True             False

4                          True             False           True             True

etc.

 

I would like to add a new attribute to show the total count of the value 'True'. In this way we know how many diets each restaurant can provide.

Restaurant           Diet 1           Diet 2           Diet 3           Diet 4          Total count of diets

1                          True             False           False            False                        1

2                          False            True            False            True                         2

3                          False            False           True             False                        1

4                          True             False           True             True                          3

 

I don't have the full knowledge when it comes to Rapidminer. Can someone please show me an easy way to add this new attribute?

 

Thanks in advance.

Tagged:

Answers

  • BalazsBaranyRM
    BalazsBaranyRM New Altair Community Member

    Hi!

     

    Use Map to change True to 1, False to 0.

    Then Parse Numbers, and Generate Aggregation over the sum of the line.

    Them map back the values to True and False if you need them in the original form.

     

    Regards,

    Balázs

  • kypexin
    kypexin New Altair Community Member

    I would add that a practice of encoding logical binary as 1/0 instead of True/False should always be considered a standard, and have helped in so many situations like calculating sums, ratios, aggregations etc, be it RapidMiner, Excel or anything else tool for analysis. At some point has become my 'must do' rule.