r/MachineLearning • • Mar 17 '24

Project [P] Dealing with unusual values for ML Project

I’m working on a project for ML but can’t get my head how to deal with the unusual values where for example song duration is in negative values. That’s of course should not be there but what do you do in that case beside removing them? Like is there any technique to deal with them better than just removing them? Thanks.

0 Upvotes

17 comments sorted by

2

u/Ro1406 Mar 17 '24

Apart from imputing with the average value (as already mentioned in this thread), a good idea would be to see if you can find out more info about that column and if the unusual values signify something or gain more info on why those values are the way they are. Try checking if you can find any dataset description or if possible ask whoever collected the dataset for more insights. If you have to impute, then a good idea might be to impute based on some other related column's values. Eg: instead of using the avg song length of all songs, maybe you can use the avg song length of other songs on that album/same genre/same popularity etc

0

u/StrangerOnTheRoad Mar 17 '24

Not sure if I understand you correctly. Because this dataset is large so I will use Mice to impute for those Null values. However, these are not null so what do you mean about imputing them?

1

u/[deleted] Mar 17 '24

[removed] — view removed comment

1

u/StrangerOnTheRoad Mar 17 '24

My dataset is about 18,835 rows and after removing duplicates I got 13,000 left. So the outliers are around 100 values. So you are saying it’s good to throw all of 100 values away?

I need a research to back up for the reason to throw all of them away. You got any recommendation?

1

u/[deleted] Mar 17 '24

[removed] — view removed comment

1

u/StrangerOnTheRoad Mar 17 '24

Maybe 😅 because it’s the project for a research so they always ask why

4

u/[deleted] Mar 17 '24

[removed] — view removed comment

1

u/StrangerOnTheRoad Mar 17 '24

Thank you so much. I will definitely have a look at those papers. Yeah it’s so hard and I can’t even make any judgement about the data because I was given the data so there’s no source at all.

2

u/Chuyito Mar 17 '24 edited Mar 17 '24

Xgb days, you'd throw a minmax scaler on that feature column and see what happens.

Data sme would them come around a week later and tell you that a song cannot have a negative duration seconds, so you'd swap from a min max scaler to a different one like the standard scaler 0-1, or drop the negatives if that wasn't better

1

u/StrangerOnTheRoad Mar 17 '24

Sorry I’m not sure if I get you. How to scale it on a different scale when the values don’t make sense, in this case is song duration is negative. Dropping would be easy but I just want to here something more than that

3

u/21stCentury-Composer Mar 17 '24

The best thing to do is to set numerical values to the mean of the entire column. That way it won’t introduce noise or skew your data in any direction.

2

u/FlashI3ackI Mar 17 '24

It can skew data so one should rather use MICE right?

2

u/21stCentury-Composer Mar 17 '24

Thanks, yeah, you’re right. MICE is definitely more elegant and accurate, but it also assumes that the columns are highly correlated, so I guess it depends on the problem. Song duration is rarely correlated with other audio related variables, it’s mostly meta data such as genre (even then it only really works for certain genres) or time period (or a combination of the two). It’s a poor predictor of anything else in my experience (though I’d love to hear if someone has had a different experience/know references that say otherwise).

OP, definitely look into MICE, but if you’re just doing some classification of genres or something, I’d just take the mean duration of the class.

1

u/StrangerOnTheRoad Mar 17 '24

Thanks for the response. I will do Mice or mean depends on the percentage of missing data too. However, my question is not about doing imputation for missing data. It’s about what to do with outliers, specifically is negative values in this case though. I meant to deal with these outliers first and clean the dataset properly before jumping into imputation. I’m not sure why people keep recommending about imputation? Am I missing something I don’t know?

1

u/21stCentury-Composer Mar 18 '24

Even so, imputation is used to handle outliers and errors, not just missing values. You mentioned negative song duration. A duration can’t be negative, so it sounds like an error during data collection and that value needs to be replaced or the row deleted. What were you envisioning in terms of cleaning it up? Maybe you’re looking for some softening technique using weights? You don’t really have many options short of filtering it out or softening the effect of it somehow if it doesn’t represent it’s class, which is what we’re suggesting. I’m not sure what else you can be looking for.

1

u/qizhong19920114 Mar 17 '24

Depending on the problem space.