Re: [Java-ML-support] Read MCL result from SparseMatrix representation
Status: Beta
Brought to you by:
thomasabeel
From: Chris C. <chr...@ya...> - 2012-08-23 16:47:59
|
Hi Thomas, The code in net.sf.javaml.clustering.mcl.MCL.java does the trick, provided I fill the matrix entirely (else my triangular superior matrix does not favour random walks ;-)) Thanks a lot ! Chris ________________________________ From: Thomas Abeel <th...@ab...> To: Chris Csdev <chr...@ya...>; jav...@li... Sent: Thursday, August 23, 2012 6:09 PM Subject: Re: [Java-ML-support] Read MCL result from SparseMatrix representation Hi Chris, I think your best bet is to go into the SparseMatrix code or into the MCL clustering class code. net.sf.javaml.clustering.mcl.MCL.java has a method that extracts the clusters from the sparse matrix. You can check how it's done there and that should give you a good idea on how to do it yourself. cheers, Thomas On 8/22/2012 5:47 PM, Chris Csdev wrote: Dear all, > > > >I am investigating java-ml for its Markov CLustering implementation. >In my current project, I have a in-memory model of 2D adjency matrix (a two-dimensional array of the double primitive type : double[][]). > > >Note that this matrix is sparse in the sense that it is triangular superior (I am using a symetric distance, hence I don't fill the inferior triangle of my 2D matrix). > > >Fortunately, I can convert it into a SparseMatrix using the associated constructor and then run the MCL algorithm. > > >The code fragment from my program is as follows. > > >double[][] adjencyMatrix; > > >// omitted operations to fill adjencyMatrix > > >SparseMatrix smatrix = new SparseMatrix(adjencyMatrix); >MarkovClustering mcl = new MarkovClustering(); >double maxResidual = 0.001; >double gammaExp = 2.0; >double loopGain = 0.; >double zeroMax = 0.001; >SparseMatrix matrix = mcl.run(smatrix, maxResidual, gammaExp, loopGain, zeroMax); > > >From this point, I understand that "matrix" helds a "sparse matrix with row-major format" of my results, that is, a compressed version of the traditional 2D matrix resulting from MCL. I am able to read the MCL results from a traditional 2D data structure, yet I don't know to grasp how to unveil clusters from the resulting SparseMatrix. > > >I have been unable to find the proper documentation to understand the SparseMatrix data structure used in java-ml. Can you point me to the paper or documentation that you may have used to create the data structure ? If no, is it possible to convert a SparseMatrix into a double[][] (which I suspect to be performance killing) ? > > >Thanks you in advance for any help ! > > >Best Regards, > > >Chris > > >------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > >_______________________________________________ Java-ml-support mailing list Jav...@li... https://lists.sourceforge.net/lists/listinfo/java-ml-support |