Class ClusterFinder
java.lang.Object
com.astrolabsoftware.FinkBrowser.HBaser.Clusteriser.ClusterFinder
ClusterFinder
identifies HBase rows with
clusters defined by previous clustering algorithm, read from
JSON model files.- Author:
- J.Hrivnac
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.commons.math3.linear.RealMatrix
private double[]
private double[]
private org.apache.commons.math3.linear.RealMatrix
private static double
private double[]
private static org.apache.logging.log4j.Logger
Logging . -
Constructor Summary
ConstructorsConstructorDescriptionClusterFinder
(String scalerFile, String pcaFile, String clustersFile) ClusterFinder
(URL scalerUrl, URL pcaUrl, URL clustersUrl) -
Method Summary
Modifier and TypeMethodDescriptionprivate double[]
applyPCA
(double[] standardizedInput) private int
findClosestCluster
(double[] transformedData) Find the closest cluster from the transformed data.private void
loadClusterCenters
(String filePath) private void
loadClusterCenters
(URL url) private void
loadPCAParams
(String filePath) private void
loadPCAParams
(URL url) private void
loadScalerParams
(String filePath) private void
loadScalerParams
(URL url) static void
private static void
setSeparation
(double separation) Set the minimal separation quotient.private double[]
standardize
(double[] input) int
transformAndPredict
(double[] inputData) Transform provided data array and find the closest cluster.
-
Field Details
-
_separation
-
_mean
-
_std
-
_pcaComponents
-
_explainedVariance
-
_clusterCenters
-
log
Logging .
-
-
Constructor Details
-
ClusterFinder
- Throws:
IOException
-
ClusterFinder
- Throws:
IOException
-
-
Method Details
-
main
- Throws:
IOException
-
loadScalerParams
- Throws:
IOException
-
loadPCAParams
- Throws:
IOException
-
loadClusterCenters
- Throws:
IOException
-
loadScalerParams
- Throws:
IOException
-
loadPCAParams
- Throws:
IOException
-
loadClusterCenters
- Throws:
IOException
-
standardize
-
applyPCA
-
findClosestCluster
Find the closest cluster from the transformed data.- Parameters:
transformedData
- The transformed input data.- Returns:
- The (number of) the closest cluster. -1 if it cannot be found with sufficient resolution.
-
transformAndPredict
Transform provided data array and find the closest cluster.- Parameters:
inputData
- The original input data.- Returns:
- The (number of) the closest cluster. -1 if it cannot be found with sufficient resolution.
-
setSeparation
Set the minimal separation quotient.- Parameters:
separation
- The minimal separation quotient. The ration between distance to closest and second closest cluster should be smaller than separation, otherwise cluster is not considered reliable. 1 gives no restriction. The default is 0.5.
-