Examples of Randoms


Examples of cc.mallet.util.Randoms

  public void testContinousSample () throws IOException
  {
    ModelReader reader = new ModelReader ();
    FactorGraph fg = reader.readModel (new BufferedReader (new StringReader (uniformMdlstr)));
    Randoms r = new Randoms (324143);
    Assignment allAssn = new Assignment ();
    for (int i = 0; i < 10000; i++) {
      Assignment row = fg.sample (r);
      allAssn.addRow (row);
    }
View Full Code Here

Examples of cc.mallet.util.Randoms

  public void testContinousSample2 () throws IOException
  {
    ModelReader reader = new ModelReader ();
    FactorGraph fg = reader.readModel (new BufferedReader (new StringReader (uniformMdlstr2)));
    Randoms r = new Randoms (324143);
    Assignment allAssn = new Assignment ();
    for (int i = 0; i < 10000; i++) {
      Assignment row = fg.sample (r);
      allAssn.addRow (row);
    }
View Full Code Here

Examples of cc.mallet.util.Randoms

  Randoms random;
  double noise;
 
  public FirstOrderClusterExample () {
    this.random = new Randoms(123456789);
    this.noise = 0.01;
  }
View Full Code Here

Examples of cc.mallet.util.Randoms

    return clusterings;
  }
 
  public void testEvaluators ()
  {
    InstanceList instances = new InstanceList(new Randoms(1), 100, 2).subList(0,12);
    System.err.println(instances.size() + " instances");
    Clustering truth = generateTruth(instances);
    System.err.println("truth=" + truth);

    Clustering[] predicted = generatePredicted(instances);
View Full Code Here

Examples of cc.mallet.util.Randoms

    return new Clustering(instances, 3, labels);
  }
   
  public void testEvaluators ()
  {
    Randoms random = new Randoms(1);
    InstanceList instances = new InstanceList(random, 100, 2).subList(0,10);
    System.err.println(instances.size() + " instances");
    Clustering clustering = generateClustering(instances);
    System.err.println("clustering=" + clustering);
View Full Code Here

Examples of cc.mallet.util.Randoms

      LabelSequence topicSequence = new LabelSequence(topicAlphabet, new int[instanceLength(instance)]);
      if (false) {
        // This method not yet obeying its last "false" argument, and must be for this to work
        //sampleTopicsForOneDoc((FeatureSequence)instance.getData(), topicSequence, false, false);
      } else {
        Randoms r = new Randoms();
        FeatureSequence fs = (FeatureSequence) instance.getData();
        int[] topics = topicSequence.getFeatures();
        for (int i = 0; i < topics.length; i++) {
          int type = fs.getIndexAtPosition(i);
          topics[i] = r.nextInt(numTopics);
          typeTopicCounts[type].adjustOrPutValue(topics[i], 1, 1);
            tokensPerTopic[topics[i]]++;
        }
      }
      topicSequences.add (topicSequence);
View Full Code Here

Examples of cc.mallet.util.Randoms

      LabelSequence topicSequence = new LabelSequence(topicAlphabet, new int[instanceLength(instance)]);
      if (false) {
        // This method not yet obeying its last "false" argument, and must be for this to work
        //sampleTopicsForOneDoc((FeatureSequence)instance.getData(), topicSequence, false, false);
      } else {
        Randoms r = new Randoms();
        FeatureSequence fs = (FeatureSequence) instance.getData();
        int[] topics = topicSequence.getFeatures();
        for (int i = 0; i < topics.length; i++) {
          int type = fs.getIndexAtPosition(i);
          topics[i] = r.nextInt(numTopics);
        /*  if(typeTopicCounts[type].size() != 0) {
            topics[i] = r.nextInt(numTopics);
          } else {
            topics[i] = -1;  // for unseen words
          }*/
 
View Full Code Here

Examples of cc.mallet.util.Randoms

      LabelSequence topicSequence = new LabelSequence(topicAlphabet, new int[instanceLength(instance)]);
      if (false) {
        // This method not yet obeying its last "false" argument, and must be for this to work
        //sampleTopicsForOneDoc((FeatureSequence)instance.getData(), topicSequence, false, false);
      } else {
        Randoms r = new Randoms();
        FeatureSequence fs = (FeatureSequence) instance.getData();
        int[] topics = topicSequence.getFeatures();
        for (int i = 0; i < topics.length; i++) {
          int type = fs.getIndexAtPosition(i);
          topics[i] = r.nextInt(numTopics);
          typeTopicCounts[type].adjustOrPutValue(topics[i], 1, 1);
          tokensPerTopic[topics[i]]++;
        /*  if(typeTopicCounts[type].size() != 0) {
            topics[i] = r.nextInt(numTopics);
            typeTopicCounts[type].adjustOrPutValue(topics[i], 1, 1);
View Full Code Here

Examples of cc.mallet.util.Randoms

      LabelSequence topicSequence = new LabelSequence(topicAlphabet, new int[instanceLength(instance)]);
      if (false) {
        // This method not yet obeying its last "false" argument, and must be for this to work
        //sampleTopicsForOneDoc((FeatureSequence)instance.getData(), topicSequence, false, false);
      } else {
        Randoms r = new Randoms();
        FeatureSequence fs = (FeatureSequence) instance.getData();
        int[] topics = topicSequence.getFeatures();
        for (int i = 0; i < topics.length; i++) {
          int type = fs.getIndexAtPosition(i);
          topics[i] = r.nextInt(numTopics);
        }
      }
      topicSequences.add (topicSequence);
    }
View Full Code Here

Examples of cc.mallet.util.Randoms

    public void setTopicDisplayInterval(int interval) {
  this.showTopicsInterval = interval;
    }

    public void setRandomSeed(int seed) {
  random = new Randoms(seed);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.