update on loss functions

loss functions and per-variable gradients (maybe this could be merged with activations.jl in the future)