Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using MeanShift with given bandwidth? #93

Open
brainbytes42 opened this issue Nov 10, 2020 · 0 comments
Open

Using MeanShift with given bandwidth? #93

brainbytes42 opened this issue Nov 10, 2020 · 0 comments

Comments

@brainbytes42
Copy link

Maybe I'm missing something - but is it possible tu use MeanShift-Clustering with a given (fixed) bandwidth?

As far as I follow the implementation, even if I provide the KDE with a set bandwidth to the MeanShift-Constructor, it gets overwritten in MeanShift's cluster-method by calling mkde.setUsingData(dataSet, parallel);:

@Override
public int[] cluster(DataSet dataSet, boolean parallel, int[] designations)
{
    // ...
    
    final KernelFunction k = mkde.getKernelFunction();
    mkde.setUsingData(dataSet, parallel);
    mkde.scaleBandwidth(scaleBandwidthFactor);
        
    // ...
}

Scaling the bandwidth seems not sufficient for me, as the scaled bandwidth isn't fixed. But as this is done inside the cluster-step, there seems to be no way to intercept or re-set the bandwidth...

A simple example how I've tried to use MeanShift:

SimpleDataSet dataSet = ...
double sigma = ...
MetricKDE metricKDE = new MetricKDE(GaussKF.getInstance(), new EuclideanDistance());
metricKDE.setBandwith(sigma); // <-- gets ignored!
MeanShift meanShift = new MeanShift(metricKDE);
List<List<DataPoint>> clusters = meanShift.cluster(dataSet); // <-- cluster trigger's bandwidth-estimation

Actually, it's obvious, that the Kernel-Density-Estimation wants to estimate the bandwidth, but in my case, I need a consistent bandwidth for multiple runs and need 'only' the clustering-step for the data.

Any help appreciated - thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant