added ability to weight max margin loss