-
Notifications
You must be signed in to change notification settings - Fork 2k
Dimension compare of weights to data, during kmeans and like #647
Comments
Hi there, Many thanks for opening the issue! However, I have to say that the check is as intended. The vector of weights passed to the .Learn method should have the same length as the number of training instances. They are indeed per-sample weights, not per-dimension, so the check should be correct. Please, may I ask if you found a case where it doesn't work as intended? If yes please let me know and I will investigate. Thanks! |
Cool, thanks for taking the time to reply. So I assume if I want to increase the importance of a dimension in relation to another I need to apply that weighting myself? I was under the impression that is what it was, but now I see the use of applying the weight across the sample. |
Yes, unfortunately if you would like to increase the importance of a column you might need to apply a weighting scaling before calling K-Means. You can also try to implement a weighted Euclidean distance as well, by taking the Euclidean.cs class as a base but multiplying a weight vector before doing the sum of squares. I might add support for this in the next release, thanks for the idea! |
Wow thanks, thats awesome. |
Added in release 3.6.0. |
I tried to add pull request ...
Currently it is
if (x.Length != weights.Length)
throw new DimensionMismatchException("weights", "Data w....
I believe it should be
if (x**# [0]**.Length != weights.Length)
throw new DimensionMismatchException("weights", "Data w....
the weighting should be apply to each element in the array of arrays, not to each element in the array.
The text was updated successfully, but these errors were encountered: