diff --git a/src/test/resources/test_files/RumbleML/RumbleML/EstimatorTests/MLEstimator-LDA.jq b/src/test/resources/test_files/RumbleML/RumbleML/EstimatorTests/MLEstimator-LDA.jq index 2d997d325..b7c2387c7 100644 --- a/src/test/resources/test_files/RumbleML/RumbleML/EstimatorTests/MLEstimator-LDA.jq +++ b/src/test/resources/test_files/RumbleML/RumbleML/EstimatorTests/MLEstimator-LDA.jq @@ -1,4 +1,6 @@ -(:JIQS: ShouldRun; Output="({ "label" : 0, "name" : "a", "age" : 20, "weight" : 50, "topicDistribution" : [ 0.9915007293228202, 0.0084992706771797 ] }, { "label" : 1, "name" : "b", "age" : 21, "weight" : 55.3, "topicDistribution" : [ 0.9922903440390959, 0.007709655960904113 ] }, { "label" : 2, "name" : "c", "age" : 22, "weight" : 60.6, "topicDistribution" : [ 0.9929414141611251, 0.007058585838874805 ] }, { "label" : 3, "name" : "d", "age" : 23, "weight" : 65.9, "topicDistribution" : [ 0.9934942226012154, 0.006505777398784658 ] }, { "label" : 4, "name" : "e", "age" : 24, "weight" : 70.3, "topicDistribution" : [ 0.9938860832566909, 0.006113916743309047 ] }, { "label" : 5, "name" : "f", "age" : 25, "weight" : 75.6, "topicDistribution" : [ 0.9943034888595204, 0.005696511140479687 ] })" :) +(:JIQS: ShouldRun; Output="({ "label" : 0, "name" : "a", "age" : 20, "weight" : 50, "topicDistribution" : [ 0.99150074, 0.00849927 ] }, { "label" : 1, "name" : "b", "age" : 21, "weight" : 55.3, "topicDistribution" : [ 0.9922903, 0.007709656 ] }, { "label" : 2, "name" : "c", "age" : 22, "weight" : 60.6, "topicDistribution" : [ 0.99294144, 0.007058586 ] }, { "label" : 3, "name" : "d", "age" : 23, "weight" : 65.9, "topicDistribution" : [ 0.9934942, 0.0065057776 ] }, { "label" : 4, "name" : "e", "age" : 24, "weight" : 70.3, "topicDistribution" : [ 0.99388605, 0.0061139166 ] }, { "label" : 5, "name" : "f", "age" : 25, "weight" : 75.6, "topicDistribution" : [ 0.99430346, 0.0056965114 ] })" :) + + let $data := annotate( json-file("../../../../queries/rumbleML/sample-ml-data-flat.json"), { "label": "integer", "binaryLabel": "integer", "name": "string", "age": "double", "weight": "double", "booleanCol": "boolean", "nullCol": "null", "stringCol": "string", "stringArrayCol": ["string"], "intArrayCol": ["integer"], "doubleArrayCol": ["double"], "doubleArrayArrayCol": [["double"]] } @@ -20,5 +22,5 @@ return { "name": $result.name, "age": $result.age, "weight": $result.weight, - "topicDistribution": $result.topicDistribution + "topicDistribution": [ for $v in $result.topicDistribution[] return float($v) ] } diff --git a/src/test/resources/test_files/RumbleML/RumbleML/EstimatorTests/MLEstimator-Word2Vec.jq b/src/test/resources/test_files/RumbleML/RumbleML/EstimatorTests/MLEstimator-Word2Vec.jq index 7fc4fe4a6..589d32d44 100644 --- a/src/test/resources/test_files/RumbleML/RumbleML/EstimatorTests/MLEstimator-Word2Vec.jq +++ b/src/test/resources/test_files/RumbleML/RumbleML/EstimatorTests/MLEstimator-Word2Vec.jq @@ -1,4 +1,6 @@ -(:JIQS: ShouldRun; Output="({ "label" : 0, "name" : "a", "stringArrayCol" : [ "i", "am", "data", "entry", "1" ], "word2vecResult" : [ -0.00008827827405184508, 0.0015511172357946636, 0.0012456903779821005, -0.00017455247580073775, 0.0007685604563448579, -0.0003708983305841685, -0.000959619008244772, 0.0025182453449815513, -0.0002079914091154933, 0.0003534884192049504, 0.000060372170992195606, -0.0015702559845522047, 0.00048183593899011614, -0.00008264915086328984, 0.0019678646698594094, -0.0004581848275847733, -0.0012066971044987441, 0.00012526265636552127, -0.0006971916547627189, -0.00027012262144125997, -0.0027646114584058525, -0.0023180179297924044, 0.0013835154357366266, 0.0006302525056526066, 0.0003136327723041177, -0.00021268702112138272, 0.0025911133503541354, -0.002353195258183405, -0.0019786593678873033, 0.000948345207143575, -0.0009493408957496286, -0.001740258314748644, 0.0007966782664880157, 0.00007586752763018013, -0.00025220380630344155, 0.0002741098403930664, -0.00037878406583331526, 0.00143408925505355, -0.0012089840718545021, -0.0017257415223866702, 0.00044488328276202086, 0.0005102019291371107, -0.0009055897826328874, 0.000035975128412246704, 0.0005793333752080798, -0.0005341326061170549, -0.0013439569389447571, -0.00008179824799299241, -0.0007779039442539215, -0.0002133378351572901, 0.0012642501387745142, -0.0007411713246256113, 0.0005662580369971693, 0.001663543627364561, 0.0008368028968106956, -0.000997365836519748, 0.0007849428337067366, -0.0023398068005917594, -0.000387585605494678, 0.0010412906995043159, 0.0005507866619154811, 0.0008073827179032379, 0.00246372374240309, 0.0015164696611464025, 0.0003660639631561935, 0.0012576625216752292, -0.0009936349335475825, -0.0026454668724909427, 0.00005925206933170557, 0.0011166747775860132, -0.0004663625499233604, -0.00023170316126197577, 0.0018186483066529036, -0.0014948951196856798, -0.00016428373492090033, -0.0003119172062724829, -0.0013755115447565915, 0.002602993906475604, 0.000023058174701873216, -0.000016855192370712757, -0.0012046594638377428, -0.00014418535865843297, 0.0014693727251142265, 0.0012946866874699481, 0.0016010180115699768, 0.00022849043307360262, -0.0007140473462641239, 0.0010709780268371106, 0.0004290861077606678, 0.002524780051317066, -0.0004979197168722749, 0.0005268135879305192, -0.001204889314249158, 0.001335247955285013, -0.0001557100098580122, -0.0009739698376506567, -0.0010365712398197502, 0.0007682244991883636, 0.0007964270189404488, 0.0004109033616259694 ] }, { "label" : 1, "name" : "b", "stringArrayCol" : [ "i", "am", "data", "entry", "2" ], "word2vecResult" : [ -0.00008827827405184508, 0.0015511172357946636, 0.0012456903779821005, -0.00017455247580073775, 0.0007685604563448579, -0.0003708983305841685, -0.000959619008244772, 0.0025182453449815513, -0.0002079914091154933, 0.0003534884192049504, 0.000060372170992195606, -0.0015702559845522047, 0.00048183593899011614, -0.00008264915086328984, 0.0019678646698594094, -0.0004581848275847733, -0.0012066971044987441, 0.00012526265636552127, -0.0006971916547627189, -0.00027012262144125997, -0.0027646114584058525, -0.0023180179297924044, 0.0013835154357366266, 0.0006302525056526066, 0.0003136327723041177, -0.00021268702112138272, 0.0025911133503541354, -0.002353195258183405, -0.0019786593678873033, 0.000948345207143575, -0.0009493408957496286, -0.001740258314748644, 0.0007966782664880157, 0.00007586752763018013, -0.00025220380630344155, 0.0002741098403930664, -0.00037878406583331526, 0.00143408925505355, -0.0012089840718545021, -0.0017257415223866702, 0.00044488328276202086, 0.0005102019291371107, -0.0009055897826328874, 0.000035975128412246704, 0.0005793333752080798, -0.0005341326061170549, -0.0013439569389447571, -0.00008179824799299241, -0.0007779039442539215, -0.0002133378351572901, 0.0012642501387745142, -0.0007411713246256113, 0.0005662580369971693, 0.001663543627364561, 0.0008368028968106956, -0.000997365836519748, 0.0007849428337067366, -0.0023398068005917594, -0.000387585605494678, 0.0010412906995043159, 0.0005507866619154811, 0.0008073827179032379, 0.00246372374240309, 0.0015164696611464025, 0.0003660639631561935, 0.0012576625216752292, -0.0009936349335475825, -0.0026454668724909427, 0.00005925206933170557, 0.0011166747775860132, -0.0004663625499233604, -0.00023170316126197577, 0.0018186483066529036, -0.0014948951196856798, -0.00016428373492090033, -0.0003119172062724829, -0.0013755115447565915, 0.002602993906475604, 0.000023058174701873216, -0.000016855192370712757, -0.0012046594638377428, -0.00014418535865843297, 0.0014693727251142265, 0.0012946866874699481, 0.0016010180115699768, 0.00022849043307360262, -0.0007140473462641239, 0.0010709780268371106, 0.0004290861077606678, 0.002524780051317066, -0.0004979197168722749, 0.0005268135879305192, -0.001204889314249158, 0.001335247955285013, -0.0001557100098580122, -0.0009739698376506567, -0.0010365712398197502, 0.0007682244991883636, 0.0007964270189404488, 0.0004109033616259694 ] }, { "label" : 2, "name" : "c", "stringArrayCol" : [ "i", "am", "data", "entry", "3" ], "word2vecResult" : [ -0.00008827827405184508, 0.0015511172357946636, 0.0012456903779821005, -0.00017455247580073775, 0.0007685604563448579, -0.0003708983305841685, -0.000959619008244772, 0.0025182453449815513, -0.0002079914091154933, 0.0003534884192049504, 0.000060372170992195606, -0.0015702559845522047, 0.00048183593899011614, -0.00008264915086328984, 0.0019678646698594094, -0.0004581848275847733, -0.0012066971044987441, 0.00012526265636552127, -0.0006971916547627189, -0.00027012262144125997, -0.0027646114584058525, -0.0023180179297924044, 0.0013835154357366266, 0.0006302525056526066, 0.0003136327723041177, -0.00021268702112138272, 0.0025911133503541354, -0.002353195258183405, -0.0019786593678873033, 0.000948345207143575, -0.0009493408957496286, -0.001740258314748644, 0.0007966782664880157, 0.00007586752763018013, -0.00025220380630344155, 0.0002741098403930664, -0.00037878406583331526, 0.00143408925505355, -0.0012089840718545021, -0.0017257415223866702, 0.00044488328276202086, 0.0005102019291371107, -0.0009055897826328874, 0.000035975128412246704, 0.0005793333752080798, -0.0005341326061170549, -0.0013439569389447571, -0.00008179824799299241, -0.0007779039442539215, -0.0002133378351572901, 0.0012642501387745142, -0.0007411713246256113, 0.0005662580369971693, 0.001663543627364561, 0.0008368028968106956, -0.000997365836519748, 0.0007849428337067366, -0.0023398068005917594, -0.000387585605494678, 0.0010412906995043159, 0.0005507866619154811, 0.0008073827179032379, 0.00246372374240309, 0.0015164696611464025, 0.0003660639631561935, 0.0012576625216752292, -0.0009936349335475825, -0.0026454668724909427, 0.00005925206933170557, 0.0011166747775860132, -0.0004663625499233604, -0.00023170316126197577, 0.0018186483066529036, -0.0014948951196856798, -0.00016428373492090033, -0.0003119172062724829, -0.0013755115447565915, 0.002602993906475604, 0.000023058174701873216, -0.000016855192370712757, -0.0012046594638377428, -0.00014418535865843297, 0.0014693727251142265, 0.0012946866874699481, 0.0016010180115699768, 0.00022849043307360262, -0.0007140473462641239, 0.0010709780268371106, 0.0004290861077606678, 0.002524780051317066, -0.0004979197168722749, 0.0005268135879305192, -0.001204889314249158, 0.001335247955285013, -0.0001557100098580122, -0.0009739698376506567, -0.0010365712398197502, 0.0007682244991883636, 0.0007964270189404488, 0.0004109033616259694 ] }, { "label" : 3, "name" : "d", "stringArrayCol" : [ "i", "am", "data", "entry", "4" ], "word2vecResult" : [ -0.00008827827405184508, 0.0015511172357946636, 0.0012456903779821005, -0.00017455247580073775, 0.0007685604563448579, -0.0003708983305841685, -0.000959619008244772, 0.0025182453449815513, -0.0002079914091154933, 0.0003534884192049504, 0.000060372170992195606, -0.0015702559845522047, 0.00048183593899011614, -0.00008264915086328984, 0.0019678646698594094, -0.0004581848275847733, -0.0012066971044987441, 0.00012526265636552127, -0.0006971916547627189, -0.00027012262144125997, -0.0027646114584058525, -0.0023180179297924044, 0.0013835154357366266, 0.0006302525056526066, 0.0003136327723041177, -0.00021268702112138272, 0.0025911133503541354, -0.002353195258183405, -0.0019786593678873033, 0.000948345207143575, -0.0009493408957496286, -0.001740258314748644, 0.0007966782664880157, 0.00007586752763018013, -0.00025220380630344155, 0.0002741098403930664, -0.00037878406583331526, 0.00143408925505355, -0.0012089840718545021, -0.0017257415223866702, 0.00044488328276202086, 0.0005102019291371107, -0.0009055897826328874, 0.000035975128412246704, 0.0005793333752080798, -0.0005341326061170549, -0.0013439569389447571, -0.00008179824799299241, -0.0007779039442539215, -0.0002133378351572901, 0.0012642501387745142, -0.0007411713246256113, 0.0005662580369971693, 0.001663543627364561, 0.0008368028968106956, -0.000997365836519748, 0.0007849428337067366, -0.0023398068005917594, -0.000387585605494678, 0.0010412906995043159, 0.0005507866619154811, 0.0008073827179032379, 0.00246372374240309, 0.0015164696611464025, 0.0003660639631561935, 0.0012576625216752292, -0.0009936349335475825, -0.0026454668724909427, 0.00005925206933170557, 0.0011166747775860132, -0.0004663625499233604, -0.00023170316126197577, 0.0018186483066529036, -0.0014948951196856798, -0.00016428373492090033, -0.0003119172062724829, -0.0013755115447565915, 0.002602993906475604, 0.000023058174701873216, -0.000016855192370712757, -0.0012046594638377428, -0.00014418535865843297, 0.0014693727251142265, 0.0012946866874699481, 0.0016010180115699768, 0.00022849043307360262, -0.0007140473462641239, 0.0010709780268371106, 0.0004290861077606678, 0.002524780051317066, -0.0004979197168722749, 0.0005268135879305192, -0.001204889314249158, 0.001335247955285013, -0.0001557100098580122, -0.0009739698376506567, -0.0010365712398197502, 0.0007682244991883636, 0.0007964270189404488, 0.0004109033616259694 ] }, { "label" : 4, "name" : "e", "stringArrayCol" : [ "i", "am", "data", "entry", "5" ], "word2vecResult" : [ -0.00008827827405184508, 0.0015511172357946636, 0.0012456903779821005, -0.00017455247580073775, 0.0007685604563448579, -0.0003708983305841685, -0.000959619008244772, 0.0025182453449815513, -0.0002079914091154933, 0.0003534884192049504, 0.000060372170992195606, -0.0015702559845522047, 0.00048183593899011614, -0.00008264915086328984, 0.0019678646698594094, -0.0004581848275847733, -0.0012066971044987441, 0.00012526265636552127, -0.0006971916547627189, -0.00027012262144125997, -0.0027646114584058525, -0.0023180179297924044, 0.0013835154357366266, 0.0006302525056526066, 0.0003136327723041177, -0.00021268702112138272, 0.0025911133503541354, -0.002353195258183405, -0.0019786593678873033, 0.000948345207143575, -0.0009493408957496286, -0.001740258314748644, 0.0007966782664880157, 0.00007586752763018013, -0.00025220380630344155, 0.0002741098403930664, -0.00037878406583331526, 0.00143408925505355, -0.0012089840718545021, -0.0017257415223866702, 0.00044488328276202086, 0.0005102019291371107, -0.0009055897826328874, 0.000035975128412246704, 0.0005793333752080798, -0.0005341326061170549, -0.0013439569389447571, -0.00008179824799299241, -0.0007779039442539215, -0.0002133378351572901, 0.0012642501387745142, -0.0007411713246256113, 0.0005662580369971693, 0.001663543627364561, 0.0008368028968106956, -0.000997365836519748, 0.0007849428337067366, -0.0023398068005917594, -0.000387585605494678, 0.0010412906995043159, 0.0005507866619154811, 0.0008073827179032379, 0.00246372374240309, 0.0015164696611464025, 0.0003660639631561935, 0.0012576625216752292, -0.0009936349335475825, -0.0026454668724909427, 0.00005925206933170557, 0.0011166747775860132, -0.0004663625499233604, -0.00023170316126197577, 0.0018186483066529036, -0.0014948951196856798, -0.00016428373492090033, -0.0003119172062724829, -0.0013755115447565915, 0.002602993906475604, 0.000023058174701873216, -0.000016855192370712757, -0.0012046594638377428, -0.00014418535865843297, 0.0014693727251142265, 0.0012946866874699481, 0.0016010180115699768, 0.00022849043307360262, -0.0007140473462641239, 0.0010709780268371106, 0.0004290861077606678, 0.002524780051317066, -0.0004979197168722749, 0.0005268135879305192, -0.001204889314249158, 0.001335247955285013, -0.0001557100098580122, -0.0009739698376506567, -0.0010365712398197502, 0.0007682244991883636, 0.0007964270189404488, 0.0004109033616259694 ] }, { "label" : 5, "name" : "f", "stringArrayCol" : [ "i", "am", "data", "entry", "6" ], "word2vecResult" : [ -0.00008827827405184508, 0.0015511172357946636, 0.0012456903779821005, -0.00017455247580073775, 0.0007685604563448579, -0.0003708983305841685, -0.000959619008244772, 0.0025182453449815513, -0.0002079914091154933, 0.0003534884192049504, 0.000060372170992195606, -0.0015702559845522047, 0.00048183593899011614, -0.00008264915086328984, 0.0019678646698594094, -0.0004581848275847733, -0.0012066971044987441, 0.00012526265636552127, -0.0006971916547627189, -0.00027012262144125997, -0.0027646114584058525, -0.0023180179297924044, 0.0013835154357366266, 0.0006302525056526066, 0.0003136327723041177, -0.00021268702112138272, 0.0025911133503541354, -0.002353195258183405, -0.0019786593678873033, 0.000948345207143575, -0.0009493408957496286, -0.001740258314748644, 0.0007966782664880157, 0.00007586752763018013, -0.00025220380630344155, 0.0002741098403930664, -0.00037878406583331526, 0.00143408925505355, -0.0012089840718545021, -0.0017257415223866702, 0.00044488328276202086, 0.0005102019291371107, -0.0009055897826328874, 0.000035975128412246704, 0.0005793333752080798, -0.0005341326061170549, -0.0013439569389447571, -0.00008179824799299241, -0.0007779039442539215, -0.0002133378351572901, 0.0012642501387745142, -0.0007411713246256113, 0.0005662580369971693, 0.001663543627364561, 0.0008368028968106956, -0.000997365836519748, 0.0007849428337067366, -0.0023398068005917594, -0.000387585605494678, 0.0010412906995043159, 0.0005507866619154811, 0.0008073827179032379, 0.00246372374240309, 0.0015164696611464025, 0.0003660639631561935, 0.0012576625216752292, -0.0009936349335475825, -0.0026454668724909427, 0.00005925206933170557, 0.0011166747775860132, -0.0004663625499233604, -0.00023170316126197577, 0.0018186483066529036, -0.0014948951196856798, -0.00016428373492090033, -0.0003119172062724829, -0.0013755115447565915, 0.002602993906475604, 0.000023058174701873216, -0.000016855192370712757, -0.0012046594638377428, -0.00014418535865843297, 0.0014693727251142265, 0.0012946866874699481, 0.0016010180115699768, 0.00022849043307360262, -0.0007140473462641239, 0.0010709780268371106, 0.0004290861077606678, 0.002524780051317066, -0.0004979197168722749, 0.0005268135879305192, -0.001204889314249158, 0.001335247955285013, -0.0001557100098580122, -0.0009739698376506567, -0.0010365712398197502, 0.0007682244991883636, 0.0007964270189404488, 0.0004109033616259694 ] })" :) +(:JIQS: ShouldRun; Output="({ "label" : 0, "name" : "a", "stringArrayCol" : [ "i", "am", "data", "entry", "1" ], "word2vecResult" : [ -0.00008827828, 0.0015511172, 0.0012456904, -0.00017455248, 0.00076856045, -0.00037089834, -0.000959619, 0.0025182453, -0.00020799141, 0.00035348843, 0.000060372124, -0.001570256, 0.00048183594, -0.00008264915, 0.0019678646, -0.00045818483, -0.0012066972, 0.00012526265, -0.00069719163, -0.00027012263, -0.0027646115, -0.0023180179, 0.0013835154, 0.0006302525, 0.00031363277, -0.00021268702, 0.0025911133, -0.0023531953, -0.0019786593, 0.00094834523, -0.0009493409, -0.0017402583, 0.00079667824, 0.00007586753, -0.0002522038, 0.00027410983, -0.00037878405, 0.0014340893, -0.0012089841, -0.0017257415, 0.00044488328, 0.0005102019, -0.0009055898, 0.000035975176, 0.0005793334, -0.0005341326, -0.0013439569, -0.0000817982, -0.00077790394, -0.00021333783, 0.0012642501, -0.0007411713, 0.00056625804, 0.0016635436, 0.0008368029, -0.0009973658, 0.0007849428, -0.0023398069, -0.0003875856, 0.0010412907, 0.0005507867, 0.0008073827, 0.0024637238, 0.0015164696, 0.00036606396, 0.0012576625, -0.0009936349, -0.002645467, 0.00005925207, 0.0011166747, -0.00046636254, -0.00023170316, 0.0018186483, -0.0014948951, -0.00016428373, -0.00031191722, -0.0013755115, 0.002602994, 0.000023058175, -0.000016855192, -0.0012046595, -0.00014418535, 0.0014693728, 0.0012946867, 0.001601018, 0.00022849043, -0.00071404735, 0.001070978, 0.0004290861, 0.00252478, -0.00049791974, 0.0005268136, -0.0012048893, 0.001335248, -0.00015571, -0.0009739698, -0.0010365712, 0.0007682245, 0.000796427, 0.00041090336 ] }, { "label" : 1, "name" : "b", "stringArrayCol" : [ "i", "am", "data", "entry", "2" ], "word2vecResult" : [ -0.00008827828, 0.0015511172, 0.0012456904, -0.00017455248, 0.00076856045, -0.00037089834, -0.000959619, 0.0025182453, -0.00020799141, 0.00035348843, 0.000060372124, -0.001570256, 0.00048183594, -0.00008264915, 0.0019678646, -0.00045818483, -0.0012066972, 0.00012526265, -0.00069719163, -0.00027012263, -0.0027646115, -0.0023180179, 0.0013835154, 0.0006302525, 0.00031363277, -0.00021268702, 0.0025911133, -0.0023531953, -0.0019786593, 0.00094834523, -0.0009493409, -0.0017402583, 0.00079667824, 0.00007586753, -0.0002522038, 0.00027410983, -0.00037878405, 0.0014340893, -0.0012089841, -0.0017257415, 0.00044488328, 0.0005102019, -0.0009055898, 0.000035975176, 0.0005793334, -0.0005341326, -0.0013439569, -0.0000817982, -0.00077790394, -0.00021333783, 0.0012642501, -0.0007411713, 0.00056625804, 0.0016635436, 0.0008368029, -0.0009973658, 0.0007849428, -0.0023398069, -0.0003875856, 0.0010412907, 0.0005507867, 0.0008073827, 0.0024637238, 0.0015164696, 0.00036606396, 0.0012576625, -0.0009936349, -0.002645467, 0.00005925207, 0.0011166747, -0.00046636254, -0.00023170316, 0.0018186483, -0.0014948951, -0.00016428373, -0.00031191722, -0.0013755115, 0.002602994, 0.000023058175, -0.000016855192, -0.0012046595, -0.00014418535, 0.0014693728, 0.0012946867, 0.001601018, 0.00022849043, -0.00071404735, 0.001070978, 0.0004290861, 0.00252478, -0.00049791974, 0.0005268136, -0.0012048893, 0.001335248, -0.00015571, -0.0009739698, -0.0010365712, 0.0007682245, 0.000796427, 0.00041090336 ] }, { "label" : 2, "name" : "c", "stringArrayCol" : [ "i", "am", "data", "entry", "3" ], "word2vecResult" : [ -0.00008827828, 0.0015511172, 0.0012456904, -0.00017455248, 0.00076856045, -0.00037089834, -0.000959619, 0.0025182453, -0.00020799141, 0.00035348843, 0.000060372124, -0.001570256, 0.00048183594, -0.00008264915, 0.0019678646, -0.00045818483, -0.0012066972, 0.00012526265, -0.00069719163, -0.00027012263, -0.0027646115, -0.0023180179, 0.0013835154, 0.0006302525, 0.00031363277, -0.00021268702, 0.0025911133, -0.0023531953, -0.0019786593, 0.00094834523, -0.0009493409, -0.0017402583, 0.00079667824, 0.00007586753, -0.0002522038, 0.00027410983, -0.00037878405, 0.0014340893, -0.0012089841, -0.0017257415, 0.00044488328, 0.0005102019, -0.0009055898, 0.000035975176, 0.0005793334, -0.0005341326, -0.0013439569, -0.0000817982, -0.00077790394, -0.00021333783, 0.0012642501, -0.0007411713, 0.00056625804, 0.0016635436, 0.0008368029, -0.0009973658, 0.0007849428, -0.0023398069, -0.0003875856, 0.0010412907, 0.0005507867, 0.0008073827, 0.0024637238, 0.0015164696, 0.00036606396, 0.0012576625, -0.0009936349, -0.002645467, 0.00005925207, 0.0011166747, -0.00046636254, -0.00023170316, 0.0018186483, -0.0014948951, -0.00016428373, -0.00031191722, -0.0013755115, 0.002602994, 0.000023058175, -0.000016855192, -0.0012046595, -0.00014418535, 0.0014693728, 0.0012946867, 0.001601018, 0.00022849043, -0.00071404735, 0.001070978, 0.0004290861, 0.00252478, -0.00049791974, 0.0005268136, -0.0012048893, 0.001335248, -0.00015571, -0.0009739698, -0.0010365712, 0.0007682245, 0.000796427, 0.00041090336 ] }, { "label" : 3, "name" : "d", "stringArrayCol" : [ "i", "am", "data", "entry", "4" ], "word2vecResult" : [ -0.00008827828, 0.0015511172, 0.0012456904, -0.00017455248, 0.00076856045, -0.00037089834, -0.000959619, 0.0025182453, -0.00020799141, 0.00035348843, 0.000060372124, -0.001570256, 0.00048183594, -0.00008264915, 0.0019678646, -0.00045818483, -0.0012066972, 0.00012526265, -0.00069719163, -0.00027012263, -0.0027646115, -0.0023180179, 0.0013835154, 0.0006302525, 0.00031363277, -0.00021268702, 0.0025911133, -0.0023531953, -0.0019786593, 0.00094834523, -0.0009493409, -0.0017402583, 0.00079667824, 0.00007586753, -0.0002522038, 0.00027410983, -0.00037878405, 0.0014340893, -0.0012089841, -0.0017257415, 0.00044488328, 0.0005102019, -0.0009055898, 0.000035975176, 0.0005793334, -0.0005341326, -0.0013439569, -0.0000817982, -0.00077790394, -0.00021333783, 0.0012642501, -0.0007411713, 0.00056625804, 0.0016635436, 0.0008368029, -0.0009973658, 0.0007849428, -0.0023398069, -0.0003875856, 0.0010412907, 0.0005507867, 0.0008073827, 0.0024637238, 0.0015164696, 0.00036606396, 0.0012576625, -0.0009936349, -0.002645467, 0.00005925207, 0.0011166747, -0.00046636254, -0.00023170316, 0.0018186483, -0.0014948951, -0.00016428373, -0.00031191722, -0.0013755115, 0.002602994, 0.000023058175, -0.000016855192, -0.0012046595, -0.00014418535, 0.0014693728, 0.0012946867, 0.001601018, 0.00022849043, -0.00071404735, 0.001070978, 0.0004290861, 0.00252478, -0.00049791974, 0.0005268136, -0.0012048893, 0.001335248, -0.00015571, -0.0009739698, -0.0010365712, 0.0007682245, 0.000796427, 0.00041090336 ] }, { "label" : 4, "name" : "e", "stringArrayCol" : [ "i", "am", "data", "entry", "5" ], "word2vecResult" : [ -0.00008827828, 0.0015511172, 0.0012456904, -0.00017455248, 0.00076856045, -0.00037089834, -0.000959619, 0.0025182453, -0.00020799141, 0.00035348843, 0.000060372124, -0.001570256, 0.00048183594, -0.00008264915, 0.0019678646, -0.00045818483, -0.0012066972, 0.00012526265, -0.00069719163, -0.00027012263, -0.0027646115, -0.0023180179, 0.0013835154, 0.0006302525, 0.00031363277, -0.00021268702, 0.0025911133, -0.0023531953, -0.0019786593, 0.00094834523, -0.0009493409, -0.0017402583, 0.00079667824, 0.00007586753, -0.0002522038, 0.00027410983, -0.00037878405, 0.0014340893, -0.0012089841, -0.0017257415, 0.00044488328, 0.0005102019, -0.0009055898, 0.000035975176, 0.0005793334, -0.0005341326, -0.0013439569, -0.0000817982, -0.00077790394, -0.00021333783, 0.0012642501, -0.0007411713, 0.00056625804, 0.0016635436, 0.0008368029, -0.0009973658, 0.0007849428, -0.0023398069, -0.0003875856, 0.0010412907, 0.0005507867, 0.0008073827, 0.0024637238, 0.0015164696, 0.00036606396, 0.0012576625, -0.0009936349, -0.002645467, 0.00005925207, 0.0011166747, -0.00046636254, -0.00023170316, 0.0018186483, -0.0014948951, -0.00016428373, -0.00031191722, -0.0013755115, 0.002602994, 0.000023058175, -0.000016855192, -0.0012046595, -0.00014418535, 0.0014693728, 0.0012946867, 0.001601018, 0.00022849043, -0.00071404735, 0.001070978, 0.0004290861, 0.00252478, -0.00049791974, 0.0005268136, -0.0012048893, 0.001335248, -0.00015571, -0.0009739698, -0.0010365712, 0.0007682245, 0.000796427, 0.00041090336 ] }, { "label" : 5, "name" : "f", "stringArrayCol" : [ "i", "am", "data", "entry", "6" ], "word2vecResult" : [ -0.00008827828, 0.0015511172, 0.0012456904, -0.00017455248, 0.00076856045, -0.00037089834, -0.000959619, 0.0025182453, -0.00020799141, 0.00035348843, 0.000060372124, -0.001570256, 0.00048183594, -0.00008264915, 0.0019678646, -0.00045818483, -0.0012066972, 0.00012526265, -0.00069719163, -0.00027012263, -0.0027646115, -0.0023180179, 0.0013835154, 0.0006302525, 0.00031363277, -0.00021268702, 0.0025911133, -0.0023531953, -0.0019786593, 0.00094834523, -0.0009493409, -0.0017402583, 0.00079667824, 0.00007586753, -0.0002522038, 0.00027410983, -0.00037878405, 0.0014340893, -0.0012089841, -0.0017257415, 0.00044488328, 0.0005102019, -0.0009055898, 0.000035975176, 0.0005793334, -0.0005341326, -0.0013439569, -0.0000817982, -0.00077790394, -0.00021333783, 0.0012642501, -0.0007411713, 0.00056625804, 0.0016635436, 0.0008368029, -0.0009973658, 0.0007849428, -0.0023398069, -0.0003875856, 0.0010412907, 0.0005507867, 0.0008073827, 0.0024637238, 0.0015164696, 0.00036606396, 0.0012576625, -0.0009936349, -0.002645467, 0.00005925207, 0.0011166747, -0.00046636254, -0.00023170316, 0.0018186483, -0.0014948951, -0.00016428373, -0.00031191722, -0.0013755115, 0.002602994, 0.000023058175, -0.000016855192, -0.0012046595, -0.00014418535, 0.0014693728, 0.0012946867, 0.001601018, 0.00022849043, -0.00071404735, 0.001070978, 0.0004290861, 0.00252478, -0.00049791974, 0.0005268136, -0.0012048893, 0.001335248, -0.00015571, -0.0009739698, -0.0010365712, 0.0007682245, 0.000796427, 0.00041090336 ] })" :) + + let $data := annotate( json-file("../../../../queries/rumbleML/sample-ml-data-flat.json"), { "label": "integer", "binaryLabel": "integer", "name": "string", "age": "double", "weight": "double", "booleanCol": "boolean", "nullCol": "null", "stringCol": "string", "stringArrayCol": ["string"], "intArrayCol": ["integer"], "doubleArrayCol": ["double"], "doubleArrayArrayCol": [["double"]] } @@ -17,5 +19,5 @@ return { "label": $result.label, "name": $result.name, "stringArrayCol": $result.stringArrayCol, - "word2vecResult": $result.word2vecResult + "word2vecResult": [ for $v in $result.word2vecResult[] return float($v) ] } diff --git a/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline1.jq b/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline1.jq index 297962782..2f3d492da 100644 --- a/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline1.jq +++ b/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline1.jq @@ -1,4 +1,16 @@ -(:JIQS: ShouldRun; Output="({ "id" : 0, "label" : 1, "col1" : -1, "col2" : 1.5, "col3" : 1.3, "features" : [ -1, 1.5, 1.3 ], "features2" : [ 0.6811443247067493, -1.6574062675838126 ], "rawPrediction" : [ -37.806767087841095, 37.806767087841095 ], "probability" : [ 3.80828704311553E-17, 1 ], "ocol1" : 1 }, { "id" : 1, "label" : 0, "col1" : 3, "col2" : 2, "col3" : -0.1, "features" : [ 3, 2, -0.1 ], "features2" : [ -2.9389857055027706, 0.48441694826197546 ], "rawPrediction" : [ 37.56770709258579, -37.56770709258579 ], "probability" : [ 1, 0 ], "ocol1" : 0 }, { "id" : 2, "label" : 1, "col1" : 0, "col2" : 2.2, "col3" : -1.5, "features" : [ 0, 2.2, -1.5 ], "features2" : [ 0.28609394877170796, 1.1822492465709793 ], "rawPrediction" : [ -19.168353441006694, 19.168353441006694 ], "probability" : [ 4.734671708106025E-9, 0.9999999952653283 ], "ocol1" : 1 })" :) +(:JIQS: ShouldRun; Output="({ "id" : 0, "label" : 1, "col1" : -1, "col2" : 1.5, "col3" : 1.3, "features" : [ -1, 1.5, 1.3 ], "ocol1" : 1, "features2" : [ 0.6811443, -1.6574062 ], "rawPrediction" : [ -37.806767, 37.806767 ], "probability" : [ 3.808287E-17, 1 ] }, { "id" : 1, "label" : 0, "col1" : 3, "col2" : 2, "col3" : -0.1, "features" : [ 3, 2, -0.1 ], "ocol1" : 0, "features2" : [ -2.9389858, 0.48441696 ], "rawPrediction" : [ 37.567707, -37.567707 ], "probability" : [ 1, 0 ] }, { "id" : 2, "label" : 1, "col1" : 0, "col2" : 2.2, "col3" : -1.5, "features" : [ 0, 2.2, -1.5 ], "ocol1" : 1, "features2" : [ 0.28609395, 1.1822492 ], "rawPrediction" : [ -19.168354, 19.168354 ], "probability" : [ 4.7346718E-9, 1 ] })" :) + +declare function local:round($i as object) as object { + {| + remove-keys($i, ("features2", "rawPrediction", "probability")), + { + "features2" : [ for $v in $i.features2[] return float($v) ], + "rawPrediction" : [ for $v in $i.rawPrediction[] return float($v) ], + "probability" : [ for $v in $i.probability[] return float($v) ] + } + |} +}; + let $vector-assembler := get-transformer("VectorAssembler") let $training-data := ( {"id": 0, "label": 1, "col1": 0.0, "col2": 1.1, "col3": 0.1}, @@ -26,4 +38,4 @@ for $i in $trained_est2( $my-new-test-data, {"featuresCol": "features2", "predictionCol": "ocol1"} ) -return $i \ No newline at end of file +return local:round($i) \ No newline at end of file diff --git a/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline2.jq b/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline2.jq index 57b2c3bc0..cbc61c193 100644 --- a/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline2.jq +++ b/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline2.jq @@ -1,4 +1,17 @@ -(:JIQS: ShouldRun; Output="({ "id" : 0, "label" : 1, "col1" : -1, "col2" : 1.5, "col3" : 1.3, "features" : [ -1, 1.5, 1.3 ], "features2" : [ 0.6811443247067493, -1.6574062675838126 ], "rawPrediction" : [ -37.806767087841095, 37.806767087841095 ], "probability" : [ 3.80828704311553E-17, 1 ], "ocol1" : 1 }, { "id" : 1, "label" : 0, "col1" : 3, "col2" : 2, "col3" : -0.1, "features" : [ 3, 2, -0.1 ], "features2" : [ -2.9389857055027706, 0.48441694826197546 ], "rawPrediction" : [ 37.56770709258579, -37.56770709258579 ], "probability" : [ 1, 0 ], "ocol1" : 0 }, { "id" : 2, "label" : 1, "col1" : 0, "col2" : 2.2, "col3" : -1.5, "features" : [ 0, 2.2, -1.5 ], "features2" : [ 0.28609394877170796, 1.1822492465709793 ], "rawPrediction" : [ -19.168353441006694, 19.168353441006694 ], "probability" : [ 4.734671708106025E-9, 0.9999999952653283 ], "ocol1" : 1 })" :) +(:JIQS: ShouldRun; Output="({ "id" : 0, "label" : 1, "col1" : -1, "col2" : 1.5, "col3" : 1.3, "features" : [ -1, 1.5, 1.3 ], "ocol1" : 1, "features2" : [ 0.6811443, -1.6574062 ], "rawPrediction" : [ -37.806767, 37.806767 ], "probability" : [ 3.808287E-17, 1 ] }, { "id" : 1, "label" : 0, "col1" : 3, "col2" : 2, "col3" : -0.1, "features" : [ 3, 2, -0.1 ], "ocol1" : 0, "features2" : [ -2.9389858, 0.48441696 ], "rawPrediction" : [ 37.567707, -37.567707 ], "probability" : [ 1, 0 ] }, { "id" : 2, "label" : 1, "col1" : 0, "col2" : 2.2, "col3" : -1.5, "features" : [ 0, 2.2, -1.5 ], "ocol1" : 1, "features2" : [ 0.28609395, 1.1822492 ], "rawPrediction" : [ -19.168354, 19.168354 ], "probability" : [ 4.7346718E-9, 1 ] })" :) + +declare function local:round($i as object) as object { + {| + remove-keys($i, ("features2", "rawPrediction", "probability")), + { + "features2" : [ for $v in $i.features2[] return float($v) ], + "rawPrediction" : [ for $v in $i.rawPrediction[] return float($v) ], + "probability" : [ for $v in $i.probability[] return float($v) ] + } + |} +}; + + let $vector-assembler := get-transformer("VectorAssembler")(?, { "inputCols" : [ "col1", "col2", "col3" ], "outputCol" : "features" }) let $training-data := ( {"id": 0, "label": 1, "col1": 0.0, "col2": 1.1, "col3": 0.1}, @@ -26,4 +39,4 @@ for $i in $trained_est2( $my-new-test-data, {"featuresCol": "features2", "predictionCol": "ocol1"} ) -return $i \ No newline at end of file +return local:round($i) \ No newline at end of file diff --git a/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline3.jq b/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline3.jq index 37e99a394..2b1ac52fd 100644 --- a/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline3.jq +++ b/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline3.jq @@ -1,4 +1,16 @@ -(:JIQS: ShouldRun; Output="({ "id" : 0, "label" : 1, "col1" : -1, "col2" : 1.5, "col3" : 1.3, "features" : [ -1, 1.5, 1.3 ], "features2" : [ 0.6811443247067493, -1.6574062675838126 ], "rawPrediction" : [ -37.806767087841095, 37.806767087841095 ], "probability" : [ 3.80828704311553E-17, 1 ], "ocol1" : 1 }, { "id" : 1, "label" : 0, "col1" : 3, "col2" : 2, "col3" : -0.1, "features" : [ 3, 2, -0.1 ], "features2" : [ -2.9389857055027706, 0.48441694826197546 ], "rawPrediction" : [ 37.56770709258579, -37.56770709258579 ], "probability" : [ 1, 0 ], "ocol1" : 0 }, { "id" : 2, "label" : 1, "col1" : 0, "col2" : 2.2, "col3" : -1.5, "features" : [ 0, 2.2, -1.5 ], "features2" : [ 0.28609394877170796, 1.1822492465709793 ], "rawPrediction" : [ -19.168353441006694, 19.168353441006694 ], "probability" : [ 4.734671708106025E-9, 0.9999999952653283 ], "ocol1" : 1 })" :) +(:JIQS: ShouldRun; Output="({ "id" : 0, "label" : 1, "col1" : -1, "col2" : 1.5, "col3" : 1.3, "features" : [ -1, 1.5, 1.3 ], "ocol1" : 1, "features2" : [ 0.6811443, -1.6574062 ], "rawPrediction" : [ -37.806767, 37.806767 ], "probability" : [ 3.808287E-17, 1 ] }, { "id" : 1, "label" : 0, "col1" : 3, "col2" : 2, "col3" : -0.1, "features" : [ 3, 2, -0.1 ], "ocol1" : 0, "features2" : [ -2.9389858, 0.48441696 ], "rawPrediction" : [ 37.567707, -37.567707 ], "probability" : [ 1, 0 ] }, { "id" : 2, "label" : 1, "col1" : 0, "col2" : 2.2, "col3" : -1.5, "features" : [ 0, 2.2, -1.5 ], "ocol1" : 1, "features2" : [ 0.28609395, 1.1822492 ], "rawPrediction" : [ -19.168354, 19.168354 ], "probability" : [ 4.7346718E-9, 1 ] })" :) + +declare function local:round($i as object) as object { + {| + remove-keys($i, ("features2", "rawPrediction", "probability")), + { + "features2" : [ for $v in $i.features2[] return float($v) ], + "rawPrediction" : [ for $v in $i.rawPrediction[] return float($v) ], + "probability" : [ for $v in $i.probability[] return float($v) ] + } + |} +}; + declare type local:mytype as { "id": "integer", "label": "integer", "col1": "decimal", "col2": "decimal", "col3": "decimal" @@ -33,4 +45,4 @@ for $i in $trained_est2( $my-new-test-data, {"featuresCol": "features2", "predictionCol": "ocol1"} ) -return $i \ No newline at end of file +return local:round($i) \ No newline at end of file diff --git a/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline4.jq b/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline4.jq index ab9d09ab9..1cfa0d8db 100644 --- a/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline4.jq +++ b/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline4.jq @@ -1,4 +1,15 @@ -(:JIQS: ShouldRun; Output="({ "id" : 0, "label" : 1, "col1" : -1, "col2" : 1.5, "col3" : 1.3, "features" : [ -1, 1.5, 1.3 ], "rawPrediction" : [ -38.071372676778395, 38.071372676778395 ], "probability" : [ 2.9228930727443083E-17, 1 ], "prediction" : 1 }, { "id" : 1, "label" : 0, "col1" : 3, "col2" : 2, "col3" : -0.1, "features" : [ 3, 2, -0.1 ], "rawPrediction" : [ 36.29582598188425, -36.29582598188425 ], "probability" : [ 0.9999999999999998, 2.220446049250313E-16 ], "prediction" : 0 }, { "id" : 2, "label" : 1, "col1" : 0, "col2" : 2.2, "col3" : -1.5, "features" : [ 0, 2.2, -1.5 ], "rawPrediction" : [ -21.188416917061183, 21.188416917061183 ], "probability" : [ 6.280402132397163E-10, 0.9999999993719598 ], "prediction" : 1 })" :) +(:JIQS: ShouldRun; Output="({ "id" : 0, "label" : 1, "col1" : -1, "col2" : 1.5, "col3" : 1.3, "features" : [ -1, 1.5, 1.3 ], "prediction" : 1, "features2" : [ ], "rawPrediction" : [ -38.071373, 38.071373 ], "probability" : [ 2.922893E-17, 1 ] }, { "id" : 1, "label" : 0, "col1" : 3, "col2" : 2, "col3" : -0.1, "features" : [ 3, 2, -0.1 ], "prediction" : 0, "features2" : [ ], "rawPrediction" : [ 36.295826, -36.295826 ], "probability" : [ 1, 2.220446E-16 ] }, { "id" : 2, "label" : 1, "col1" : 0, "col2" : 2.2, "col3" : -1.5, "features" : [ 0, 2.2, -1.5 ], "prediction" : 1, "features2" : [ ], "rawPrediction" : [ -21.188417, 21.188417 ], "probability" : [ 6.2804023E-10, 1 ] })" :) + +declare function local:round($i as object) as object { + {| + remove-keys($i, ("features2", "rawPrediction", "probability")), + { + "features2" : [ for $v in $i.features2[] return float($v) ], + "rawPrediction" : [ for $v in $i.rawPrediction[] return float($v) ], + "probability" : [ for $v in $i.probability[] return float($v) ] + } + |} +}; declare type local:mytype as {"id": "integer", "label": "integer", "col1": "decimal", "col2": "decimal", "col3": "decimal"}; @@ -26,4 +37,5 @@ let $test-data := $vector-assembler(validate type local:mytype* { }) let $pip := local:pipeline($training-data, ?) -return $pip($test-data) \ No newline at end of file +for $i in $pip($test-data) +return local:round($i) \ No newline at end of file diff --git a/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline5.jq b/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline5.jq index 679ff7ac1..97746b702 100644 --- a/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline5.jq +++ b/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline5.jq @@ -1,6 +1,17 @@ -(:JIQS: ShouldRun; Output="({ "id" : 0, "label" : 1, "col1" : -1, "col2" : 1.5, "col3" : 1.3, "features" : [ -1, 1.5, 1.3 ], "rawPrediction" : [ -38.071372676778395, 38.071372676778395 ], "probability" : [ 2.9228930727443083E-17, 1 ], "prediction" : 1 }, { "id" : 1, "label" : 0, "col1" : 3, "col2" : 2, "col3" : -0.1, "features" : [ 3, 2, -0.1 ], "rawPrediction" : [ 36.29582598188425, -36.29582598188425 ], "probability" : [ 0.9999999999999998, 2.220446049250313E-16 ], "prediction" : 0 }, { "id" : 2, "label" : 1, "col1" : 0, "col2" : 2.2, "col3" : -1.5, "features" : [ 0, 2.2, -1.5 ], "rawPrediction" : [ -21.188416917061183, 21.188416917061183 ], "probability" : [ 6.280402132397163E-10, 0.9999999993719598 ], "prediction" : 1 })" :) +(:JIQS: ShouldRun; Output="({ "id" : 0, "label" : 1, "col1" : -1, "col2" : 1.5, "col3" : 1.3, "features" : [ -1, 1.5, 1.3 ], "prediction" : 1, "features2" : [ ], "rawPrediction" : [ -38.071373, 38.071373 ], "probability" : [ 2.922893E-17, 1 ] }, { "id" : 1, "label" : 0, "col1" : 3, "col2" : 2, "col3" : -0.1, "features" : [ 3, 2, -0.1 ], "prediction" : 0, "features2" : [ ], "rawPrediction" : [ 36.295826, -36.295826 ], "probability" : [ 1, 2.220446E-16 ] }, { "id" : 2, "label" : 1, "col1" : 0, "col2" : 2.2, "col3" : -1.5, "features" : [ 0, 2.2, -1.5 ], "prediction" : 1, "features2" : [ ], "rawPrediction" : [ -21.188417, 21.188417 ], "probability" : [ 6.2804023E-10, 1 ] })" :) declare type local:mytype as {"id": "integer", "label": "integer", "col1": "decimal", "col2": "decimal", "col3": "decimal"}; +declare function local:round($i as object) as object { + {| + remove-keys($i, ("features2", "rawPrediction", "probability")), + { + "features2" : [ for $v in $i.features2[] return float($v) ], + "rawPrediction" : [ for $v in $i.rawPrediction[] return float($v) ], + "probability" : [ for $v in $i.probability[] return float($v) ] + } + |} +}; + let $vector-assembler := get-transformer("VectorAssembler", {"inputCols" : [ "col1", "col2", "col3" ], "outputCol" : "features"}) let $logisticregression := get-estimator("LogisticRegression", { "featuresCol" : "features" }) @@ -20,4 +31,6 @@ let $test-data := validate type local:mytype* { } let $pip := $pipeline($training-data, {}) -return $pip($test-data, {}) +for $i in $pip($test-data, {}) +return local:round($i) + diff --git a/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline6.jq b/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline6.jq index 69b981b46..90f185f58 100644 --- a/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline6.jq +++ b/src/test/resources/test_files/RumbleML/RumbleML/MLPipeline6.jq @@ -1,6 +1,17 @@ -(:JIQS: ShouldRun; Output="({ "id" : 0, "label" : 1, "col1" : -1, "col2" : 1.5, "col3" : 1.3, "features" : [ -1, 1.5, 1.3 ], "rawPrediction" : [ -38.071372676778395, 38.071372676778395 ], "probability" : [ 2.9228930727443083E-17, 1 ], "prediction" : 1 }, { "id" : 1, "label" : 0, "col1" : 3, "col2" : 2, "col3" : -0.1, "features" : [ 3, 2, -0.1 ], "rawPrediction" : [ 36.29582598188425, -36.29582598188425 ], "probability" : [ 0.9999999999999998, 2.220446049250313E-16 ], "prediction" : 0 }, { "id" : 2, "label" : 1, "col1" : 0, "col2" : 2.2, "col3" : -1.5, "features" : [ 0, 2.2, -1.5 ], "rawPrediction" : [ -21.188416917061183, 21.188416917061183 ], "probability" : [ 6.280402132397163E-10, 0.9999999993719598 ], "prediction" : 1 })" :) +(:JIQS: ShouldRun; Output="({ "id" : 0, "label" : 1, "col1" : -1, "col2" : 1.5, "col3" : 1.3, "features" : [ -1, 1.5, 1.3 ], "prediction" : 1, "features2" : [ ], "rawPrediction" : [ -38.071373, 38.071373 ], "probability" : [ 2.922893E-17, 1 ] }, { "id" : 1, "label" : 0, "col1" : 3, "col2" : 2, "col3" : -0.1, "features" : [ 3, 2, -0.1 ], "prediction" : 0, "features2" : [ ], "rawPrediction" : [ 36.295826, -36.295826 ], "probability" : [ 1, 2.220446E-16 ] }, { "id" : 2, "label" : 1, "col1" : 0, "col2" : 2.2, "col3" : -1.5, "features" : [ 0, 2.2, -1.5 ], "prediction" : 1, "features2" : [ ], "rawPrediction" : [ -21.188417, 21.188417 ], "probability" : [ 6.2804023E-10, 1 ] })" :) declare type local:mytype as {"id": "integer", "label": "integer", "col1": "decimal", "col2": "decimal", "col3": "decimal"}; +declare function local:round($i as object) as object { + {| + remove-keys($i, ("features2", "rawPrediction", "probability")), + { + "features2" : [ for $v in $i.features2[] return float($v) ], + "rawPrediction" : [ for $v in $i.rawPrediction[] return float($v) ], + "probability" : [ for $v in $i.probability[] return float($v) ] + } + |} +}; + let $pipeline := get-estimator("Pipeline", { "stages" : [ get-transformer("VectorAssembler", {"inputCols" : [ "col1", "col2", "col3" ], "outputCol" : "features"}), @@ -21,4 +32,6 @@ let $test-data := validate type local:mytype* { } let $pip := $pipeline($training-data, {}) -return $pip($test-data, {}) +for $i in $pip($test-data, {}) +return local:round($i) +