fixed a lot of bugs in training algos. implemented VCTSM inference. added SGD function and switched all training to use it, with LBFGS functions for old versions.