Example #1
0
  // Computes probabilities for candidates
  static void computeProbabilities(List<Candidate> candidates, int clusters) {
    // Compute max score to prevent overflow
    double max = Double.NEGATIVE_INFINITY;
    for (Candidate candidate : candidates)
      for (int j = 0; j < clusters; j++) max = Math.max(max, candidate.clusterScores[j]);

    // Exponentiate and compute sum
    double sum = 0;
    for (Candidate candidate : candidates)
      for (int j = 0; j < clusters; j++) {
        double clusterProb = Math.exp(candidate.clusterScores[j] - max);
        sum += clusterProb;
        candidate.clusterProbs[j] = clusterProb;
      }

    // Normalize and compute candidate probabilities
    for (Candidate candidate : candidates) {
      double prob = 0;
      for (int j = 0; j < clusters; j++) {
        double clusterProb = candidate.clusterProbs[j] / sum;
        prob += clusterProb;
        candidate.clusterProbs[j] = clusterProb;
      }
      candidate.prob = prob;
    }
  }
  @Override
  public boolean hasNext() {
    boolean matchFound = false;
    while (ec.hasMoreElements()) {
      Candidate tempObj = (Candidate) ec.nextElement();
      if (tempObj.getCertificationType().equals(certifiedcationType)) {
        matchFound = true;
        nextCandidate = tempObj;
        break;
      }
      if (matchFound == true) {

      } else {
        nextCandidate = null;
      }
    }

    return matchFound;
  }
Example #3
0
 /** Returns a list of software skills for the specified candidate */
 public static List getAllSoftwareSkillsFor(Candidate candidate) {
   List result = new ArrayList();
   try {
     SoftwareCandidateQuery query = new SoftwareCandidateQuery();
     query.setQueryCandidate(candidate.getDO());
     SoftwareCandidateDO element = query.getNextDO();
     while (element != null) {
       result.add(new SoftwareSkill(element));
       element = query.getNextDO();
     }
   } catch (Exception qe) {
     System.err.println(qe);
   }
   return result;
 }
 public static void adminReport() {
   /**
    * A logged in User should not be able to access this page inadvertently by knowing the URL. In
    * Administrator Controller, when an admin signs in, I wrote a key of "logged_in_adminid" to the
    * session. Check here to be safe
    */
   if (session.contains("logged_in_adminid") == false) {
     Administrator.login();
   } else {
     /** get lists of all Users and Candidates in the system and pass to html to create tables */
     List<User> users = User.findAll();
     List<Candidate> candidates = Candidate.findAll();
     render(users, candidates);
   }
 }
Example #5
0
 public void evaluate(Candidate candidate) {
   candidate.include(true);
 }