Open main menu

Biolecture.org β

Dabeen Park/Matlab/ANN

Revision as of 13:38, 14 December 2017 by imported>DabeenPark (Created page with "<p>LABEL_COLUMN = 1;</p> <p> </p> <p>tr_data = csvread('mnist_train.csv',1 ,0);</p> <p>te_data = csvread('mnist_test.csv', 1, 0);</p> <p>n = size(tr_data...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

LABEL_COLUMN = 1;

 

tr_data = csvread('mnist_train.csv',1 ,0);

te_data = csvread('mnist_test.csv', 1, 0);

n = size(tr_data, 1);

 

training_label = tr_data(:, LABEL_COLUMN);

training_label(training_label == 0) = 10

training_label = dummyvar(training_label);

training_data = tr_data(:, LABEL_COLUMN+1:end);

 

test_label = te_data(:, LABEL_COLUMN)';

test_label(test_label == 0) = 10;

test_label = dummyvar(test_label);

test_data = te_data(:, LABEL_COLUMN+1:end);

 

predict_label = mnistClassifier(test_data);

[~, predict_label] =

acc = length(test_label == predict_label) / length(test_label);

disp(size(predict_label));

 

disp(acc);