# What are the signs that a classification just wont work?

Basically, I've a simple question:
Are there signs which tells me that I just can't classify my data?

To make things clear, I've a dataset whereby i try to predict the amount of tires changes.
But something tells me that this will be quite hard.

For example, here is a sneak peak of my training set.

• 2148 -- 0 tires changes
• 230 -- 1 tires change
• 1984 -- 2 tires changes
• 570 -- 3 tires changes
• 2791 -- 4 tires changes
• 889 -- 5 tires changes
• 2645 -- 6 tires changes
• 807 -- 7 tires changes
• 1819 -- 8 tires changes
• 512 -- 9 tires changes
• 1699 -- +9 tires changes

As you can see, it is very unbalanced, especially with the odd amount of tires changes.

Furthermore, in my dataset, I've +/- 150 features and 95% of those features are basically, dummy data e.g.

• gear_4_dummy -- {0,1}
• gear_5_dummy -- {0,1}
• gear_6_dummy -- {0,1}
• gear_7_dummy -- {0,1}
• doors_3_dummy -- {0,1}
• doors_5_dummy -- {0,1}
• seats_2_dummy -- {0,1}
• seats_5_dummy -- {0,1}
• break_dummy -- {0,1}
• berline_dummy -- {0,1}
• sport_dummy -- {0,1}
• ...

and inly 5% of the data are numbers e.g.

• price -- numeric
• tire_size -- numeric
• end_km -- numeric
• km_a_year -- numeric
• car_price -- numeric
• ...

Now the thing is, whatever I try the results are just awful...
I've tried Regression, I've tried classification, I've tried clustering.
But all of them won't give me a decent result.

The best thing I can do is +:- 20-35% of accuracy but that would almost be the same as guessing because of the unbalanced data ...

For example, this is what I did recently:

• I created a training/val set (data > 2003 and data <=2012)
• I created a test set (data > 2013)
• I resampled the training/val set (randomly) in such a way that my target class (amount of tires changes) represented each class, equally
(This would mean that, every class contains 460 participants)
• 460 -- 0 tires changes -- (random sample)
• 460 -- 1 tires changes -- (doubled the amount)
• 460 -- 1 tires changes -- (random sample)
• 460 -- 1 tires changes -- (random sample)
• ...
• By resampling the training set, I believe that the classifier won't be tempted to bias the even pair tires changes. (or with other words, odd pair tires changes are also important)
• I trained / tested my dataset
• Decision tree
• Random forrest
• Naive Bayesian
• Logistic regression
• Regression
• ...

Without any difference

# But

When i took a look, and investigated my data even more then before. I saw something strange.
And that is basically the purpose of my question.

when I investigated the data (in weka) (I was working in python/notebooks/sklearn)
I noticed something. And I wanted to ask if it is normally...
Thus when I looked at my data, I noticed that all of my targets are almost equally represented in each and every variable/parameter/bucket/data piece.

E.G
here is a picture with my target data, after the resampling
And here are data pictures from other features, whereby the Target features are in coller

Start year

End year

Sales year

Lifecycle ages

Month vs new model

rw per

**end km **

**Euro **

**4th quarter **

Tire diameter

# As you can see,

It is just like that every column contains a proportional equal amount of target values. (I even would say, it looks like it is for 80-90% random) ...

In contrast, If you look at the Iris data set for example.

Then we see clearly, different things. Like for example, not every column contains a proportional equal amount of target values. And it makes much more sense that a classifier can classify this data set much better. (you can almost do it by just looking at it.

a picture of my confusion matrix

Nevertheless. If someone has some (good) tips or ideas, or an answer on my question. I will always appreciate that.

# Regression (sklearn)

As mentioned before, I also tried to execute a regression model But the results where also not that good. (probably because of the lack of numeric values?)

What I tried was:

• Loop over all the Features
• Calculate the P-value and MSE
• Take the Feature with the best result
• Loop over all the Features in combination with my previous best feature set
• Calculate the P-value and MSE
• Take the best new features set
• Loop over all the Features in combination with my previous best feature set
• ...

The above algorithm is a bit simplified (I putted every improvement in a priority queue and took the best value, to calculate a new regression (i removed previous calculated feature sets))

Here under, you can see a list, of combinations and values

P-value, MSE, #Features, Features-used

0.23001432437,10.624070884777447,1,end_kms
0.252706916701,10.310964138620037,2,tire_diameter,end_kms
0.261575392281,10.188599117839662,3,tire_diameter,end_duration,end_kms
0.269643515788,10.077277155947542,4,personalcar_dummy,tire_diameter,end_duration,end_kms
...
130 iterations further
...

• Wouldn't "predict the amount of tires changes" be more a regression problem than a classification one? – GeoMatt22 Apr 30 '17 at 14:54
• @GeoMatt22 - My best p-value was 0,42 with a MSE of 10 :s – Dieter Apr 30 '17 at 14:55
• Too long question, couldn't read it all, but I have a suggestion: find a more appropriate evaluation metric. Predicting (exactly) the number of tire changes might be unfeasible, but is it actually necessary? Perhaps an expected value and a prediction interval would be better. Also, give a look at ordered regression (ordered logistic regression) and poisson regression as well. – Firebug Apr 30 '17 at 15:06
• I would take @Firebug's comment seriously w.r.t. length. In particular, I do not think the extensive diagnostic figures are likely to get you a better answer, and may or may not be relevant to your issue. (At the least, you could consolidate the data distributions into one figure, cropping vs. full-on screen-caps; and also omit the Iris figures) – GeoMatt22 Apr 30 '17 at 15:31
• I'd recommend treating this as a regression problem; if you predict 3 changes and the actual is 4, that's pretty good. If you predict 3 and the actual is 9, that's not so great. And personally I'd try a randomForest -- as a regression, not as a classifier. It's plausible to me that most of your variables aren't important, e.g. number of seats. – zbicyclist Apr 30 '17 at 15:51

Besides poorly forming the overly long question you are using classification in an incorrect context. You need risk estimation. See http://www.fharrell.com/2017/01/classification-vs-prediction.html

Also be sure to use a proper accuracy score: http://www.fharrell.com/2017/03/damage-caused-by-classification.html

very long question.. however, let me tell that classification algorithms usually tries to pick the repeated patterns and adds rules accordingly. no matter how the format of your data looks like. It only depends on the classifier's ability to find these hidden patterns. Numerical values sometimes cause a problem if they vary widely and thus cause messy kind of logic. Sometimes you can limit the data ranges to reduce the classifier bias towards big values by either normalizing the data to limit their ranges and thus make the learning process easier or you can build your own rules to turn the numerical values to nominal ones to ease the learning process on your classifier. as an example for such rules:

if age ranges between 00-20 --> young
if age ranges between 20-40 --> Middle-age
if age ranges between 40-60 --> old


it may also fail in classification if the missing values of the data is huge . However, if this is the case, preprocessing your data before classification should be the best option for you.

Hope that helps.