Package org.apache.ctakes.ytex.kernel.model

Examples of org.apache.ctakes.ytex.kernel.model.FeatureEvaluation


            .getxVals(),
            instanceData.getLabelToClassMap().get(label), params
                .getxLeftover());
    List<FeatureRank> listRawRanks = new ArrayList<FeatureRank>(
        rawJointDistro.size());
    FeatureEvaluation feRaw = saveFeatureEvaluation(rawJointDistro, params,
        label, foldId, yEntropy, "", listRawRanks);
    // propagate across graph and save
    propagateJointDistribution(rawJointDistro, params, label, foldId, cg,
        yMargin);
    // store children of top concepts
View Full Code Here


    return ytexProperties;
  }

  private FeatureEvaluation initFeatureEval(Parameters params, String label,
      int foldId, String type) {
    FeatureEvaluation feval = new FeatureEvaluation();
    feval.setCorpusName(params.getCorpusName());
    feval.setLabel(label);
    feval.setCrossValidationFoldId(foldId);
    feval.setParam2(params.getConceptGraphName());
    feval.setEvaluationType(type);
    feval.setFeatureSetName(params.getConceptSetName());
    return feval;
  }
View Full Code Here

  private FeatureEvaluation saveFeatureEvaluation(
      Map<String, JointDistribution> rawJointDistro, Parameters params,
      String label, int foldId, double yEntropy, String suffix,
      List<FeatureRank> listRawRanks) {
    FeatureEvaluation fe = initFeatureEval(params, label, foldId, params
        .getMeasure().getName() + suffix);
    this.classifierEvaluationDao.saveFeatureEvaluation(
        fe,
        rank(params.getMeasure(), fe, rawJointDistro, yEntropy,
            listRawRanks));
View Full Code Here

        : this.classifierEvaluationDao.getThresholdFeatures(
            params.getCorpusName(), params.getConceptSetName(),
            label, propagatedType, foldId, 0,
            params.getConceptGraphName(),
            params.getParentConceptEvalThreshold());
    FeatureEvaluation fe = this.initFeatureEval(params, label, foldId,
        params.getMeasure().getName()
            + (bAll ? SUFFIX_IMPUTED : SUFFIX_IMPUTED_FILTERED));
    // map of concept id to children and the 'best' statistic
    Map<String, FeatureRank> mapChildConcept = new HashMap<String, FeatureRank>();
    // get all the children of the parent concepts
View Full Code Here

      final String corpusName, final String conceptGraphName,
      final String conceptSetName) {
    ConceptGraph cg = conceptDao.getConceptGraph(conceptGraphName);
    classifierEvaluationDao.deleteFeatureEvaluation(corpusName,
        conceptSetName, null, INFOCONTENT, 0, 0d, conceptGraphName);
    FeatureEvaluation eval = new FeatureEvaluation();
    eval.setCorpusName(corpusName);
    if (conceptSetName != null)
      eval.setFeatureSetName(conceptSetName);
    eval.setEvaluationType(INFOCONTENT);
    eval.setParam2(conceptGraphName);
    // CorpusEvaluation eval = corpusDao.getCorpus(corpusName,
    // conceptGraphName, conceptSetName);
    // if (eval == null) {
    // eval = new CorpusEvaluation();
    // eval.setConceptGraphName(conceptGraphName);
View Full Code Here

  }

  private void storeIntrinsicIC(String conceptGraphName, int maxLeaves,
      Map<String, IntrinsicICInfo> icInfoMap, short depthArray[],
      ConceptGraph cg) {
    FeatureEvaluation fe = new FeatureEvaluation();
    fe.setEvaluationType("intrinsic-infocontent");
    fe.setParam2(conceptGraphName);
    List<FeatureRank> listFeatureRank = new ArrayList<FeatureRank>(
        icInfoMap.size());
    double maxIC = 0d;
    short maxDepth = 0;
    for (IntrinsicICInfo icInfo : icInfoMap.values()) {
      ConcRel cr = icInfo.getConcept();
      short depth = depthArray[cr.getNodeIndex()];
      cr.setDepth(depth);
      if (depth > maxDepth)
        maxDepth = depth;
      double ic = computeIC(icInfo, maxLeaves);
      cr.setIntrinsicInfoContent(ic);
      if (ic > maxIC)
        maxIC = ic;
      if (log.isDebugEnabled())
        log.debug(icInfo.getConcept().getConceptID() + "=" + ic);
      listFeatureRank.add(new FeatureRank(fe, icInfo.getConcept()
          .getConceptID(), ic, depthArray[icInfo.getConcept()
          .getNodeIndex()]));
    }
    cg.setDepthMax(maxDepth);
    cg.setIntrinsicICMax(maxIC);
    if ("true".equalsIgnoreCase(System
        .getProperty("org.apache.ctakes.ytex.ic.debug", "false"))) {
      this.classifierEvaluationDao.deleteFeatureEvaluation(null, null,
          null, fe.getEvaluationType(), null, 0d, conceptGraphName);
      this.classifierEvaluationDao.saveFeatureEvaluation(fe,
          listFeatureRank);
    }
  }
View Full Code Here

      String splitName, Instances inst, String label, Integer run,
      Integer fold) throws Exception {
    AttributeSelection ae = this.getAttributeSelection();
    ae.SelectAttributes(inst);
    double rankedAttributes[][] = ae.rankedAttributes();
    FeatureEvaluation fe = initializeFeatureEvaluation(corpusName,
        featureSetName, splitName, label, run, fold);
    List<FeatureRank> featureRanks = new ArrayList<FeatureRank>(
        rankedAttributes.length);
    for (int i = 0; i < rankedAttributes.length; i++) {
      int index = (int) rankedAttributes[i][0];
      double eval = rankedAttributes[i][1];
      FeatureRank r = new FeatureRank();
      r.setFeatureEval(fe);
      r.setFeatureName(inst.attribute(index).name());
      r.setRank(i + 1);
      r.setEvaluation(eval);
      featureRanks.add(r);
    }
    // delete this feature evaluation if it exists
    classifierEvaluationDao.deleteFeatureEvaluation(corpusName,
        featureSetName, label, fe.getEvaluationType(),
        fe.getCrossValidationFoldId(), fe.getParam1(), fe.getParam2());
    classifierEvaluationDao.saveFeatureEvaluation(fe, featureRanks);
  }
View Full Code Here

  }

  public FeatureEvaluation initializeFeatureEvaluation(String corpusName,
      String featureSetName, String splitName, String label, Integer run,
      Integer fold) {
    FeatureEvaluation fe = new FeatureEvaluation();
    fe.setCorpusName(corpusName);
    fe.setFeatureSetName(featureSetName);
    fe.setEvaluationType(this.getAsEvaluation().getClass().getSimpleName());
    fe.setLabel(label);
    if (run != null && fold != null) {
      CrossValidationFold cvFold = this.classifierEvaluationDao
          .getCrossValidationFold(corpusName, splitName, label, run,
              fold);
      if (cvFold != null)
        fe.setCrossValidationFoldId(cvFold.getCrossValidationFoldId());
      else {
        log.warn("could not obtain cv_fold_id. label=" + label
            + ", run=" + run + ", fold=" + fold);
      }
    }
View Full Code Here

      String featureSetName, String label, String evaluationType,
      Integer foldId, Double param1, String param2) {
    Query q = prepareUniqueFeatureEvalQuery(corpusName, featureSetName,
        label, evaluationType, foldId, param1, param2,
        "getFeatureEvaluationByNK");
    FeatureEvaluation fe = (FeatureEvaluation) q.uniqueResult();
    if (fe != null) {
      // for some reason this isn't working - execute batch updates
      // this.sessionFactory.getCurrentSession().delete(fe);
      q = this.sessionFactory.getCurrentSession().getNamedQuery(
          "deleteFeatureRank");
      q.setInteger("featureEvaluationId", fe.getFeatureEvaluationId());
      q.executeUpdate();
      q = this.sessionFactory.getCurrentSession().getNamedQuery(
          "deleteFeatureEval");
      q.setInteger("featureEvaluationId", fe.getFeatureEvaluationId());
      q.executeUpdate();
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.ctakes.ytex.kernel.model.FeatureEvaluation

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.