Skip to content

Commit

Permalink
generate Haskell examples
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikerRUS committed Apr 27, 2020
1 parent ba900a5 commit 875a965
Show file tree
Hide file tree
Showing 13 changed files with 439 additions and 0 deletions.
23 changes: 23 additions & 0 deletions generated_code_examples/haskell/classification/decision_tree.hs
@@ -0,0 +1,23 @@
module Model where
score :: [Double] -> [Double]
score input =
func0
where
func0 =
if (((input) !! (2)) <= (2.45))
then
[1.0, 0.0, 0.0]
else
if (((input) !! (3)) <= (1.75))
then
if (((input) !! (2)) <= (4.95))
then
if (((input) !! (3)) <= (1.6500001))
then
[0.0, 1.0, 0.0]
else
[0.0, 0.0, 1.0]
else
[0.0, 0.3333333333333333, 0.6666666666666666]
else
[0.0, 0.021739130434782608, 0.9782608695652174]
93 changes: 93 additions & 0 deletions generated_code_examples/haskell/classification/lightgbm.hs
@@ -0,0 +1,93 @@
module Model where
score :: [Double] -> [Double]
score input =
[(func2) / (func9), (func5) / (func9), (func8) / (func9)]
where
func0 =
if (((input) !! (2)) > (3.1500000000000004))
then
if (((input) !! (0)) > (6.450000000000001))
then
-1.1736122903444903
else
-1.1736122903444903
else
if (((input) !! (1)) > (3.35))
then
-0.9486122853153485
else
-0.9598622855668056
func1 =
if (((input) !! (2)) > (3.1500000000000004))
then
if (((input) !! (2)) > (4.450000000000001))
then
-0.07218200074594171
else
-0.0725391787456957
else
if (((input) !! (1)) > (3.35))
then
0.130416969124648
else
0.12058330491181404
func2 =
exp (((0) + (func0)) + (func1))
func3 =
if (((input) !! (2)) > (1.8))
then
if (((input) !! (3)) > (1.6500000000000001))
then
-1.1840003561812273
else
-0.99234128317334
else
-1.1934739985732523
func4 =
if (((input) !! (3)) > (0.45000000000000007))
then
if (((input) !! (3)) > (1.6500000000000001))
then
-0.06203313079859976
else
0.11141505233015861
else
if (((input) !! (2)) > (1.4500000000000002))
then
-0.0720353255122301
else
-0.07164473223425313
func5 =
exp (((0) + (func3)) + (func4))
func6 =
if (((input) !! (3)) > (1.6500000000000001))
then
if (((input) !! (2)) > (5.3500000000000005))
then
-0.9314095846701695
else
-0.9536869036452162
else
if (((input) !! (2)) > (4.450000000000001))
then
-1.115439610985773
else
-1.1541827744206368
func7 =
if (((input) !! (2)) > (4.750000000000001))
then
if (((input) !! (2)) > (5.150000000000001))
then
0.12968922424213622
else
0.07468384042736965
else
if (((input) !! (1)) > (2.7500000000000004))
then
-0.07311533184609437
else
-0.06204412771870974
func8 =
exp (((0) + (func6)) + (func7))
func9 =
((func2) + (func5)) + (func8)
4 changes: 4 additions & 0 deletions generated_code_examples/haskell/classification/linear.hs
@@ -0,0 +1,4 @@
module Model where
score :: [Double] -> [Double]
score input =
[((((9.774126241420623) + (((input) !! (0)) * (-0.41545978008486634))) + (((input) !! (1)) * (0.9619661444337051))) + (((input) !! (2)) * (-2.5028461157608604))) + (((input) !! (3)) * (-1.0766107732916166)), ((((2.248771246116064) + (((input) !! (0)) * (0.5239098915475155))) + (((input) !! (1)) * (-0.3177027667958222))) + (((input) !! (2)) * (-0.20333498652290763))) + (((input) !! (3)) * (-0.9399605394445277)), ((((-12.022897487538232) + (((input) !! (0)) * (-0.10845011146263966))) + (((input) !! (1)) * (-0.6442633776378855))) + (((input) !! (2)) * (2.7061811022837774))) + (((input) !! (3)) * (2.01657131273614))]
45 changes: 45 additions & 0 deletions generated_code_examples/haskell/classification/random_forest.hs
@@ -0,0 +1,45 @@
module Model where
addVectors :: [Double] -> [Double] -> [Double]
addVectors v1 v2 = zipWith (+) v1 v2
mulVectorNumber :: [Double] -> Double -> [Double]
mulVectorNumber v1 num = [i * num | i <- v1]
score :: [Double] -> [Double]
score input =
mulVectorNumber (addVectors (func0) (func1)) (0.5)
where
func0 =
if (((input) !! (3)) <= (0.8))
then
[1.0, 0.0, 0.0]
else
if (((input) !! (2)) <= (4.8500004))
then
[0.0, 0.9622641509433962, 0.03773584905660377]
else
if (((input) !! (3)) <= (1.75))
then
if (((input) !! (3)) <= (1.6500001))
then
[0.0, 0.25, 0.75]
else
[0.0, 1.0, 0.0]
else
[0.0, 0.0, 1.0]
func1 =
if (((input) !! (3)) <= (0.8))
then
[1.0, 0.0, 0.0]
else
if (((input) !! (0)) <= (6.1499996))
then
if (((input) !! (2)) <= (4.8500004))
then
[0.0, 0.9090909090909091, 0.09090909090909091]
else
[0.0, 0.0, 1.0]
else
if (((input) !! (3)) <= (1.75))
then
[0.0, 0.8666666666666667, 0.13333333333333333]
else
[0.0, 0.0, 1.0]
63 changes: 63 additions & 0 deletions generated_code_examples/haskell/classification/svm.hs
@@ -0,0 +1,63 @@
module Model where
score :: [Double] -> [Double]
score input =
[(((((((((((((((((((0.11166728251449935) + ((func1) * (-0.7546041223284677))) + ((func2) * (-0.0))) + ((func3) * (-0.0))) + ((func4) * (-0.8877695556805599))) + ((func5) * (-0.0))) + ((func6) * (-0.0))) + ((func7) * (-0.8877695556805599))) + ((func8) * (-0.0))) + ((func9) * (-0.0))) + ((func10) * (-0.8877695556805599))) + ((func11) * (-0.8877695556805599))) + ((func12) * (0.8877695556805599))) + ((func13) * (0.0))) + ((func14) * (0.8877695556805599))) + ((func15) * (0.0))) + ((func16) * (0.7126145313390118))) + ((func17) * (0.04198959098945601))) + ((func18) * (0.8877695556805599))) + ((func19) * (0.8877695556805599)), (((((((((((((((((-0.043064448593694335) + ((func20) * (-0.3790553204589494))) + ((func21) * (-0.0))) + ((func22) * (-0.0))) + ((func23) * (-0.3790553204589494))) + ((func24) * (-0.3730604955455548))) + ((func25) * (-0.09964456068725433))) + ((func26) * (-0.26645281866213855))) + ((func27) * (-0.0))) + ((func28) * (-0.3790553204589494))) + ((func12) * (0.3790553204589494))) + ((func13) * (0.05589866243098008))) + ((func14) * (0.3790553204589494))) + ((func15) * (0.3790553204589494))) + ((func16) * (0.0))) + ((func17) * (0.0))) + ((func18) * (0.30420389200501824))) + ((func19) * (0.3790553204589494)), ((((((((((((((((((((2.1222908467070423) + ((func20) * (-109.16681524774745))) + ((func21) * (-109.16681524774745))) + ((func22) * (-105.17803142414256))) + ((func23) * (-17.487321182626303))) + ((func24) * (-0.0))) + ((func25) * (-71.97838649684462))) + ((func26) * (-0.0))) + ((func27) * (-12.773209867105617))) + ((func28) * (-109.16681524774745))) + ((func1) * (0.0))) + ((func2) * (56.65430288285653))) + ((func3) * (41.59583084011515))) + ((func4) * (0.0))) + ((func5) * (109.16681524774745))) + ((func6) * (109.16681524774745))) + ((func7) * (0.0))) + ((func8) * (109.16681524774745))) + ((func9) * (109.16681524774745))) + ((func10) * (0.0))) + ((func11) * (0.0))]
where
func0 =
(0) - (0.06408191572099702)
func1 =
exp ((func0) * ((((((5.6) - ((input) !! (0))) ** (2)) + (((2.9) - ((input) !! (1))) ** (2))) + (((3.6) - ((input) !! (2))) ** (2))) + (((1.3) - ((input) !! (3))) ** (2))))
func2 =
exp ((func0) * ((((((5.4) - ((input) !! (0))) ** (2)) + (((3.0) - ((input) !! (1))) ** (2))) + (((4.5) - ((input) !! (2))) ** (2))) + (((1.5) - ((input) !! (3))) ** (2))))
func3 =
exp ((func0) * ((((((6.2) - ((input) !! (0))) ** (2)) + (((2.2) - ((input) !! (1))) ** (2))) + (((4.5) - ((input) !! (2))) ** (2))) + (((1.5) - ((input) !! (3))) ** (2))))
func4 =
exp ((func0) * ((((((5.0) - ((input) !! (0))) ** (2)) + (((2.3) - ((input) !! (1))) ** (2))) + (((3.3) - ((input) !! (2))) ** (2))) + (((1.0) - ((input) !! (3))) ** (2))))
func5 =
exp ((func0) * ((((((5.9) - ((input) !! (0))) ** (2)) + (((3.2) - ((input) !! (1))) ** (2))) + (((4.8) - ((input) !! (2))) ** (2))) + (((1.8) - ((input) !! (3))) ** (2))))
func6 =
exp ((func0) * ((((((6.7) - ((input) !! (0))) ** (2)) + (((3.0) - ((input) !! (1))) ** (2))) + (((5.0) - ((input) !! (2))) ** (2))) + (((1.7) - ((input) !! (3))) ** (2))))
func7 =
exp ((func0) * ((((((4.9) - ((input) !! (0))) ** (2)) + (((2.4) - ((input) !! (1))) ** (2))) + (((3.3) - ((input) !! (2))) ** (2))) + (((1.0) - ((input) !! (3))) ** (2))))
func8 =
exp ((func0) * ((((((6.3) - ((input) !! (0))) ** (2)) + (((2.5) - ((input) !! (1))) ** (2))) + (((4.9) - ((input) !! (2))) ** (2))) + (((1.5) - ((input) !! (3))) ** (2))))
func9 =
exp ((func0) * ((((((6.0) - ((input) !! (0))) ** (2)) + (((2.7) - ((input) !! (1))) ** (2))) + (((5.1) - ((input) !! (2))) ** (2))) + (((1.6) - ((input) !! (3))) ** (2))))
func10 =
exp ((func0) * ((((((5.7) - ((input) !! (0))) ** (2)) + (((2.6) - ((input) !! (1))) ** (2))) + (((3.5) - ((input) !! (2))) ** (2))) + (((1.0) - ((input) !! (3))) ** (2))))
func11 =
exp ((func0) * ((((((5.1) - ((input) !! (0))) ** (2)) + (((2.5) - ((input) !! (1))) ** (2))) + (((3.0) - ((input) !! (2))) ** (2))) + (((1.1) - ((input) !! (3))) ** (2))))
func12 =
exp ((func0) * ((((((5.1) - ((input) !! (0))) ** (2)) + (((3.8) - ((input) !! (1))) ** (2))) + (((1.9) - ((input) !! (2))) ** (2))) + (((0.4) - ((input) !! (3))) ** (2))))
func13 =
exp ((func0) * ((((((5.7) - ((input) !! (0))) ** (2)) + (((4.4) - ((input) !! (1))) ** (2))) + (((1.5) - ((input) !! (2))) ** (2))) + (((0.4) - ((input) !! (3))) ** (2))))
func14 =
exp ((func0) * ((((((5.1) - ((input) !! (0))) ** (2)) + (((3.3) - ((input) !! (1))) ** (2))) + (((1.7) - ((input) !! (2))) ** (2))) + (((0.5) - ((input) !! (3))) ** (2))))
func15 =
exp ((func0) * ((((((5.7) - ((input) !! (0))) ** (2)) + (((3.8) - ((input) !! (1))) ** (2))) + (((1.7) - ((input) !! (2))) ** (2))) + (((0.3) - ((input) !! (3))) ** (2))))
func16 =
exp ((func0) * ((((((5.4) - ((input) !! (0))) ** (2)) + (((3.4) - ((input) !! (1))) ** (2))) + (((1.7) - ((input) !! (2))) ** (2))) + (((0.2) - ((input) !! (3))) ** (2))))
func17 =
exp ((func0) * ((((((5.0) - ((input) !! (0))) ** (2)) + (((3.0) - ((input) !! (1))) ** (2))) + (((1.6) - ((input) !! (2))) ** (2))) + (((0.2) - ((input) !! (3))) ** (2))))
func18 =
exp ((func0) * ((((((4.5) - ((input) !! (0))) ** (2)) + (((2.3) - ((input) !! (1))) ** (2))) + (((1.3) - ((input) !! (2))) ** (2))) + (((0.3) - ((input) !! (3))) ** (2))))
func19 =
exp ((func0) * ((((((4.8) - ((input) !! (0))) ** (2)) + (((3.4) - ((input) !! (1))) ** (2))) + (((1.9) - ((input) !! (2))) ** (2))) + (((0.2) - ((input) !! (3))) ** (2))))
func20 =
exp ((func0) * ((((((6.0) - ((input) !! (0))) ** (2)) + (((3.0) - ((input) !! (1))) ** (2))) + (((4.8) - ((input) !! (2))) ** (2))) + (((1.8) - ((input) !! (3))) ** (2))))
func21 =
exp ((func0) * ((((((6.3) - ((input) !! (0))) ** (2)) + (((2.8) - ((input) !! (1))) ** (2))) + (((5.1) - ((input) !! (2))) ** (2))) + (((1.5) - ((input) !! (3))) ** (2))))
func22 =
exp ((func0) * ((((((6.1) - ((input) !! (0))) ** (2)) + (((3.0) - ((input) !! (1))) ** (2))) + (((4.9) - ((input) !! (2))) ** (2))) + (((1.8) - ((input) !! (3))) ** (2))))
func23 =
exp ((func0) * ((((((4.9) - ((input) !! (0))) ** (2)) + (((2.5) - ((input) !! (1))) ** (2))) + (((4.5) - ((input) !! (2))) ** (2))) + (((1.7) - ((input) !! (3))) ** (2))))
func24 =
exp ((func0) * ((((((5.6) - ((input) !! (0))) ** (2)) + (((2.8) - ((input) !! (1))) ** (2))) + (((4.9) - ((input) !! (2))) ** (2))) + (((2.0) - ((input) !! (3))) ** (2))))
func25 =
exp ((func0) * ((((((6.0) - ((input) !! (0))) ** (2)) + (((2.2) - ((input) !! (1))) ** (2))) + (((5.0) - ((input) !! (2))) ** (2))) + (((1.5) - ((input) !! (3))) ** (2))))
func26 =
exp ((func0) * ((((((7.9) - ((input) !! (0))) ** (2)) + (((3.8) - ((input) !! (1))) ** (2))) + (((6.4) - ((input) !! (2))) ** (2))) + (((2.0) - ((input) !! (3))) ** (2))))
func27 =
exp ((func0) * ((((((7.2) - ((input) !! (0))) ** (2)) + (((3.0) - ((input) !! (1))) ** (2))) + (((5.8) - ((input) !! (2))) ** (2))) + (((1.6) - ((input) !! (3))) ** (2))))
func28 =
exp ((func0) * ((((((6.2) - ((input) !! (0))) ** (2)) + (((2.8) - ((input) !! (1))) ** (2))) + (((4.8) - ((input) !! (2))) ** (2))) + (((1.8) - ((input) !! (3))) ** (2))))
69 changes: 69 additions & 0 deletions generated_code_examples/haskell/classification/xgboost.hs
@@ -0,0 +1,69 @@
module Model where
score :: [Double] -> [Double]
score input =
[(func2) / (func9), (func5) / (func9), (func8) / (func9)]
where
func0 =
if (((input) !! (2)) >= (2.45))
then
-0.219950154
else
0.430243909
func1 =
if (((input) !! (2)) >= (2.45))
then
-0.196918547
else
0.294934332
func2 =
exp (((0.5) + (func0)) + (func1))
func3 =
if (((input) !! (2)) >= (2.45))
then
if (((input) !! (3)) >= (1.75))
then
-0.200518161
else
0.369124442
else
-0.215121984
func4 =
if (((input) !! (2)) >= (2.45))
then
if (((input) !! (2)) >= (4.8500004))
then
-0.148884818
else
0.279661298
else
-0.191438049
func5 =
exp (((0.5) + (func3)) + (func4))
func6 =
if (((input) !! (3)) >= (1.6500001))
then
0.402985066
else
if (((input) !! (2)) >= (4.95))
then
0.217241377
else
-0.219740286
func7 =
if (((input) !! (2)) >= (4.75))
then
if (((input) !! (3)) >= (1.75))
then
0.286929518
else
0.0627289712
else
if (((input) !! (3)) >= (1.55))
then
0.00989914499
else
-0.196593687
func8 =
exp (((0.5) + (func6)) + (func7))
func9 =
((func2) + (func5)) + (func8)
23 changes: 23 additions & 0 deletions generated_code_examples/haskell/regression/decision_tree.hs
@@ -0,0 +1,23 @@
module Model where
score :: [Double] -> Double
score input =
func0
where
func0 =
if (((input) !! (5)) <= (6.941))
then
if (((input) !! (12)) <= (14.4))
then
if (((input) !! (7)) <= (1.38485))
then
45.58
else
22.939004149377574
else
14.910404624277467
else
if (((input) !! (5)) <= (7.4370003))
then
32.11304347826088
else
45.096666666666664
33 changes: 33 additions & 0 deletions generated_code_examples/haskell/regression/lightgbm.hs
@@ -0,0 +1,33 @@
module Model where
score :: [Double] -> Double
score input =
((0) + (func0)) + (func1)
where
func0 =
if (((input) !! (5)) > (6.918000000000001))
then
if (((input) !! (5)) > (7.437))
then
24.81112131071211
else
23.5010290754961
else
if (((input) !! (12)) > (14.365))
then
21.796569516771488
else
22.640634908349323
func1 =
if (((input) !! (12)) > (9.63))
then
if (((input) !! (12)) > (19.23))
then
-0.9218520876020193
else
-0.30490175606373926
else
if (((input) !! (5)) > (7.437))
then
2.028554553190867
else
0.45970642160364367
4 changes: 4 additions & 0 deletions generated_code_examples/haskell/regression/linear.hs
@@ -0,0 +1,4 @@
module Model where
score :: [Double] -> Double
score input =
(((((((((((((37.13534685269026) + (((input) !! (0)) * (-0.10859102499053891))) + (((input) !! (1)) * (0.04419889872599562))) + (((input) !! (2)) * (0.017466905407308372))) + (((input) !! (3)) * (2.832321087004625))) + (((input) !! (4)) * (-18.48374869795793))) + (((input) !! (5)) * (3.835495548436564))) + (((input) !! (6)) * (0.00014091650900214126))) + (((input) !! (7)) * (-1.5040340046693192))) + (((input) !! (8)) * (0.31061748524339455))) + (((input) !! (9)) * (-0.012306650033752073))) + (((input) !! (10)) * (-0.9736183984588207))) + (((input) !! (11)) * (0.009403964809694718))) + (((input) !! (12)) * (-0.5203427347180726))

0 comments on commit 875a965

Please sign in to comment.