Made compatible with polynomial kernel