How to estimate the density threshold separately for each dimension.

I need to find the density threshold separately for each dimension.
In this step,objects in each of the D attributes are arranged in increasing order.A closely packed 5 elements region in it is identified and in case of tie,it is resolved randomly.The window size is set to 5 elements (subspace clusters having less than 5 objects are assumed to be non significant).The maximum seperation between two consecutive elements in the group is rounded to next decimal point and is recorded as density threshold.
How can I do that please help me. The dataset is attached here.

11 Comments

Using a window is it possible to find those density for clustering.How can I do that.
Is it possible to use
How can I set my windowsize.This showing error like
Matrix dimensions must agree.
Error in test1 (line 22)
windCoord = data(i,:) + windowSize/2.*[1,1;-1,-1]; %[UpperLeft, UpperRight; LowerLeft, LowerRight]
coordinates
It would help if you posted your whole code, plus a little more info on what exactly you need to find.
I need to estimate the density threshold seperately for each dimension,using a window.The maximum seperation between two consecutive elements in the group is rounded to next decimal point and is recorded as the density threshold for that dimension.
First finding the density of each dimension after that I need to form 1-D cluster using supspace clusters for each dimension.
data=xlsread('Ecolixl.xlsx');
figure();
plot(data(:,1),data(:,2), '-ob')
axis equal
hold on
windowSize = [6,20];
ouCount = inCount;
onCount = 0;
wh = gobjects(1);
th = text(min(xlim()),max(ylim()),'Count: 0', 'VerticalAlignment', 'top','FontSize',14);
for i = 1:size(data,1)
windCoord = data(i,:) + windowSize/2.*[1,1;-1,-1];
[in,on] = inpolygon(data(:,1),data(:,2),windCoord([2,1,1,2,2]),windCoord([4,4,3,3,4]));
inCount(i) = sum(in);
onCount(i) = sum(on);
delete(wh)
wh = plot(windCoord([2,1,1,2,2]),windCoord([4,4,3,3,4]), 'r-');
th.String = sprintf('Count: %d',inCount(i));
drawnow
pause(.1)
end
I used the above code form that site.
Then Iam getting error
Matrix dimensions must agree.
Error in test1 (line 22)
windCoord = data(i,:) + windowSize/2.*[1,1;-1,-1]; %[UpperLeft, UpperRight; LowerLeft, LowerRight]
coordinates .
Can you edit your post and format the code as code so people can copy and paste it easily? Also, can you show a screenshot? And say what "density threshold separately for each dimension" means. Perhaps dbscan() would be good but I don't know (not having seen your data).
How can I find density of each dimension using dbscan().
So you, knowing your own data, and reading up on dbscan in WIkipedia and the MATLAB documentation on dbscan, have decided that I guessed right and dbscan is what you want to do? I'm not really sure I can help you more than you could do yourself by studying that documentation. After all, you have your data (not me), and you can always call the Mathworks for help with their sbscan() function.
Thank you Sir.
Can you please tell me what is the purpose of sbscan()?
Can I use dbscan() for finding the dense regions of the data?
Well that's what it's famed for. So, over the past 7 days, did you actually try it? If not, why not. Did you at least try any examples in the help? If not, why not? And please don't say something like "I'm just a beginner so I can't run examples from the help."
Yes sir I tried. Iam not a beginner but also Iam not an expert.Over the past days I studied and understand the problem. I also tried lots of examples using dbscan() and distance measures. But I didn't get the accurate answer. I need help.Thank you.

Sign in to comment.

Answers (1)

Hi Silpa,
In your code, your data variable is 336x7 such that data(i,:) is 1x7, causing the dimension mismatch error you're getting.
Use data(i,1:2) instead.
HTH,
Sylvain

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Asked:

on 7 Jan 2020

Commented:

on 16 Jan 2020

Community Treasure Hunt

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

Start Hunting!