How to use KNN to classify data in MATLAB

2 visualizzazioni (ultimi 30 giorni)
khusnul azima
khusnul azima il 28 Lug 2018
Commentato: Image Analyst il 1 Ago 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 Commenti
khusnul azima
khusnul azima il 1 Ago 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 il 1 Ago 2018
Unfortunately you forgot to attach 'tes.txt'. I'll check back later.

Accedi per commentare.

Risposte (1)

Image Analyst
Image Analyst il 28 Lug 2018
See attached demo.
  1 Commento
khusnul azima
khusnul azima il 1 Ago 2018
how to enter data/read data in the form of matrix and string in one execution.

Accedi per commentare.

Categorie

Scopri di più su Statistics and Machine Learning Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by