Skip to content

Commit

Permalink
import fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
samypr100 committed Sep 21, 2024
1 parent 9e157f0 commit 2c5bc6a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/test/java/com/clust4j/algo/KMeansTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.clust4j.except.NaNException;
import com.clust4j.kernel.GaussianKernel;
import com.clust4j.kernel.Kernel;
import com.clust4j.kernel.KernelTestCases;
import com.clust4j.metrics.pairwise.Distance;
import com.clust4j.metrics.pairwise.DistanceMetric;
import com.clust4j.metrics.pairwise.GeometricallySeparable;
Expand Down Expand Up @@ -502,7 +503,7 @@ static void findBestKernelMetric(DataSet ds, int k) {
// it's not linearly separable, so most won't perform incredibly well...
int count = 0;
KMeans model;
for (Kernel dist : com.clust4j.kernel.KernelTestCases.all_kernels) {
for (Kernel dist : KernelTestCases.all_kernels) {
if (KMeans.UNSUPPORTED_METRICS.contains(dist.getClass()))
continue;

Expand Down
3 changes: 2 additions & 1 deletion src/test/java/com/clust4j/algo/KMedoidsTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.clust4j.data.DataSet;
import com.clust4j.kernel.HyperbolicTangentKernel;
import com.clust4j.kernel.Kernel;
import com.clust4j.kernel.KernelTestCases;
import com.clust4j.kernel.LaplacianKernel;
import com.clust4j.metrics.pairwise.Distance;
import com.clust4j.metrics.pairwise.DistanceMetric;
Expand Down Expand Up @@ -412,7 +413,7 @@ public void findBestKernelMetric() {

// it's not linearly separable, so most won't perform incredibly well...
KMedoids model;
for (Kernel dist : com.clust4j.kernel.KernelTestCases.all_kernels) {
for (Kernel dist : KernelTestCases.all_kernels) {
if (KMedoids.UNSUPPORTED_METRICS.contains(dist.getClass()))
continue;

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/clust4j/algo/ParallelTaskTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void test() {
private static final long serialVersionUID = 1L;

@Override
public Integer reduce(com.clust4j.algo.ParallelChunkingTask.Chunk chunk) {
public Integer reduce(ParallelChunkingTask.Chunk chunk) {
return -1;
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/clust4j/data/TestDataSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@

import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.text.DecimalFormat;

import static org.junit.jupiter.api.Assertions.*;

public class TestDataSet
implements java.io.Serializable {
public class TestDataSet implements Serializable {
/**
* This needs to be serializable for the anonymous class test
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
import javafx.scene.shape.TriangleMesh;
import javafx.stage.Stage;
import org.fxyz3d.geometry.MathUtils;
import org.fxyz3d.geometry.Point3D;
import org.fxyz3d.utils.CameraTransformer;

import java.awt.*;
Expand Down Expand Up @@ -121,12 +122,12 @@ public class SurfaceWarpTest extends Application {
Box boundingBox;
Webcam webCam = null;
Image currentImage;
ArrayList<org.fxyz3d.geometry.Point3D> data;
ArrayList<org.fxyz3d.geometry.Point3D> endPoints;
ArrayList<Point3D> data;
ArrayList<Point3D> endPoints;
public ConcurrentLinkedQueue<HyperspaceSeed> hyperspaceSeeds = new ConcurrentLinkedQueue<>();
public ConcurrentLinkedQueue<Perspective3DNode> pNodes = new ConcurrentLinkedQueue<>();
int TOTAL_COLORS = 1530; //colors used by map function
Function<org.fxyz3d.geometry.Point3D, Number> colorByLabelFunction = p -> p.f; //Color mapping function
Function<Point3D, Number> colorByLabelFunction = p -> p.f; //Color mapping function
public double point3dSize = 5.0; //size of 3d tetrahedra
int currentPskip = 1;

Expand Down Expand Up @@ -579,7 +580,7 @@ public void updateView(boolean forcePNodeUpdate) {
}
}

private ArrayList<org.fxyz3d.geometry.Point3D> getVisiblePoints(Perspective3DNode[] pNodeArray) {
private ArrayList<Point3D> getVisiblePoints(Perspective3DNode[] pNodeArray) {
//Build scatter model
if (null == scatterModel) {
scatterModel = new DirectedScatterDataModel();
Expand All @@ -605,17 +606,17 @@ public void updateScatterLimits(double bufferScale, boolean updateModel) {
}
}

private ArrayList<org.fxyz3d.geometry.Point3D> getFixedEndPoints(Perspective3DNode[] pNodes, float fixedSize) {
org.fxyz3d.geometry.Point3D[] endArray = new org.fxyz3d.geometry.Point3D[pNodes.length];
private ArrayList<Point3D> getFixedEndPoints(Perspective3DNode[] pNodes, float fixedSize) {
Point3D[] endArray = new Point3D[pNodes.length];
//Fix endpoints so they are just zero adds
Arrays.parallelSetAll(endArray, i -> new org.fxyz3d.geometry.Point3D(fixedSize, fixedSize, fixedSize));
Arrays.parallelSetAll(endArray, i -> new Point3D(fixedSize, fixedSize, fixedSize));
return new ArrayList<>(Arrays.asList(endArray));
}

private ArrayList<org.fxyz3d.geometry.Point3D> getEndPoints(Perspective3DNode[] pNodes, float fixedSize) {
ArrayList<org.fxyz3d.geometry.Point3D> ends = new ArrayList<>(pNodes.length);
private ArrayList<Point3D> getEndPoints(Perspective3DNode[] pNodes, float fixedSize) {
ArrayList<Point3D> ends = new ArrayList<>(pNodes.length);
for (int i = 0; i < pNodes.length; i++) {
ends.add(new org.fxyz3d.geometry.Point3D(pNodes[i].xDirCoord * fixedSize,
ends.add(new Point3D(pNodes[i].xDirCoord * fixedSize,
pNodes[i].xDirCoord * fixedSize, pNodes[i].xDirCoord * fixedSize));
}
return ends;
Expand Down Expand Up @@ -836,7 +837,7 @@ private void vectorizeImage(int pskip, Image image) {
}

List<List<Double>> dataGrid = new ArrayList<>();
Function<org.fxyz3d.geometry.Point3D, Number> colorByHeight = p -> p.y; //Color mapping function
Function<Point3D, Number> colorByHeight = p -> p.y; //Color mapping function
Function<Vert3D, Number> vert3DLookup = p -> vertToHeight(p);

private Number vertToHeight(Vert3D p) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import javafx.scene.shape.TriangleMesh;
import javafx.stage.Stage;
import org.fxyz3d.geometry.MathUtils;
import org.fxyz3d.geometry.Point3D;
import org.fxyz3d.utils.CameraTransformer;

import java.awt.*;
Expand Down Expand Up @@ -489,7 +490,7 @@ private void vectorizeImage(Image image) {
}

List<List<Double>> dataGrid = new ArrayList<>();
Function<org.fxyz3d.geometry.Point3D, Number> colorByHeight = p -> p.y; //Color mapping function
Function<Point3D, Number> colorByHeight = p -> p.y; //Color mapping function
Function<Vert3D, Number> vert3DLookup = p -> vertToHeight(p);

private Number vertToHeight(Vert3D p) {
Expand Down

0 comments on commit 2c5bc6a

Please sign in to comment.