



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Given a set of example input/output pairs, find a rule that does a good job of predicting the output associated with a new input.
makeTrainData.m
trainData = zeros(21, 100); tempImage = zeros(10,10);
for i = 1: filename = strcat('alif', int2str(i),'.bmp'); tempImage = imread(filename); trainData(i,:) = reshape(tempImage,1,100); end
for i = 1: filename = strcat('bay', int2str(i),'.bmp'); tempImage = imread(filename); trainData(i+7,:) = reshape(tempImage,1,100); end
for i = 1: filename = strcat('jeem', int2str(i),'.bmp'); tempImage = imread(filename); trainData(i+14,:) = reshape(tempImage,1,100); end
targetData = zeros(21,3);
targetData(1:7,1) = 1; targetData(8:14,2) = 1; targetData(15:21,3) = 1;
save 'trainData' trainData targetData ;
makeTestData.m
testData = zeros(9, 100); tempImage = zeros(10,10);
for i = 1: filename = strcat('alif', int2str(i),'.bmp'); tempImage = imread(filename); testData(i,:) = reshape(tempImage,1,100); end
for i = 1: filename = strcat('bay', int2str(i),'.bmp'); tempImage = imread(filename); testData(i+3,:) = reshape(tempImage,1,100); end
for i = 1: filename = strcat('jeem', int2str(i),'.bmp'); tempImage = imread(filename); testData(i+6,:) = reshape(tempImage,1,100); end
targetData = zeros(9,3);
targetData(1:3,1) = 1; targetData(4:6,2) = 1; targetData(7:9,3) = 1;
save 'testData' testData targetData;