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.RealMatrixprivate double[]private double[]private org.apache.commons.math3.linear.RealMatrixprivate static doubleprivate double[]private static org.apache.logging.log4j.LoggerLogging . -
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 intfindClosestCluster(double[] transformedData) Find the closest cluster from the transformed data.private voidloadClusterCenters(String filePath) private voidloadClusterCenters(URL url) private voidloadPCAParams(String filePath) private voidloadPCAParams(URL url) private voidloadScalerParams(String filePath) private voidloadScalerParams(URL url) static voidprivate static voidsetSeparation(double separation) Set the minimal separation quotient.private double[]standardize(double[] input) inttransformAndPredict(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.
-