How to use KNN to classify data in MATLAB

2 Ansichten (letzte 30 Tage)
khusnul azima
khusnul azima am 28 Jul. 2018
Kommentiert: Image Analyst am 1 Aug. 2018
I'm having trouble understanding how the K-NN classification works in MATLAB. 'Here's the problem, I have a large dataset 30 out of 90 subjects.
form a dataset like this:
359.872,317.948, Under-ripe
316.988,257.132, ripe
346.748,30.782, Over-ripe
I once tried and the result: Error using load Unknown text on line number 1 of ASCII file aa.txt
In short, I want to - divide the data into 3 groups - "train" KNN and want to know validation.
I hope you can help me, thank you in advance
  3 Kommentare
khusnul azima
khusnul azima am 1 Aug. 2018
i have tried some load function to import data but data will not appear in the form of matrices and strings.
an example of a tested load
1.fileID = fopen('tes.txt');
2.A=load('tes.txt')
3.dlmread
My file consist in columns like this :
value      value     string
359.87  317.948   Under-ripe
Image Analyst
Image Analyst am 1 Aug. 2018
Unfortunately you forgot to attach 'tes.txt'. I'll check back later.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 28 Jul. 2018
See attached demo.
  1 Kommentar
khusnul azima
khusnul azima am 1 Aug. 2018
how to enter data/read data in the form of matrix and string in one execution.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by