UC-MACSS / persp-model-econ_W19

Course site for MACS 30150 (Winter 2019) - Perspectives on Computational Modeling for Economics
16 stars 50 forks source link

Questions on PS6 2(e) #13

Closed jsgenan closed 5 years ago

jsgenan commented 5 years ago

In the question, if we set K=2, then observation 4 and 6 will be in the neighborhood, but they are red and green respectively. How should we handle situations like this?

liu431 commented 5 years ago

I think we should expand K by 1 if this happens. An odd number of K when having an even number of classes could avoid the tie. Or we could calculate other distance metrics such as Manhattan and cosine instead of Euclidean.

jsgenan commented 5 years ago

Sorry I forgot to @rickecon

rickecon commented 5 years ago

@jsgenan . For equal probability, you just need an arbitrary tie break rule. An example would be if you get 0.5, choose the highest category. You could also have more sophisticated rules like choosing the class that would be chosen in K=J+1 KNN classifier. This is really just a bad example on the problem set.