fit feature weights using training data