The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 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
Assigning class based on multiple attributes
Hey folks,
Sorry looking for help on how to start a problem. I have a CSV file with 15 attributes all of which are numeric with a range of 1-20 for each attribute. I want to create a classification based on which attribute is scored 20. Only one of the attributes per each record should be scored 20. I only want to have 4 classs for example Man, Woman, Boy, Girl, so if one of the first three atrributes is 20 then I want to classify it as a Man, if one of attributes four to six is 20 I want classifiy it as a woman. I hope this makes sense, any help is much appreciated.
Neil.
Sorry looking for help on how to start a problem. I have a CSV file with 15 attributes all of which are numeric with a range of 1-20 for each attribute. I want to create a classification based on which attribute is scored 20. Only one of the attributes per each record should be scored 20. I only want to have 4 classs for example Man, Woman, Boy, Girl, so if one of the first three atrributes is 20 then I want to classify it as a Man, if one of attributes four to six is 20 I want classifiy it as a woman. I hope this makes sense, any help is much appreciated.
Neil.
0
Best Answer
-
varunm1 Member Posts: 1,207 UnicornHi Neil, @b00122599
So you are trying to create a new column with one of the four classes based on a value in attributes. If this is what you are trying to do, You can use "generate attribute" operator with expression using IF statement and write nested if functions. If you can inform you attribute names and conditions like which attributes should be compared for Man etc. we can help. Sample Nested If statement which might be useful is below. Please correct me if my understanding is not correct. a1, a2 .. are attribute 1, 2 ...The above expression is IF a1 is 20 then "Man" else it will check a2, similarly all the nested statements until any condition is satisfied.if (a1==20, "Man", if (a2==20, "Man", if (a3==20, "Man", if (a4==20, "Women", if (a5==20, "Women", if (a6==20, "Women", "Boy"))))))
ThanksRegards,
Varun
https://www.varunmandalapu.com/Be Safe. Follow precautions and Maintain Social Distancing
6
Answers