Ask a question from expert

Ask now

CSE5DMI DATA MINING | About MATLAB function

12 Pages2071 Words366 Views
   

CSE5DMI DATA MINING (CSE5DMI)

   

Added on  2019-10-31

CSE5DMI DATA MINING | About MATLAB function

   

CSE5DMI DATA MINING (CSE5DMI)

   Added on 2019-10-31

BookmarkShareRelated Documents
DEPARTMENT OF COMPUTER SCIENCE AND INFORMATION TECHNOLOGYLA TOBRE UNIVERSITYCSE5DMI DATA MININGASSIGNMENT TWOSTUDENT NAMESTUDENT REGISTRATION NUMBERDATE OF SUBMISSION
CSE5DMI DATA MINING | About MATLAB function_1
DATA MININGQuestion 1(a)Create trained and test data in a Matlab function70% of the dataset used for training30% of the dataset used for testingThere are four matrices such that there are two class labels datasets and two attribute value data sets.Task 1: Data preparationThe wine quality dataset is loaded into the MATLAB workspace,[wineQtrain, wineQattr]=wine_dataset;The attribute values are split into training and test datasetsTrain_wineQ=wineQtrain(:,[1:500 601:1400 1601:1900]);Test_wineQ=wineQtrain(:,[501:600 1401:1600 1901:2000]);The accuracy results after the training,Accuracy46.1%Prediction speed~23000 obs/secTraining time33.801 sec
CSE5DMI DATA MINING | About MATLAB function_2
The class labels are split in the same way. Show training performance and submit code for the trainingfunction [Y,Xf,Af] = myNeuralNetworkFunction(X,~,~)% ===== SIMULATION ========% Format Input ArgumentsisCellX = iscell(X);if ~isCellX X = {X};end% DimensionsTS = size(X,2); % timesteps% Allocate OutputsY = cell(1,TS);% Time loopfor ts=1:TS% Input 1 X{1,ts} = X{1,ts}';% no processing% Layer 1 z1 = negdist_apply(IW1_1,X{1,ts}); a1 = compet_apply(z1);% Output 1 Y{1,ts} = a1; Y{1,ts} = Y{1,ts}';end% Final Delay StatesXf = cell(1,0);Af = cell(1,0);% Format Output Argumentsif ~isCellX Y = cell2mat(Y);endend% ===== MODULE FUNCTIONS ========% Negative Distance Weight Functionfunction z = negdist_apply(w,p,~)[S,R] = size(w);Q = size(p,2);if isa(w,'gpuArray') z = iNegDistApplyGPU(w,p,R,S,Q);else z = iNegDistApplyCPU(w,p,S,Q);endend
CSE5DMI DATA MINING | About MATLAB function_3
function z = iNegDistApplyCPU(w,p,S,Q)z = zeros(S,Q);if (Q<S) pt = p';for q=1:Q z(:,q) = sum(bsxfun(@minus,w,pt(q,:)).^2,2);endelse wt = w';for i=1:S z(i,:) = sum(bsxfun(@minus,wt(:,i),p).^2,1);endendz = -sqrt(z);endfunction z = iNegDistApplyGPU(w,p,R,S,Q)p = reshape(p,1,R,Q);sd = arrayfun(@iNegDistApplyGPUHelper,w,p);z = -sqrt(reshape(sum(sd,2),S,Q));endfunction sd = iNegDistApplyGPUHelper(w,p)sd = (w-p) .^ 2;end% Competitive Transfer Functionfunction a = compet_apply(n,~)if isempty(n) a = n;else [S,Q] = size(n); nanInd = any(isnan(n),1); a = zeros(S,Q,'like',n); [~,maxRows] = max(n,[],1); onesInd = maxRows + S*(0:(Q-1)); a(onesInd) = 1; a(:,nanInd) = NaN;endendDeploying the solution, one can obtain the Simulink neural network diagram as,
CSE5DMI DATA MINING | About MATLAB function_4

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Python Programming - Solutions
|13
|1857
|14

Computer Information System Assignment
|7
|654
|379

Designing a Linear Support Vector Machine using Supervised Learning Method
|18
|2148
|423

Annotated Bibliography on Stem Cell Transplantation for Alzheimer's Disease
|3
|673
|117

Desklib - Online Library for Study Material with Solved Assignments, Essays, Dissertation
|8
|1041
|397

Management Project Report
|6
|313
|38