midterm.doc

3 Pages
76 Views
Unlock Document

Department
Computer Science
Course
COMPSCI 776A
Professor
Andrew S
Semester
Spring

Description
x12. for i =1:n if x(i)==3; k=k+1; end end display(k); 13. x1=a(:,5); x2=a(17,:); x3=a(1:10,1:10) x4=a(1:2:end,12) 14. 0~1 y=(x-MinValue)/(MaxValue-MinValue) y=log10(x) y=atan(x)*2/PI 15. n=20; %row m=10; %col b=rand(n,m); column_means=zeros(m,1); for i=1:m column_sum=0; for j=1:n column_sum=column_sum+b(j,i); end column_means(i)=column_sum/n; end 16. n=19; nums=randperm(n,n); sepnums=NaN(2,ceil(n/2)); x1 = nums(find(rem(nums(:),2)==1));%odd x2 = nums(find(rem(nums(:),2)==0));%even sepnums(1,1:size(x1,2))=x1; sepnums(1,1:size(x2,2))=x2; 17. %%a freeposn=3; topfive=randperm(20,5); topfive((freeposn+1):end)=topfive(freeposn); %%b topfive=zeros(1,5); freeposn=3; a=randperm(20,10); [sorted_a,index]=sort(a,'descend'); topfive=sorted_a(1:5); topfive((freeposn+1):end)=topfive(freeposn); 18. n=10; predictedclass=round(rand(1,n))+1; actualclass=round(rand(1,n))+1; %%compute the prediction accuracy of the prediction implied error=(actualclass~=predictedclass); prediction_accuracy=1-sum(error)/n; %%compute a confusion matrix, a 2 × 2 array %% predicted 1 and
More Less

Related notes for COMPSCI 776A

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit