Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikerRUS committed Mar 9, 2020
1 parent edab901 commit a498f0a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions m2cgen/assemblers/svm.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,6 @@ def _cosine_kernel(self, support_vector):
ast.BinNumOpType.ADD,
*[utils.mul(ast.FeatureRef(i), ast.FeatureRef(i))
for i in range(len(support_vector))]))
elem_wise = [
utils.mul(ast.NumVal(support_element_norm), ast.FeatureRef(i))
for i, support_element_norm
in enumerate(support_vector / support_vector_norm)
]
kernel = utils.apply_op_to_expressions(
ast.BinNumOpType.ADD, *elem_wise)
kernel = self._linear_kernel(support_vector / support_vector_norm)
kernel = utils.div(kernel, feature_norm)
return kernel

0 comments on commit a498f0a

Please sign in to comment.