Examples of Randoms


Examples of cc.mallet.util.Randoms

  public void testLogSample ()
  {
    Variable v = new Variable (2);
    double[] vals = new double[] { -30, 0 };
    LogTableFactor ptl = LogTableFactor.makeFromLogValues (v, vals);
    int idx = ptl.sampleLocation (new Randoms (43));
    assertEquals (1, idx);
  }
View Full Code Here

Examples of cc.mallet.util.Randoms

  public void testVariableReordering () {

    Variable var0 = new Variable (2);
    Variable var1 = new Variable (3);

    Randoms r = new Randoms (17671);

    double[] probs = new double[] {
      r.nextDouble(),
      r.nextDouble(),
      r.nextDouble(),
      r.nextDouble(),
      r.nextDouble(),
      r.nextDouble()
    };

    TableFactor nothingReordered = new TableFactor(
      new Variable[] { var0, var1 },
      probs
View Full Code Here

Examples of cc.mallet.util.Randoms

    FactorGraph fg = new FactorGraph ();
    fg.multiplyBy (tbl1);
    fg.multiplyBy (tbl2);
    System.out.println (fg.dumpToString ());

    GibbsSampler gs = new GibbsSampler (new Randoms (324123), 10);
    gs.sample (fg, 10)// assert no exception
  }
View Full Code Here

Examples of cc.mallet.util.Randoms

  {
    Variable v = new Variable (2);
    double[] vals = new double[] { -30, 0 };
    LogTableFactor ptl = LogTableFactor.makeFromLogValues (v, vals);

    int idx = ptl.sampleLocation (new Randoms (43));
    assertEquals (1, idx);
  }
View Full Code Here

Examples of cc.mallet.util.Randoms

    ClassifierTrainer trainer = new MaxEntTrainer ();

    Alphabet fd = dictOfSize (3);
    String[] classNames = new String[] {"class0", "class1", "class2"};

    Randoms r = new Randoms (1);
    Iterator<Instance> iter = new RandomTokenSequenceIterator (r,  new Dirichlet(fd, 2.0),
          30, 0, 10, 200, classNames);
    training.addThruPipe (iter);

    InstanceList testing = new InstanceList (training.getPipe ());
View Full Code Here

Examples of cc.mallet.util.Randoms

        "A tool to train and test a Clusterer.");
    CommandOption.process(Clusterings2Clusterer.class, args);

    // TRAIN

    Randoms random = new Randoms(123);
    Clusterer clusterer = null;
    if (!loadClusterer.value.exists()) {
      Clusterings training = readClusterings(trainingFile.value);

      Alphabet fieldAlphabet = ((Record) training.get(0).getInstances()
View Full Code Here

Examples of cc.mallet.util.Randoms

      typeTopicCounts[type] = new int[ Math.min(numTopics, typeTotals[type]) ];
    }
   
    doc = 0;

    Randoms random = null;
    if (randomSeed == -1) {
      random = new Randoms();
    }
    else {
      random = new Randoms(randomSeed);
    }

    for (Instance instance : training) {
      doc++;

      FeatureSequence tokens = (FeatureSequence) instance.getData();
      LabelSequence topicSequence =
        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

Examples of cc.mallet.util.Randoms

        // some docs may be missing at the end due to integer division
        if (thread == numThreads - 1) {
          docsPerThread = data.size() - offset;
        }
       
        Randoms random = null;
        if (randomSeed == -1) {
          random = new Randoms();
        }
        else {
          random = new Randoms(randomSeed);
        }

        runnables[thread] = new WorkerRunnable(numTopics,
                             alpha, alphaSum, beta,
                             random, data,
                             runnableCounts, runnableTotals,
                             offset, docsPerThread);
       
        runnables[thread].initializeAlphaStatistics(docLengthCounts.length);
       
        offset += docsPerThread;
     
      }
    }
    else {
     
      // If there is only one thread, copy the typeTopicCounts
      //  arrays directly, rather than allocating new memory.

      Randoms random = null;
      if (randomSeed == -1) {
        random = new Randoms();
      }
      else {
        random = new Randoms(randomSeed);
      }

      runnables[0] = new WorkerRunnable(numTopics,
                        alpha, alphaSum, beta,
                        random, data,
View Full Code Here

Examples of org.b3log.solo.util.Randoms

     * @throws RepositoryException the RepositoryException
     */
    private void sendResetUrl(final String userEmail, final JSONObject jsonObject) throws JSONException,
            ServiceException, IOException, RepositoryException {
        final JSONObject preference = preferenceQueryService.getPreference();
        final String token = new Randoms().nextStringWithMD5();
        final String adminEmail = preference.getString(Preference.ADMIN_EMAIL);
        final String mailSubject = langPropsService.get("resetPwdMailSubject");
        final String mailBody = langPropsService.get("resetPwdMailBody") + " " + Latkes.getServePath() + "/forgot?token=" + token
            + "&login=" + userEmail;
        final MailService.Message message = new MailService.Message();
View Full Code Here

Examples of performance.BFHashUniformity.Randoms

    // Values per Hash functions
    int k = 10;
    // Successive runs
    int rounds = 20;
        //Random Values
        Randoms mode = Randoms.INTS;

    speedTests(hashesPerRound, rounds,  m, k, mode);
  }
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.