Validation of logistic regression algorithm

#1
Hi,

I'm new in machine learning and logistic regression area, and in MATLAB area, too. I'm doing logistic regression in machine learning. Until now, I have defined ML learning algorithm with Newton method and decision boundary on variables.

Since I defined logistic regression algorithm, I guess that I must defined parameters of the logistic regression, too, in order to prove validation of my algorithm.

My input (x) is MSExcel file with two columns (750x2), and output (y) is MSExcel file with 0 and 1 (750x1). For input I have two variables that affect on output.

For ML learning algorithm I have used 4th order polynomial equation. I hope so that my MATLAB code is valid for computing betas, deviation, stand. error, loglikehood, deviance, and Wald test. The code is:

x = xlsread('input.xls');
y = xlsread('output.xls');
n=4; %degrees of freedom

b=glmfit(x,[y ones(750,1)],'binomial','link','logit'); %define betas
[b,dev,st]=glmfit(x,[y ones(750,1)],'binomial','link','logit') %define betas, deviation, stand. error

[yfit,ylo,yhi] = glmval(b, x,'logit',st);
logLikelihood = sum(log( binopdf( y, n,yfit))) %define loglikehood

betas = b;
AIC = -2*logLikelihood + 2*numel(betas);


[st.beta st.se st.t st.p]

yfit= glmval(b, x,'logit','size',n);
dev=sum(log(binopdf(y,n,yfit./n))) - sum(log(binopdf(y,n,y./n))) %define deviance


[h,p,ci] = ztest(b,dev,1 )% wald test

My questions are:
1. Is my code valid, or I must change something?
2. Do I need some more parameters for defining validation of logistic regression?

Thanks in advance