Ideas for a DBSCAN with different epsilon values in each dimension?

3 次查看(过去 30 天)
Hi Community
Im clustering some 3D data points usiang DBSCAN.
I want to define a non uniform neighnorhood radio for my DBSCAN. For example, using epsilon = 15 for X and Y axis, but epsilon = 5 for the Z axis.
Some ideas?
Thx

回答(1 个)

Sreeram
Sreeram 2024-8-9
Hi Felipe,
I understand that you want to define a non-uniform neighbourhood radius for DBSCAN in MATLAB. However according to the documentation, the dbscan function in MATLAB does not allow non-uniform epsilon values.
In DBSCAN, the epsilon parameter defines the radius of the neighbourhood around each point. For your example, by scaling the Z-axis data by the ratio of epsilon along X and Y axes to epsilon along Z axis, you effectively normalize the different epsilon value for the Z axis. You can pass the epsilon value along X and Y axis to the dbscan function. This ensures that the distance calculations in the DBSCAN algorithm make use of the desired non-uniform neighbourhood radius.
Here's how you can code it:
% Desired epsilons
epsilon_xy = 15;
epsilon_z = 5;
% Scale the Z-axis data
scale_z = epsilon_xy / epsilon_z; % Scaling factor
scaled_data = data;
scaled_data(:, 3) = scaled_data(:, 3) * scale_z;
% Apply DBSCAN on the scaled data
labels = dbscan(scaled_data, epsilon_xy, minPts); % Note that epsilon_xy is used here
You may read more about how DBSCAN works here: https://www.mathworks.com/help/stats/dbscan-clustering.html
Hope it helps.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by