Package cc.mallet.util

Examples of cc.mallet.util.Randoms.nextInt()


        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


        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

        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

        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

      TIntHashSet clustersSampled = new TIntHashSet();
      Randoms random = new Randoms(123);
      LabelAlphabet lalph = new LabelAlphabet();
      InstanceList trainingInstances = new InstanceList(new Noop(null, lalph));
      while (trainingInstances.size() < targetTrainSize) {
        int cluster = random.nextInt(clustering.getNumClusters());
        if (!clustersSampled.contains(cluster)) {
          clustersSampled.add(cluster);
          InstanceList instances = clustering.getCluster(cluster);
          for (int i = 0; i < instances.size(); i++) {
            Instance inst = instances.get(i);
View Full Code Here

        new LabelSequence(topicAlphabet, new int[ tokens.size() ]);
     
      int[] topics = topicSequence.getFeatures();
      for (int position = 0; position < topics.length; position++) {

        int topic = random.nextInt(numTopics);
        topics[position] = topic;
       
      }

      TopicAssignment t = new TopicAssignment(instance, topicSequence);
View Full Code Here

        sampleTopicsForOneDoc((FeatureSequence)instance.getData(), topicSequence, false, false);
      else {
        Randoms r = new Randoms();
        int[] topics = topicSequence.getFeatures();
        for (int i = 0; i < topics.length; i++)
          topics[i] = r.nextInt(numTopics);
      }
      topicSequences.add (topicSequence);
    }
    addInstances (training, topicSequences);
  }
View Full Code Here

        new LabelSequence(topicAlphabet, new int[ tokens.size() ]);
     
      int[] topics = topicSequence.getFeatures();
      for (int position = 0; position < topics.length; position++) {

        int topic = random.nextInt(numTopics);
        topics[position] = topic;
       
      }

      TopicAssignment t = new TopicAssignment (instance, topicSequence);
View Full Code Here

        new LabelSequence(topicAlphabet, new int[ tokens.size() ]);
     
      int[] topics = topicSequence.getFeatures();
      for (int position = 0; position < topics.length; position++) {

        int topic = random.nextInt(numTopics);
        topics[position] = topic;
       
      }

      TopicAssignment t = new TopicAssignment (instance, topicSequence);
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.