implementation of Platts SMO algorithm