-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9073b9c
commit 3604421
Showing
27 changed files
with
843 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
generated_code_examples/go/classification/decision_tree.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
func score(input []float64) []float64 { | ||
var var0 []float64 | ||
if (input[2]) <= (2.6) { | ||
var0 = []float64{1.0, 0.0, 0.0} | ||
} else { | ||
if (input[2]) <= (4.8500004) { | ||
if (input[3]) <= (1.6500001) { | ||
var0 = []float64{0.0, 1.0, 0.0} | ||
} else { | ||
var0 = []float64{0.0, 0.3333333333333333, 0.6666666666666666} | ||
} | ||
} else { | ||
if (input[3]) <= (1.75) { | ||
var0 = []float64{0.0, 0.42857142857142855, 0.5714285714285714} | ||
} else { | ||
var0 = []float64{0.0, 0.0, 1.0} | ||
} | ||
} | ||
} | ||
return var0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import "math" | ||
func score(input []float64) []float64 { | ||
var var0 float64 | ||
if (input[2]) > (1.8) { | ||
if (input[2]) > (4.250000000000001) { | ||
var0 = -1.1736122903444903 | ||
} else { | ||
var0 = -1.1633850173886202 | ||
} | ||
} else { | ||
var0 = -0.9486122853153485 | ||
} | ||
var var1 float64 | ||
if (input[2]) > (1.8) { | ||
if (input[1]) > (3.0500000000000003) { | ||
var1 = -0.06193194743580539 | ||
} else { | ||
var1 = -0.07237070828653688 | ||
} | ||
} else { | ||
var1 = 0.12984943093573026 | ||
} | ||
var var2 float64 | ||
var2 = math.Exp(((0) + (var0)) + (var1)) | ||
var var3 float64 | ||
if (input[2]) > (1.8) { | ||
if (input[2]) > (4.8500000000000005) { | ||
var3 = -1.1807342692411888 | ||
} else { | ||
var3 = -0.9831932134295853 | ||
} | ||
} else { | ||
var3 = -1.1952609652674462 | ||
} | ||
var var4 float64 | ||
if (input[2]) > (1.8) { | ||
if (input[2]) > (4.8500000000000005) { | ||
var4 = -0.05694282927518771 | ||
} else { | ||
var4 = 0.11960489254350348 | ||
} | ||
} else { | ||
var4 = -0.07151978915296087 | ||
} | ||
var var5 float64 | ||
var5 = math.Exp(((0) + (var3)) + (var4)) | ||
var var6 float64 | ||
if (input[2]) > (4.8500000000000005) { | ||
if (input[3]) > (1.9500000000000002) { | ||
var6 = -0.9298942558407184 | ||
} else { | ||
var6 = -0.9632815288936335 | ||
} | ||
} else { | ||
if (input[2]) > (4.250000000000001) { | ||
var6 = -1.1322413652523249 | ||
} else { | ||
var6 = -1.1524760761934856 | ||
} | ||
} | ||
var var7 float64 | ||
if (input[2]) > (4.8500000000000005) { | ||
if (input[3]) > (1.9500000000000002) { | ||
var7 = 0.12809276954555665 | ||
} else { | ||
var7 = 0.09898817876916756 | ||
} | ||
} else { | ||
if (input[2]) > (4.250000000000001) { | ||
var7 = -0.052710589717642864 | ||
} else { | ||
var7 = -0.07292857712854424 | ||
} | ||
} | ||
var var8 float64 | ||
var8 = math.Exp(((0) + (var6)) + (var7)) | ||
var var9 float64 | ||
var9 = ((var2) + (var5)) + (var8) | ||
return []float64{(var2) / (var9), (var5) / (var9), (var8) / (var9)} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
func score(input []float64) []float64 { | ||
return []float64{((((0.26145874358806076) + ((input[0]) * (0.4247411605356963))) + ((input[1]) * (1.3963906033045022))) + ((input[2]) * (-2.215054318516674))) + ((input[3]) * (-0.9587396176450291)), ((((1.1348839223808753) + ((input[0]) * (0.25679659769994584))) + ((input[1]) * (-1.3904789369835584))) + ((input[2]) * (0.5966830233112762))) + ((input[3]) * (-1.269002272638834)), ((((-1.216280201256021) + ((input[0]) * (-1.635776698917701))) + ((input[1]) * (-1.504063872842283))) + ((input[2]) * (2.4278359331292623))) + ((input[3]) * (2.346931069336734))} | ||
} |
53 changes: 53 additions & 0 deletions
53
generated_code_examples/go/classification/random_forest.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
func addVectors(v1, v2 []float64) []float64 { | ||
result := make([]float64, len(v1)) | ||
for i := 0; i < len(v1); i++ { | ||
result[i] = v1[i] + v2[i] | ||
} | ||
return result | ||
} | ||
func mulVectorNumber(v1 []float64, num float64) []float64 { | ||
result := make([]float64, len(v1)) | ||
for i := 0; i < len(v1); i++ { | ||
result[i] = v1[i] * num | ||
} | ||
return result | ||
} | ||
func score(input []float64) []float64 { | ||
var var0 []float64 | ||
if (input[3]) <= (0.8) { | ||
var0 = []float64{1.0, 0.0, 0.0} | ||
} else { | ||
if (input[2]) <= (4.8500004) { | ||
var0 = []float64{0.0, 0.9795918367346939, 0.02040816326530612} | ||
} else { | ||
if (input[3]) <= (1.75) { | ||
if (input[3]) <= (1.6500001) { | ||
var0 = []float64{0.0, 0.25, 0.75} | ||
} else { | ||
var0 = []float64{0.0, 1.0, 0.0} | ||
} | ||
} else { | ||
var0 = []float64{0.0, 0.0, 1.0} | ||
} | ||
} | ||
} | ||
var var1 []float64 | ||
if (input[3]) <= (0.8) { | ||
var1 = []float64{1.0, 0.0, 0.0} | ||
} else { | ||
if (input[0]) <= (6.05) { | ||
if (input[2]) <= (4.9) { | ||
var1 = []float64{0.0, 0.9032258064516129, 0.0967741935483871} | ||
} else { | ||
var1 = []float64{0.0, 0.0, 1.0} | ||
} | ||
} else { | ||
if (input[3]) <= (1.75) { | ||
var1 = []float64{0.0, 0.8, 0.2} | ||
} else { | ||
var1 = []float64{0.0, 0.0, 1.0} | ||
} | ||
} | ||
} | ||
return addVectors(mulVectorNumber(var0, 0.5), mulVectorNumber(var1, 0.5)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import "math" | ||
func score(input []float64) []float64 { | ||
var var0 float64 | ||
if (input[2]) >= (2.5999999) { | ||
var0 = -0.0731707439 | ||
} else { | ||
var0 = 0.142857149 | ||
} | ||
var var1 float64 | ||
if (input[2]) >= (2.5999999) { | ||
var1 = -0.0705206916 | ||
} else { | ||
var1 = 0.12477719 | ||
} | ||
var var2 float64 | ||
var2 = math.Exp(((0.5) + (var0)) + (var1)) | ||
var var3 float64 | ||
if (input[2]) >= (2.5999999) { | ||
if (input[2]) >= (4.85000038) { | ||
var3 = -0.0578680299 | ||
} else { | ||
var3 = 0.132596686 | ||
} | ||
} else { | ||
var3 = -0.0714285821 | ||
} | ||
var var4 float64 | ||
if (input[2]) >= (2.5999999) { | ||
if (input[2]) >= (4.85000038) { | ||
var4 = -0.0552999191 | ||
} else { | ||
var4 = 0.116139404 | ||
} | ||
} else { | ||
var4 = -0.0687687024 | ||
} | ||
var var5 float64 | ||
var5 = math.Exp(((0.5) + (var3)) + (var4)) | ||
var var6 float64 | ||
if (input[2]) >= (4.85000038) { | ||
if (input[3]) >= (1.75) { | ||
var6 = 0.142011836 | ||
} else { | ||
var6 = 0.0405405387 | ||
} | ||
} else { | ||
if (input[3]) >= (1.6500001) { | ||
var6 = 0.0428571403 | ||
} else { | ||
var6 = -0.0730659068 | ||
} | ||
} | ||
var var7 float64 | ||
if (input[2]) >= (4.85000038) { | ||
if (input[3]) >= (1.75) { | ||
var7 = 0.124653712 | ||
} else { | ||
var7 = 0.035562478 | ||
} | ||
} else { | ||
if (input[3]) >= (1.6500001) { | ||
var7 = 0.0425687581 | ||
} else { | ||
var7 = -0.0704230517 | ||
} | ||
} | ||
var var8 float64 | ||
var8 = math.Exp(((0.5) + (var6)) + (var7)) | ||
var var9 float64 | ||
var9 = ((var2) + (var5)) + (var8) | ||
return []float64{(var2) / (var9), (var5) / (var9), (var8) / (var9)} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
func score(input []float64) float64 { | ||
var var0 float64 | ||
if (input[5]) <= (6.941) { | ||
if (input[12]) <= (14.395) { | ||
if (input[7]) <= (1.43365) { | ||
var0 = 45.58 | ||
} else { | ||
var0 = 22.865022421524642 | ||
} | ||
} else { | ||
var0 = 14.924358974358983 | ||
} | ||
} else { | ||
if (input[5]) <= (7.4370003) { | ||
var0 = 32.09534883720931 | ||
} else { | ||
var0 = 45.275 | ||
} | ||
} | ||
return var0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
func score(input []float64) float64 { | ||
var var0 float64 | ||
if (input[5]) > (6.8455) { | ||
if (input[5]) > (7.437) { | ||
var0 = 24.906664851995615 | ||
} else { | ||
var0 = 23.513674700555555 | ||
} | ||
} else { | ||
if (input[12]) > (14.395000000000001) { | ||
var0 = 21.863487452747595 | ||
} else { | ||
var0 = 22.70305627629392 | ||
} | ||
} | ||
var var1 float64 | ||
if (input[12]) > (9.63) { | ||
if (input[12]) > (19.830000000000002) { | ||
var1 = -0.9644646678713786 | ||
} else { | ||
var1 = -0.30629733662250097 | ||
} | ||
} else { | ||
if (input[5]) > (7.437) { | ||
var1 = 2.0368334157126293 | ||
} else { | ||
var1 = 0.4576204330349962 | ||
} | ||
} | ||
return ((0) + (var0)) + (var1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
func score(input []float64) float64 { | ||
return (((((((((((((36.006810733650326) + ((input[0]) * (-0.10081655845910455))) + ((input[1]) * (0.044035569560798626))) + ((input[2]) * (0.030804434213339508))) + ((input[3]) * (2.9326736094672414))) + ((input[4]) * (-17.093360132148693))) + ((input[5]) * (3.7450682208635504))) + ((input[6]) * (0.0033774353698582506))) + ((input[7]) * (-1.4348015681660866))) + ((input[8]) * (0.2901581119428326))) + ((input[9]) * (-0.011463487956327852))) + ((input[10]) * (-0.9500012437313152))) + ((input[11]) * (0.010374330909981539))) + ((input[12]) * (-0.571389044929473)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
func score(input []float64) float64 { | ||
var var0 float64 | ||
if (input[5]) <= (6.92) { | ||
if (input[12]) <= (14.3) { | ||
if (input[7]) <= (1.47415) { | ||
var0 = 50.0 | ||
} else { | ||
var0 = 23.203669724770638 | ||
} | ||
} else { | ||
var0 = 15.177333333333326 | ||
} | ||
} else { | ||
if (input[5]) <= (7.4370003) { | ||
var0 = 32.92407407407408 | ||
} else { | ||
var0 = 45.04827586206897 | ||
} | ||
} | ||
var var1 float64 | ||
if (input[12]) <= (9.725) { | ||
if (input[5]) <= (7.4525) { | ||
if (input[5]) <= (6.7539997) { | ||
var1 = 24.805 | ||
} else { | ||
var1 = 32.55238095238095 | ||
} | ||
} else { | ||
var1 = 47.88333333333334 | ||
} | ||
} else { | ||
if (input[12]) <= (15.0) { | ||
var1 = 20.52100840336134 | ||
} else { | ||
var1 = 14.718709677419358 | ||
} | ||
} | ||
return ((var0) * (0.5)) + ((var1) * (0.5)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
func score(input []float64) float64 { | ||
var var0 float64 | ||
if (input[12]) >= (9.72500038) { | ||
if (input[12]) >= (19.8299999) { | ||
var0 = 1.1551429 | ||
} else { | ||
var0 = 1.8613131 | ||
} | ||
} else { | ||
if (input[5]) >= (6.94099998) { | ||
var0 = 3.75848508 | ||
} else { | ||
var0 = 2.48056006 | ||
} | ||
} | ||
var var1 float64 | ||
if (input[12]) >= (7.68499994) { | ||
if (input[12]) >= (15) { | ||
var1 = 1.24537706 | ||
} else { | ||
var1 = 1.92129695 | ||
} | ||
} else { | ||
if (input[5]) >= (7.43700027) { | ||
var1 = 3.96021533 | ||
} else { | ||
var1 = 2.51493931 | ||
} | ||
} | ||
return ((0.5) + (var0)) + (var1) | ||
} |
Oops, something went wrong.