Package org.apache.mahout.clustering

Examples of org.apache.mahout.clustering.JsonModelDistributionAdapter


  public static DirichletState getDirichletState(Configuration conf) {
    String statePath = conf.get(DirichletDriver.STATE_IN_KEY);
    String json = conf.get(DirichletDriver.MODEL_DISTRIBUTION_KEY);
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(ModelDistribution.class, new JsonModelDistributionAdapter());
    Gson gson = builder.create();
    ModelDistribution<VectorWritable> modelDistribution = gson.fromJson(json,
                                                                        AbstractVectorModelDistribution.MODEL_DISTRIBUTION_TYPE);
    String numClusters = conf.get(DirichletDriver.NUM_CLUSTERS_KEY);
    String alpha0 = conf.get(DirichletDriver.ALPHA_0_KEY);
View Full Code Here


  }

  @Override
  public String asJsonString() {
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(ModelDistribution.class, new JsonModelDistributionAdapter());
    builder.registerTypeAdapter(DistanceMeasure.class, new JsonDistanceMeasureAdapter());
    Gson gson = builder.create();
    return gson.toJson(this, MODEL_DISTRIBUTION_TYPE);
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.clustering.JsonModelDistributionAdapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.