Sample Problem% Half MoonClassifier using RBF% NN toolboxclc;clear all;close all;%% dataload('HalfmoonData.mat');rad = 10;% central radius of the half...

1 answer below »












Sample Problem







% Half Moon








Classifier using RBF






% NN toolbox






clc;






clear all;






close all;






%% data






load('HalfmoonData.mat');






rad = 10;








% central radius of the half moon






width = 6;








% width of the half moon






dist = -4;








% distance between two half moons






% Normalize








data






meanD = [mean(halfmoonData(1:2,:)')';0];








% mean of the original data






maxD








= [max(abs(halfmoonData(1:2,:)'))';1];% max of the original data






norData = mapminmax(halfmoonData(:,:));






net = newrb(norData(1:2,:),norData(3,:),0.01); % Create new RBF NN






%% Test network performance






y = net(norData(1:2,:));






hold on;






% Plot classification results






figure;






hold on;






yOut = ones(1,length(norData));






for i = 1:length(y)






xx








= maxD(1:2,:).*norData(1:2,i) + meanD(1:2,:);






if y(:,i)>0






yOut(:,i) = 1;






plot(xx(1),xx(2),'r*');






end






if y(:,i)<>






yOut(:,i) = -1;






plot(xx(1),xx(2),'ko');






end






end






xlabel('x');ylabel('y');






title(['Classification using MLP with dist = ',num2str(dist), ', radius = ',...






num2str(rad), ' and width = ',num2str(width)]);






% Calculate








accuracy






accuracy = perfCalc(y,halfmoonData(3,:),2)


















Homework 6 Problem 1. Design an RBF NN that approximates the mapping z = f(x, y), given by z = cos(3x)sin(2y) over the area determined by −1 ≤ x ≤ 1 and −1 ≤ y ≤ 1. (20 pts) Problem 2. In this problem you will train a neural network to classify hand-written digits. The steps that will be used for solving this problem will be similar to your project. We provided the required dataset and you will have to design a neural network architecture. 1. Understand the data. We provided the code to visualize the data. Check the dimension of input and targets. If they are not in correct dimensions, make changes so tat they can be used for training. Also check if the data can be normalized. 2. Start with a random model (choose optimization model, learning rate, number of hidden layers etc.) 3. Train the model. Observe training and validation accuracies. Make sure they are not over-fitting or under-fitting. 4. If the model is either over-fitting or under-fitting, make changes to your initial model for improving the accuracies and explain the changes you made. 5. Finally, if you think that the accuracy cannot be further improved, test your trained model on test data. 6. Give the details of your model along with learning curves. Note: The best classification accuracy for MNIST dataset is ≈ 0.99. This kind of accuracy is possible only when using convolutional neural networks. Since we are using only neural networks, you need not worry about getting very high accuracy. (80 pts) You can use MATLAB toolbox for this homework. 1
Answered 1 days AfterMar 18, 2023

Answer To: Sample Problem% Half MoonClassifier using RBF% NN toolboxclc;clear...

Sathishkumar answered on Mar 20 2023
38 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here