import org.apache.mahout.math.NamedVector; import org.apache.mahout.math.Vector; import org.apache.mahout.math.VectorWritable; import org.apache.mahout.math.Matrix; import org.apache.mahout.math.DenseMatrix; import org.apache.mahout.math.Vector.Element; import org.apache.mahout.math.DenseVector; import org.apache.mahout.math.decomposer.SingularValueDecomposition; import java.io.IOException; public class ClusteringExample { public static void main(String[] args) throws IOException { List<Vector> data = readData(); Matrix matrix = toMatrix(data); SingularValueDecomposition svd = new SingularValueDecomposition(matrix); Matrix u = svd.getU(); Matrix v = svd.getV(); Vector cluster = cluster(u, v); } private static List<Vector> readData() throws IOException { } private static Matrix toMatrix(List<Vector> data) { } private static Vector cluster(Matrix u, Matrix v) { } }


上一篇:
下一篇:
切换中文