You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by EDUARDO ANTONIO BUITRAGO ZAPATA <ed...@gmail.com> on 2011/05/09 03:19:36 UTC

How to customize DisplayKMeans

Hello.

I am trying to use the DisplayKMeans class to show the results of
theexamples of clustering<https://cwiki.apache.org/confluence/display/MAHOUT/Clustering+of+synthetic+control+data>.
So how do i customize  or.apache.mahout.clustering.
display.DisplayKMeans to show the results of the examples instead of a
random generated samples.

The readme file says that i have to modify de generateSamples method, so i
did the following:

Path output = new Path("output");
Path inputFolder = new Path(output,new Path("clusters-10"));
Path inputFile = new Path(inputFolder, "part-r-00000");
FileSystem fs = FileSystem.get(inputFolder.toUri(), new Configuration());
org.apache.hadoop.fs.FSDataInputStream di = fs.open(inputFile);
DenseVector dv = new DenseVector();
VectorWritable vw = new VectorWritable();
vw.readFields(di);
SAMPLE_DATA.add(vw);

But it shows me an error

Exception in thread "main" java.lang.IllegalArgumentException: Unknown flags
set: %d [1010011]

Please give me some insights.

Thanks.

Eduardo.

Re: How to customize DisplayKMeans

Posted by Jeff Eastman <jd...@windwardsolutions.com>.
The DisplayKMeans example only works on 2d vectors. The synthetic 
control problem has 60d vectors. You'd need to add more about your 
command line invocation to get help with the exception.

On 5/8/11 6:19 PM, EDUARDO ANTONIO BUITRAGO ZAPATA wrote:
> Hello.
>
> I am trying to use the DisplayKMeans class to show the results of
> theexamples of clustering<https://cwiki.apache.org/confluence/display/MAHOUT/Clustering+of+synthetic+control+data>.
> So how do i customize  or.apache.mahout.clustering.
> display.DisplayKMeans to show the results of the examples instead of a
> random generated samples.
>
> The readme file says that i have to modify de generateSamples method, so i
> did the following:
>
> Path output = new Path("output");
> Path inputFolder = new Path(output,new Path("clusters-10"));
> Path inputFile = new Path(inputFolder, "part-r-00000");
> FileSystem fs = FileSystem.get(inputFolder.toUri(), new Configuration());
> org.apache.hadoop.fs.FSDataInputStream di = fs.open(inputFile);
> DenseVector dv = new DenseVector();
> VectorWritable vw = new VectorWritable();
> vw.readFields(di);
> SAMPLE_DATA.add(vw);
>
> But it shows me an error
>
> Exception in thread "main" java.lang.IllegalArgumentException: Unknown flags
> set: %d [1010011]
>
> Please give me some insights.
>
> Thanks.
>
> Eduardo.
>