The 2-degree expansion of (x,y,z) is, in this implementation:

(x, x^2, y, xy, y^2, z, xz, yz, z^2)

Given your input is (1,0,1), the output (1,1,0,0,0,1,1,0,1) is right.


On Mon, May 30, 2016 at 12:37 AM, Jeff Zhang <zjf...@gmail.com> wrote:
> I use PolynomialExpansion to convert one vector to 2-degree vector. I am
> confused about the result of following. As my understanding, the 2 degrees
> vector should contain 4 1's, not sure how the 5 1's come from. I think it
> supposed to be (x1,x2,x3) *(x1,x2,x3) = (x1*x1, x1*x2, x1*x3, x2*x1,x2*x2,
> x2*x3, x3*x1, x3*x2,x3*x3)
>
> (3,[0,2],[1.0,1.0])  -->
> (9,[0,1,5,6,8],[1.0,1.0,1.0,1.0,1.0])|
>
>
> --
> Best Regards
>
> Jeff Zhang

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org

Reply via email to