>
[Xtrain, ytrain, Xtest, ytest] = setupMnist(<span class="string">'binary'</span>, binary, <span class="string">'ntrain'</span>,<span class="keyword">...</span>
    Ntrain,<span class="string">'ntest'</span>, Ntest,<span class="string">'keepSparse'</span>, keepSparse);
Xtrain = Xtrain + 1; <span class="comment">% convert from 0:1 to 1:2</span>
Xtest  = Xtest  + 1;
</pre><h2>Fit<a name="2"></a></h2><pre class="codeinput">[n, d] = size(Xtrain);
NK     = length(Kvalues);
logp   = zeros(1, NK);
bicVal = zeros(