<dependencies> <dependency> <groupId>com.github.sd-nyzh</groupId> <artifactId>tjungblut-math</artifactId> <version>0.1.0</version> </dependency> </dependencies> import de.jungblut.math.DoubleVector; import de.jungblut.math.MathUtils; DoubleVector vector1 = new DoubleVector(1.0, 2.0, 3.0); DoubleVector vector2 = new DoubleVector(4.0, 5.0, 6.0); double dotProduct = MathUtils.dot(vector1, vector2); import de.jungblut.math.DoubleMatrix; import de.jungblut.math.MathUtils; DoubleMatrix matrix1 = new DoubleMatrix(new double[][]{{1.0, 2.0}, {3.0, 4.0}}); DoubleMatrix matrix2 = new DoubleMatrix(new double[][]{{5.0, 6.0}, {7.0, 8.0}}); DoubleMatrix productMatrix = MathUtils.multiply(matrix1, matrix2); " + productMatrix); import de.jungblut.clustering.KMeansClustering; import de.jungblut.math.DoubleVector; import de.jungblut.math.MathUtils; List<DoubleVector> dataPoints = new ArrayList<>(); dataPoints.add(new DoubleVector(1.0, 2.0)); dataPoints.add(new DoubleVector(2.0, 1.0)); dataPoints.add(new DoubleVector(5.0, 6.0)); dataPoints.add(new DoubleVector(6.0, 5.0)); int numClusters = 2; int numIterations = 10; KMeansClustering clustering = new KMeansClustering(numClusters, numIterations); List<DoubleVector> centroids = clustering.cluster(dataPoints);


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