3 ms·
Julia has a lot of rough edges. For example, the dataframe support is primitive. Type issues show up all over the place; for example, if you extract a column
by x0x0 13y ago
Julia has a lot of rough edges. For example, the dataframe support is primitive. Type issues show up all over the place; for example, if you extract a column from a dataframe, then combine it with other columns via [], it sometimes fails if the column you extracted is first and succeeds otherwise. Saving matrices is still really primitive; nowhere near as good as R or matlab. In julia, you still have to remember what you put in the file and how big it is.
Nonetheless, julia is awesome and if you haven't tried it you're missing out. It's pleasant to work in in a way that numpy + python isn't. It's a higher performance R, one which has a hope of scaling to the sizes of data I want to use. You can almost always write in matrix notation then decay to loops if necessary.
a toy irls implementation looks like:
sigma = function(X)
1/(1 + exp(-X*beta))
end
beta = zeros( size(X,2) );
max_iter = 50
iter = 0
converged = false
while iter < max_iter && ~converged
s = sigma(X);
cost = sum(Y .* log(s) + (1 - Y).*log(1 - s));
grad = X' * (s - Y);
H = X' * diagm( s .* (1-s) ) * X;
d = H\-grad;
# print([beta d])
beta_new = beta + d;
delta = norm(beta_new - beta);
beta = beta_new; # NB: exact hessian so no line search
@printf("iter: %d; beta delta %f log like %f\n", iter, delta, cost)
iter += 1
if delta < 1e-4 converged = true end
end
beta
If you haven't tried it and you're an R or numpy user, you should give it a try immediately. Lots of people seems to use ipython or ipython in the browser to efficiently use the repl with code. I prefer tmux with 2 windows; vim in the left, julia in the right, and vim-slime to move code over.