# TASK -1 (Calculation of the Hyperplane, Margin planes and Maximum Margin Value, using Support Vector Machines SVM)

Modeling and simulation

Assignment 1

ðŸ”µÂ TASK-1 (Calculation of the Hyperplane, Margin planes and Maximum Margin Value, using Support Vector Machines SVM)

Consider two sets of 2D data points, "negative" class AA, and "positive" class BB, given by the following MATLAB commands:

AA=[ 9,9; 10,5; 16,8; 14,1; 15,2; 12,8; 12,2; 15,6; 10,12; 13,13];
BB=[ -2,3; 1,6; 1,2; 2,4; -3,9; -1,5; -1,1; -5,6; -2,5; -4,3];

In order to avoid making a mistake with the transfer of the data (for example, missing a sign), it is recommended to use the "cut-and-paste" method.

For these two sets, design MATLAB script, which should be able to:
* clearly show on the plot your data and selected Support Vectors, marked with different colors for "positive" and "negative" classes;
* calculate the equation for the Hyperplane (for selected Support Vectors) and plot the Hyperplane on the same figure;
* calculate the Negative Margin Plane (Line) and plot it on the same figure;
* calculate the Maximum Margin Plane (Line) and plot it on the same figure;
* calculate the maximum margin value "m". Template of the resulting plot is presented in the illustration Figure.

ðŸ”µÂ (1) In the FIRST answer window below ENTER your calculated SCALED coefficients "a", "b" and "c" for the hyperplane equation of the format ax+by+c=0.
Note: your entered answer should have a strict specific format: having SEMICOLON (;) AFTER each MATLAB statement AND SPACE; but WITHOUT ANY other SPACES; use SMALL letters "a", "b" and "c" for the coefficients of the hyperplane. Round their values and enter values with FOUR DIGITS after the dot. Enter all four digits after the dot, even if the last digits are given with zeros. For example, for the demo in Consultation Notes, the answers for "a", "b" and "c" should be in the format:

a=0.2500; b=-0.2500; c=-0.7500;

I repeat myself: for quick marking, pls, follow this template, but enter YOUR OWN CALCULATED numbers for the "a", "b" and "c" matrix.

ðŸ”»Â IMPORTANT: your results will depend upon selection of the Support Vectors. In some cases, calculations of the Hyperplane should be repeated for a FEW DIFFERENT selections of Support Vectors to determine the unique set, resulting in the MAXIMUM MARGIN (out of all MAXIMUM MARGINS for the considered few cases with different sets of Support Vectors).

ðŸ”µÂ (2) In the SECOND answer window ENTER your solution for "m" - the MAXIMUM MARGIN. Your entered answer should have a strict specific format, having SEMICOLON (;) AFTER MATLAB statement; WITHOUT ANY SPACES; use SMALL letter "m" for the value of the maximum margin. Round its value and enter as answer with TWO DIGITS after the dot. Enter all two digits after the dot, even if the last digits are given with zeros. For example, for the demo in Consultation Notes, the answer for "m" should be in the format:

m=5.66;

Figure-1: Figure-1: Example from Consultation Wk 9. Plotted 2D data points for two classes, with superimposed three Support Vectors, Hyperplane and Negative/Positive Margin Planes (Lines) and the Scaled Equation of the Hyperplane shown in the Title of the figure. Attempt to produce similar plot, using your data.

Must exactly match pattern below in quotes (but without quotes). You may wish to "cut-and-paste" it for further modification with your own calculated numbers. Do not use signs "plus" for positive values. In case of negative numbers, please, use the same sign "minus", as in this template: "a=0.2500; b=-0.2500; c=-0.7500;"

10 points

Must exactly match pattern in quotes (but without quotes): "m=5.66;" You may wish to "cut-and-paste" it for further modification with your own calculated numbers. Do not use spaces and sign "plus" in the answer.

10 points

Task-1: THIRD ANSWER WINDOW: SUBMIT YOUR MATLAB SCRIPT AS ONE (SINGLE) FILE INTO THE WINDOW BELOW, using 'cut-and-paste' method, cutting the script from your *.M file. The first line should have: double percentage, space, and your student number with 's', similar to the pattern '%% s3456789'*

(Please copy and paste the MATLAB CODE here. Donâ€™t put any screen shot)

ðŸ”µÂ TASK-2 ("BASICS" of Linear Classifiers and SVM)

A rectangular forest block is shown in the Figure, which also shows with small circles trees/plants on this block of land. Coordinates of its corners can be retrieved from the title of the Figure.

Exact XX and YY coordinates for each plant is provided in the MATLAB data file, which can be retrieved, using this link:Â https://drive.google.com/file/d/1Ta3gurh5cWxlofWBcd7sa-WYAPFeSCxJ/view?usp=sharing

ðŸ“šÂ Alternatively, IF you are more comfortable with EXCEL data, you can retrieve the same coordinate numbers XX and YY from the Excel file (which has no headings, and which has XX and YY coordinates saved in the first and second columns):

XX=data(:,1)'; YY=data(:,2)';" from Command window or include as proper command in MATLAB script. Note: provided MATLAB sample commands load XX and YY as rows (and not as columns). Omit transposition signs to get XX and YY as columns.

Forest block has been divided by its diagonals into four triangular areas, and trees/plants in the area of interest were marked by black "x" symbols.

USE LINEAR CLASSIFIERS and DETERMINE THE NUMBER OF PLANTS in the area, marked by "x".

ðŸ›‘Â It is compulsory to use LINEAR CLASSIFIERS method. Solutions by other methods will not be accepted.

Figure-2: Map of the forest block of land with marked trees/plans.

SUBMIT YOUR MATLAB SCRIPT FOR Task-2 AS ONE (SINGLE) FILE INTO THE WINDOW BELOW, using 'cut-and-paste' method, cutting the script from your *.M file. The first line should have: double percentage, space, and your student number with 's', similar to the pattern '%% s3456789'*

(Please copy and paste the MATLAB CODE here. Donâ€™t put any screen shot)

Consider deep feedforward ANN with its weights and biases, specified in Figure. This ANN has one input layer, two hidden layers and one output layer.

For simplicity, assume, that activation function for each node is an identity function, i.e. a linear function with UNIT coefficient: g(x)=x.

For known outputs y1 = 369; y2 = âˆ’19; Â y3 = 316 and known second input x2 = âˆ’14, determine the first input x1, given by the positive or negative integer with absolute value less than 100 (this condition can be expressed as follows: |x1|<100).

Figure-3: Given deep ANN with one input layer, two hidden layers and one output layer.

SUBMIT YOUR MATLAB SCRIPT FOR Task-3 AS ONE (SINGLE) FILE INTO THE WINDOW BELOW, using 'cut-and-paste' method, cutting the script from your *.M file. The first line should have: double percentage, space, and your student number with 's', similar to the pattern '%% s3456789'*

(Please copy and paste the MATLAB CODE here. Donâ€™t put any screen shot)

ðŸ”µÂ TASK-4 (Combination of the "BASICS" of ANNs and loops, being powerful enhancement of the simulation methods)

Consider recursive feedforward deep ANN with one input layer, 700 hidden layers and one output layer. [An example of much simpler recursive ANN with only THREE hidden layersis shown in Figure.]

Assume, the same sets of weights and biases for ALL nodes of the ANN.
Use the following data (pay attention to the signs in numbers):
* recursive given weights: w11 = 0.3; w12 = âˆ’0.6; w21 = âˆ’0.2; w22 = 0.8;
* recursive given biases: b1 = âˆ’14; b2 = 2;
* given inputs: x1 = 1; x2 = 2.

For simplicity, assume, that the recursive activation function for each node is an identity function, i.e. a linear function with UNIT coefficient: g(x)=x.

Determine the value of y2 âˆ’ the second output of this deep ANN.

Figure-4: An example of the recurrent ANN with one input layer, only THREE hidden layers and one output layer. Note, that this is an illustration only, as in case of your assignment task, the number of hidden layers is much larger!

10 points

-410

-208

16

275

490

550

SUBMIT YOUR MATLAB SCRIPT FOR Task-4 AS ONE (SINGLE) FILE INTO THE WINDOW BELOW, using 'cut-and-paste' method, cutting the script from your *.M file. The first line should have: double percentage, space, and your student number with 's', similar to the pattern '%% s3456789'*

(Please copy and paste the MATLAB CODE here. Donâ€™t put any screen shot)

Hire ExpertÂ

Get a Professional Help

200
Select FileChangeRemove

TOP

Limited Time Offer! - 20% OFF on all Services Get Expert Assistance Today!

X