Skip to content

Commit

Permalink
Slight test refactoring (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikerRUS committed Mar 18, 2020
1 parent 46c6ab2 commit d058b8f
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions tests/assemblers/test_svm.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,28 +108,24 @@ def test_cosine_kernel():
actual = assembler.assemble()

def kernel_ast(sup_vec_value):
feature_norm = ast.SqrtExpr(
ast.BinNumExpr(
ast.FeatureRef(0),
ast.FeatureRef(0),
ast.BinNumOpType.MUL),
to_reuse=True)
return ast.BinNumExpr(
ast.BinNumExpr(
ast.NumVal(sup_vec_value),
ast.FeatureRef(0),
ast.BinNumOpType.MUL),
ast.IfExpr(
ast.CompExpr(
ast.SqrtExpr(
ast.BinNumExpr(
ast.FeatureRef(0),
ast.FeatureRef(0),
ast.BinNumOpType.MUL),
to_reuse=True),
feature_norm,
ast.NumVal(0.0),
ast.CompOpType.EQ),
ast.NumVal(1.0),
ast.SqrtExpr(
ast.BinNumExpr(
ast.FeatureRef(0),
ast.FeatureRef(0),
ast.BinNumOpType.MUL),
to_reuse=True)),
feature_norm),
ast.BinNumOpType.DIV)

expected = _create_expected_single_output_ast(
Expand Down

0 comments on commit d058b8f

Please sign in to comment.