![]() |
#11
|
|||
|
|||
![]() Quote:
Quote:
|
#12
|
|||
|
|||
![]()
@Sendai
What values for Ein do you get when running your algorithm with Lloyds centers? I think I am still somewhere off the track ![]() |
#13
|
|||
|
|||
![]()
centres = [[ 0., 0.], [ 0.66666667, 0.66666667]]
Ein = 0 centres = [[ 0.66666667, 0.33333333], [ 0., 1.]] Ein = 0 centres = [[ 1. , 0.5], [ 0. , 0.5]] Ein = 0.5 (The weight are all zeros -- RBF can't break the symmetry and fails.) |
#14
|
|||
|
|||
![]()
I had a difficult bug to find here, in R. Beware, other R users. I ran the first example, and it was just fine. I ran the second example, and got nothing like the right answer. What? said me.
I had been using my own linear regression program, since it was conveniently to hand. But I knew it worked. So I tried the builtin R linear regression, which gave the correct answer. I noticed that in my own linear regression, I was calling ginv, the pseudo-inverse function. I called solve, the actual inverse function (why you get the inverse of a square matrix by calling "solve" is beyond me, but I digress). That worked. Finally I realized that our little example is quite a nasty matrix. The tolerance for ginv was something like 1E-8. Not small enough! Once I lowered the tolerance, everything was dandy. |
#15
|
|||
|
|||
![]()
Thanks heer2351 and Sendai. Indeed there are 6 different centre-configurations, the ones you gave complete the picture. You can also see this with paper&pencil.
Quote:
Anything else you get, you know your code has a bug. I have not tried it with my code, but Sendai's results seem correct. So you should get Ein =0 for the centres that have 1/3 or 2/3 in them (when the clusters are 3-1 points) and Ein = 0.5 when the centres have 1/2 in them (the case were the clusters are 2-2points) I also think that it might be impossible to get Ein= 0.25 for any centre configuration, providing that the weights are chosen optimally (i.e., using the pseudo inverse method). So you either make no mistakes, or 2 points are misclassified. |
#16
|
|||
|
|||
![]()
Geez, I don't get the same weights! I do get Ein=0 though. Could you post your phi matrix so that I can locate my error? thanks.
Quote:
|
#17
|
|||
|
|||
![]() Quote:
Code:
[[ 1. 0.96078944 0.22537266] [ 1. 0.35345468 0.61262639] [ 1. 0.52729242 0.33621649] [ 1. 0.19398004 0.91393119]] |
#18
|
|||
|
|||
![]()
Sendai thanks for starting this thread, it enabled me to find a flaw in my code and even better fix it
![]() All answers I found with my fixed code were correct. Special thanks to boulis for his first response, I was overthinking the problem. |
#19
|
|||
|
|||
![]()
Ah ha, I see how you got that but I think that you need to take the square root after you add up the distance of each data point to the cluster centers. You did not take the square root. I think you have to IMHO.
|
#20
|
|||
|
|||
![]()
If you see the formula, you'll notice that the norm is getting squared. So no need to take the square root in the first place.
|
![]() |
Thread Tools | |
Display Modes | |
|
|