Question: Complete the MATLAB Code in lines 49 and 51: The script below generates one 1-D dataset of two classes of data, a positive class (+1)

Complete the MATLAB Code in lines 49 and 51:

Complete the MATLAB Code in lines 49 and 51: The script below

generates one 1-D dataset of two classes of data, a positive class

(+1) and a negative class (-1), and proceeds to plot the feature's

The script below generates one 1-D dataset of two classes of data, a positive class (+1) and a negative class (-1), and proceeds to plot the feature's probability distribution. It also plots the distributions given each class (the likelihoods). These distributions can be used to find the probability of a feature falling between an interval a and b. In the script below, the default values of a and bare 5 and 10. The script, Script C Reset BE MATLAB Documentation 1 %---generate two classes of data, each with slightly different distributions 2 rng(1); X1 - 2*randn (1000,1); X2 - 5*randn(1080,1)+5; X = [X1;X2]; &feature vector y = [ones(1000,1);-1*ones (1800,1)); target vector 7 %---make a histogram of the data & Xplay with vector "bins", but set it to its default value (-10:0.5:20] when submitting 9 mins = [start:increment: stop! 10 bins = [-10:0.5:20]; 11 h = histogram(X,bins, 'Normalization', 'probability); %make a histogram with edges specified in "bins" 12 binValues - h. Values; %keep bin heights 13 pos = histogram(x(y==1), bins, 'Normalization', 'probability'); Xhistogram of only the positive class 14 binvalues_pos = pos. Values; *keep bin heights neg = histogram(x(y==-1),bins,"Normalization', 'probability'); thistogram of only the negative class binvalues_neg = neg. Values; Xkeep bin heights close all 19%---plot the distribution without bars 20 figure() 21 plot(bins(1:end-1), binValues) 22 grid on 23 xlabel('feature value') 24 ylabel('distribution') 25 title( 'Distribution of x'). 26 27 %---plot likelihood given positive class 28 figure() 29 plot(bins(1:end-1), binValues_pos) 30 grid on 31 xlabel('feature value') 32 ylabel('likelihood of positive class'). 33 title( 'Distribution of x Given It Belongs To Positive Class') 35 %---plot likelihood given negative class 36 figure() 37 plot(bins(1:end-1), binValues_neg) 38 grid on 39 xlabel('feature value'). 40 ylabel('likelihood of negative class') 41 title('Distribution of x Given It Belongs to Negative class') 43%---approximate probability of x between a and b 44 %play with a and b. Return them to their defaults of a=5 and b=10 when submitting. 45 a = 5; b = 10; 46 indices = find(bins >= a & bins

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!