You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by roni <ro...@gmail.com> on 2015/03/19 02:14:55 UTC

saving or visualizing PCA

Hi ,
 I am generating PCA using spark .
But I dont know how to save it to disk or visualize it.
Can some one give me some pointerspl.
Thanks
-Roni

Re: saving or visualizing PCA

Posted by Reza Zadeh <re...@databricks.com>.
Also the guide on this is useful:
http://spark.apache.org/docs/latest/mllib-dimensionality-reduction.html#principal-component-analysis-pca

On Wed, Mar 18, 2015 at 11:46 PM, Reza Zadeh <re...@databricks.com> wrote:

> You can visualize PCA for example by
>
> val N = 2
> val pc: Matrix = mat.computePrincipalComponents(N) // Principal components
> are stored in a local dense matrix.
>
> // Project the rows to the linear space spanned by the top N principal
> components.
> val projected: RowMatrix = mat.multiply(pc)
>
> Each row of 'projected' now is two dimensional and can be plotted.
>
> Reza
>
>
>
> On Wed, Mar 18, 2015 at 9:14 PM, roni <ro...@gmail.com> wrote:
>
>> Hi ,
>>  I am generating PCA using spark .
>> But I dont know how to save it to disk or visualize it.
>> Can some one give me some pointerspl.
>> Thanks
>> -Roni
>>
>
>

Re: saving or visualizing PCA

Posted by Reza Zadeh <re...@databricks.com>.
You can visualize PCA for example by

val N = 2
val pc: Matrix = mat.computePrincipalComponents(N) // Principal components
are stored in a local dense matrix.

// Project the rows to the linear space spanned by the top N principal
components.
val projected: RowMatrix = mat.multiply(pc)

Each row of 'projected' now is two dimensional and can be plotted.

Reza



On Wed, Mar 18, 2015 at 9:14 PM, roni <ro...@gmail.com> wrote:

> Hi ,
>  I am generating PCA using spark .
> But I dont know how to save it to disk or visualize it.
> Can some one give me some pointerspl.
> Thanks
> -Roni
>