Package org.apache.mahout.clustering

Examples of org.apache.mahout.clustering.WeightedVectorWritable


    private void loadPoints() throws IOException {
        SequenceFile.Reader currReader = null;
        IntWritable k = new IntWritable();
        CoCluster currCluster;
        int currVID;
        WeightedVectorWritable wvw = new WeightedVectorWritable();
        try {
            fs = FileSystem.get(clusteredPointsPath.toUri(), conf);
            for (FileStatus status : fs.listStatus(clusteredPointsPath)) {
                Path p = status.getPath();
                if (!status.isDir() && !p.getName().startsWith("_")) {
                    try {
                        currReader = new SequenceFile.Reader(fs, p, conf);
                        while (currReader.next(k, wvw)) {
                            currCluster = coclusters.get(k.get());
                            NamedVector v = (NamedVector) wvw.getVector();
                            currVID = Integer.parseInt(v.getName());
                            if (docIDMap.containsKey(currVID)) {
                                currCluster.put(v, docIDMap.get(currVID), true);
                            } else if (featureIDMap.containsKey(currVID)) {
                                currCluster.put(v, featureIDMap.get(currVID), false);
View Full Code Here


            }
            Tuple currRow = tupleFactory.newTuple(3);
            DataBag rowInfoBag = bagFactory.newDefaultBag();
            IntWritable key = (IntWritable) reader.getCurrentKey();
            int clusterID = key.get();
            WeightedVectorWritable value = (WeightedVectorWritable) reader.getCurrentValue();
            Vector rowInfo = value.getVector();
            NamedVector nrowInfo = (NamedVector) rowInfo;
            int vectorID = Integer.parseInt(nrowInfo.getName());
            for (Iterator<Vector.Element> itr = rowInfo.iterateNonZero(); itr.hasNext();) {
                Vector.Element elemInfo = itr.next();
                Tuple currElement = tupleFactory.newTuple(2);
View Full Code Here

TOP

Related Classes of org.apache.mahout.clustering.WeightedVectorWritable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.