Can we agree on a conversion on naming the output. Please share what you have decided so far.
Regards Suho On Fri, Nov 10, 2017 at 6:48 AM Niruhan Viswarupan <[email protected]> wrote: > I could get the extension to make predictions from the KMeans saved model > I prepared. Please find the extension here > <https://github.com/niruhan/siddhi-execution-streamingml/tree/master/component/src/main/java/org/wso2/extension/siddhi/execution/streamingml/tensorflow> > and > the test case here > <https://github.com/niruhan/siddhi-execution-streamingml/blob/master/component/src/test/java/org/wso2/extension/siddhi/execution/streamingml/tensorflow/TensorFlowSPExtensionTest.java> > > Regards, > > > *Niruhan Viswarupan* > Engineering Intern | WSO2 > Phone: +94776468013 > > On Fri, Nov 10, 2017 at 10:42 AM, Niruhan Viswarupan <[email protected]> > wrote: > >> [-Analytics-group, -engineering-group, + dev] >> >> The output tensor can be a single scalar value or a multidimensional >> array. It totally *depends on the model* and how its output is >> configured. >> >> For example, >> >> 1. if we have a model for classification and its prediction is >> configured to send a string of the class name then we will get a *scalar >> (A Tensor of 0 dimension)* string tensor. >> 2. If we have a clustering model it can output the coordinates of the >> closest centroid as a tensor which can be a *vector (A tensor of 1 >> dimension) *with any length (For example vector length will be 2 in >> the case of Cartesian plane, 3 in the case of 3D coordinate system etc). >> >> *(Note:* The above examples have only a few values in output Tensors. >> But it is possible for someone to build a TensorFlow model that sends out a >> Tensor with thousands of dimensions and thousands of length per dimension.) >> >> *Terminology:* >> eg. Consider a 3x4 *matrix (a tensor of 2 dimensions)* as below, >> >> 1 2 3 4 >> 5 6 7 8 >> 9 1 2 3 >> This has 2 dimensions and length of 1st dimension is 3 and the 2nd >> dimension is 4. >> >> Also *problems identified in sending out multidimensional arrays in the >> output stream* are, >> >> 1. Its a *challenge to create primitive type multidimensional arrays* >> (This is the type supported by Tensors copying method) whose *dimensions >> are unknown at compile time* in Java (I welcome any suggestion as to >> how this could be done) >> 2. As pointed out by Tishan *other extensions of Siddhi are not >> configured to handle arrays*. So cannot process the output arrays of >> this extension further in Siddhi >> >> Considering the above issues we decided to flatten the Tensor and send >> all the values in a tensor one by one in primitive type. *In most cases >> output Tensor will have a small number of values*. >> >> Regards, >> >> *Niruhan Viswarupan* >> Engineering Intern | WSO2 >> Phone: +94776468013 <+94%2077%20646%208013> >> >> On Thu, Nov 9, 2017 at 11:41 PM, Sriskandarajah Suhothayan <[email protected] >> > wrote: >> >>> Does Tensor always output multidimensional array or only for some cases? >>> If it returns a multidimensional array what sort of processing the user >>> should be doing to get sense out of it? >>> >>> My doubt is having a way to send multidimensional array out will solve >>> the user's problem. >>> >>> Regards >>> Suho >>> >>> On Thu, Nov 9, 2017 at 8:45 AM, Niruhan Viswarupan <[email protected]> >>> wrote: >>> >>>> Hi, >>>> >>>> This is regarding supporting predictions from TensorFlow saved models >>>> using stream processor. >>>> >>>> The *predictions (outputs) from a TensorFlow model in Java API will be >>>> a Tensor >>>> <https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Tensor> >>>> object*. This can have any number of dimensions and any shape. This >>>> means that *we will not know the shape of the output multidimensional >>>> array in the compile time*. This will only come to light in the run >>>> time when the user input model is loaded. I was stuck with creating >>>> multidimensional arrays of run time specified shape. It is solvable for >>>> object arrays since they can be recursively built. But the copyTo() >>>> <https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Tensor.html#copyTo(U)> >>>> method >>>> of Tensor works only for primitive type arrays. >>>> >>>> So after a discussion with Tishan we *decided to flatten the >>>> multidimensional Tensor* and output them as one-by-one primitive types >>>> that Siddhi handles. For example a 2x3 matrix Tensor [ [1,2,3], [4,5,6] ] >>>> will be output as 6 separate int into the event. >>>> >>>> Please find the *user story here >>>> <https://docs.google.com/document/d/1aISBIpG5hzCXzeOh_vK3DSG_B63HT40B4xTZWCFREOM/edit#heading=h.wqd5v6f5j5hc>* >>>> and >>>> the preliminary *coding works here >>>> <https://github.com/niruhan/siddhi-execution-streamingml/tree/master/component/src/main/java/org/wso2/extension/siddhi/execution/streamingml/tensorflow>* >>>> . >>>> >>>> Regards, >>>> >>>> *Niruhan Viswarupan* >>>> Engineering Intern | WSO2 >>>> Phone: +94776468013 <077%20646%208013> >>>> >>> >>> >>> >>> -- >>> >>> *S. Suhothayan* >>> Associate Director / Architect >>> *WSO2 Inc. *http://wso2.com >>> * <http://wso2.com/>* >>> lean . enterprise . middleware >>> >>> >>> *cell: (+94) 779 756 757 <+94%2077%20975%206757> | blog: >>> http://suhothayan.blogspot.com/ <http://suhothayan.blogspot.com/>twitter: >>> http://twitter.com/suhothayan <http://twitter.com/suhothayan> | linked-in: >>> http://lk.linkedin.com/in/suhothayan <http://lk.linkedin.com/in/suhothayan>* >>> >> >> > -- *S. Suhothayan* Associate Director / Architect *WSO2 Inc. *http://wso2.com * <http://wso2.com/>* lean . enterprise . middleware *cell: (+94) 779 756 757 | blog: http://suhothayan.blogspot.com/ <http://suhothayan.blogspot.com/>twitter: http://twitter.com/suhothayan <http://twitter.com/suhothayan> | linked-in: http://lk.linkedin.com/in/suhothayan <http://lk.linkedin.com/in/suhothayan>*
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
