Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please fill the blanks: clearvars clc addpath('../Generation') addpath('../Basic_blocks') addpath('../Algorithms') % Loading scenarios % =========================== scenario=1; [data_class set_up]=scenarios_classification(scenario); % Definition of the problem %=================================== loss_logistic_L2 =

Please fill the blanks:

clearvars clc addpath('../Generation') addpath('../Basic_blocks') addpath('../Algorithms')

% Loading scenarios % =========================== scenario=1; [data_class set_up]=scenarios_classification(scenario);

% Definition of the problem %=================================== loss_logistic_L2 = ------------------------------; grad_logistic_L2 = ------------------------------; hess_logistic_L2 = @calculation_Hessian_logistic;

% Solution of the empirical risk using CVX %========================================= x_L2_cvx=solver_cvx(--------------------); loss_opt=loss_logistic_L2(set_up.Niter_train,set_up.Utrain(:,1:set_up.M+1),x_L2_cvx,set_up.ytrain(:,1),set_up.Lambda);

% Gradient descent out_gd =grad_FOM(set_up,@(N,A,x,y,lambda) grad_logistic_L2(N,A,x,y,lambda)); S =plot_surface(set_up,loss_logistic_L2,x_L2_cvx); close (figure(2)) figure(1),hold, plot(out_gd(1,:),out_gd(2,:),'g','LineWidth',3),hold off loss_grad=eval_loss(out_gd,set_up,@(N,A,x,y,lambda) loss_logistic_L2(N,A,x,y,lambda));

% Newton algorithm out_hess =grad_SOM(set_up,@(N,A,x,y,lambda) grad_logistic_L2(N,A,x,y,lambda),@(N,A,x,y,lambda) hess_logistic_L2(N,A,x,y,lambda)); S =plot_surface(set_up,loss_logistic_L2,x_L2_cvx); close (figure(2)) figure(1),hold, plot(out_hess(1,:),out_hess(2,:),'g','LineWidth',3), plot(out_gd(1,:),out_gd(2,:),'r','LineWidth',3), hold off loss_hess=eval_loss(out_hess,set_up,@(N,A,x,y,lambda) loss_logistic_L2(N,A,x,y,lambda)); pause

% Plot of learning curves plot(1:set_up.Niter_train,10*log10(sum((loss_grad-loss_opt*ones(1,set_up.Niter_train)).^2,1)),'b','LineWidth',3), hold plot(1:set_up.Niter_train,10*log10(sum((loss_hess-loss_opt*ones(1,set_up.Niter_train)).^2,1)),'r','LineWidth',3), hold off grid xlabel('Iterations') ylabel('MSE') title('Logistic L2 Algorithm')

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is LexisNexis Academic?

Answered: 1 week ago