Download this file

9 lines (7 with data), 216 Bytes

1
2
3
4
5
6
7
8
function [Hv] = LogisticHv(v,w,X,y)
% v(feature,1) - vector that we will multiply Hessian by
% w(feature,1)
% X(instance,feature)
% y(instance,1)
sig = 1./(1+exp(-y.*(X*w)));
Hv = X.'*(sig.*(1-sig).*(X*v));