List of usage examples for org.apache.mahout.clustering UncommonDistributions rNorm
public static double rNorm(double mean, double sd)
From source file:DisplayClustering.java
License:Apache License
/** * Generate random samples and add them to the sampleData * * @param num/*from w w w.ja v a 2 s. c om*/ * int number of samples to generate * @param mx * double x-value of the sample mean * @param my * double y-value of the sample mean * @param sd * double standard deviation of the samples */ protected static void generateSamples(int num, double mx, double my, double sd) { double[] params = { mx, my, sd, sd }; SAMPLE_PARAMS.add(new DenseVector(params)); log.info("Generating {} samples m=[{}, {}] sd={}", num, mx, my, sd); for (int i = 0; i < num; i++) { SAMPLE_DATA.add(new VectorWritable(new DenseVector( new double[] { UncommonDistributions.rNorm(mx, sd), UncommonDistributions.rNorm(my, sd) }))); } }
From source file:DisplayClustering.java
License:Apache License
/** * Generate random samples and add them to the sampleData * * @param num// www .j a v a 2 s. c o m * int number of samples to generate * @param mx * double x-value of the sample mean * @param my * double y-value of the sample mean * @param sdx * double x-value standard deviation of the samples * @param sdy * double y-value standard deviation of the samples */ protected static void generate2dSamples(int num, double mx, double my, double sdx, double sdy) { double[] params = { mx, my, sdx, sdy }; SAMPLE_PARAMS.add(new DenseVector(params)); log.info("Generating {} samples m=[{}, {}] sd=[{}, {}]", num, mx, my, sdx, sdy); for (int i = 0; i < num; i++) { SAMPLE_DATA.add(new VectorWritable(new DenseVector( new double[] { UncommonDistributions.rNorm(mx, sdx), UncommonDistributions.rNorm(my, sdy) }))); } }