필터 지우기
필터 지우기

How can I compare all test samples with training samples by euclidean distance?

조회 수: 1 (최근 30일)
Hello
The features of the images were extracted, 60 training images and 20 images for test.
Use the euclidean distance to compare the test samples with the training samples.
test_template2= repmat(test_template1,1,size(trdata,2));
E_distance = sqrt(sum((test_template2-euclidean_template).^2));
[result indxofmin]=min(E_distance)
Using this code I can compare one sample of the test samples with all the training samples.
How can I compare all test samples with training samples and give the closest sample number for each sample of the test?

채택된 답변

Image Analyst
Image Analyst 2018년 7월 24일
Use pdist2() from the Statistics and Machine Learning Toolbox.
  댓글 수: 1
wisam kh
wisam kh 2018년 7월 25일
thank you sir
But if you have an example, I will be grateful to you.
Thank you again

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by