当前位置: 首页>>代码示例>>Java>>正文


Java ResultUtil.filterResults方法代码示例

本文整理汇总了Java中de.lmu.ifi.dbs.elki.result.ResultUtil.filterResults方法的典型用法代码示例。如果您正苦于以下问题:Java ResultUtil.filterResults方法的具体用法?Java ResultUtil.filterResults怎么用?Java ResultUtil.filterResults使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在de.lmu.ifi.dbs.elki.result.ResultUtil的用法示例。


在下文中一共展示了ResultUtil.filterResults方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newContext

import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
/**
 * Make a new visualization context
 *
 * @param hier Result hierarchy
 * @param start Starting result
 * @return New context
 */
public VisualizerContext newContext(ResultHierarchy hier, Result start) {
  Collection<Relation<?>> rels = ResultUtil.filterResults(hier, Relation.class);
  for(Relation<?> rel : rels) {
    if(samplesize == 0) {
      continue;
    }
    if(!ResultUtil.filterResults(hier, rel, SamplingResult.class).isEmpty()) {
      continue;
    }
    if(rel.size() > samplesize) {
      SamplingResult sample = new SamplingResult(rel);
      sample.setSample(DBIDUtil.randomSample(sample.getSample(), samplesize, rnd));
      ResultUtil.addChildResult(rel, sample);
    }
  }
  return new VisualizerContext(hier, start, stylelib, factories);
}
 
开发者ID:elki-project,项目名称:elki,代码行数:25,代码来源:VisualizerParameterizer.java

示例2: processNewResult

import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
@Override
public void processNewResult(ResultHierarchy hier, Result newResult) {
  Database db = ResultUtil.findDatabase(hier);
  Collection<String> header = null;
  final ArrayList<IndexTree<?, ?>> indexes = ResultUtil.filterResults(hier, newResult, IndexTree.class);
  if (indexes == null || indexes.isEmpty()) {
    return;
  }
  for(IndexTree<?, ?> index : indexes) {
    header = new ArrayList<>();
    header.add(index.toString());
  }
  Collection<Pair<String, String>> col = new ArrayList<>();
  IndexMetaResult analysis = new IndexMetaResult(col, header);
  db.getHierarchy().add(db, analysis);
}
 
开发者ID:elki-project,项目名称:elki,代码行数:17,代码来源:IndexStatistics.java

示例3: processNewResult

import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
@Override
public void processNewResult(ResultHierarchy hier, Result result) {
  Database db = ResultUtil.findDatabase(hier);
  List<OutlierResult> ors = ResultUtil.filterResults(hier, OutlierResult.class);
  if (ors == null || ors.isEmpty()) {
    // logger.warning("No results found for "+JudgeOutlierScores.class.getSimpleName());
    return;
  }

  ModifiableDBIDs ids = DBIDUtil.newHashSet(ors.iterator().next().getScores().getDBIDs());
  DBIDs outlierIds = DatabaseUtil.getObjectsByLabelMatch(db, positiveClassName);
  ids.removeDBIDs(outlierIds);

  for (OutlierResult or : ors) {
    db.getHierarchy().add(or, computeScore(ids, outlierIds, or));
  }
}
 
开发者ID:elki-project,项目名称:elki,代码行数:18,代码来源:JudgeOutlierScores.java

示例4: testAUC

import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
/**
 * Test the AUC value for an outlier result.
 *
 * @param db Database
 * @param positive Positive class name
 * @param result Outlier result to process
 * @param expected Expected AUC value
 */
protected void testAUC(Database db, String positive, OutlierResult result, double expected) {
  OutlierROCCurve rocCurve = new ELKIBuilder<>(OutlierROCCurve.class)//
      .with(OutlierROCCurve.Parameterizer.POSITIVE_CLASS_NAME_ID, positive).build();

  // Ensure the result has been added to the hierarchy:
  ResultHierarchy hier = db.getHierarchy();
  if(hier.numParents(result) < 1) {
    hier.add(db, result);
  }

  // Compute ROC and AUC:
  rocCurve.processNewResult(hier, result);
  // Find the ROC results
  Collection<OutlierROCCurve.ROCResult> rocs = ResultUtil.filterResults(hier, result, OutlierROCCurve.ROCResult.class);
  assertTrue("No ROC result found.", !rocs.isEmpty());
  double auc = rocs.iterator().next().getAUC();
  assertFalse("More than one ROC result found.", rocs.size() > 1);
  assertEquals("ROC value does not match.", expected, auc, 0.0001);
}
 
开发者ID:elki-project,项目名称:elki,代码行数:28,代码来源:AbstractOutlierAlgorithmTest.java

示例5: processNewResult

import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
@Override
public void processNewResult(ResultHierarchy hier, Result newResult) {
  ArrayList<PointerHierarchyRepresentationResult> hrs = ResultUtil.filterResults(hier, newResult, PointerHierarchyRepresentationResult.class);
  for(PointerHierarchyRepresentationResult pointerresult : hrs) {
    pointerresult.addChildResult(inner.run(pointerresult));
  }
}
 
开发者ID:elki-project,项目名称:elki,代码行数:8,代码来源:CutDendrogramByHeightExtractor.java

示例6: processNewResult

import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
@Override
public void processNewResult(ResultHierarchy hier, Result newResult) {
  ArrayList<PointerHierarchyRepresentationResult> hrs = ResultUtil.filterResults(hier, newResult, PointerHierarchyRepresentationResult.class);
  for(PointerHierarchyRepresentationResult pointerresult : hrs) {
    Clustering<DendrogramModel> result = inner.run(pointerresult);
    pointerresult.addChildResult(result);
  }
}
 
开发者ID:elki-project,项目名称:elki,代码行数:9,代码来源:HDBSCANHierarchyExtractionEvaluator.java

示例7: getClusteringResults

import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
/**
 * Collect all clustering results from a Result
 *
 * @param r Result
 * @return List of clustering results
 */
public static List<Clustering<? extends Model>> getClusteringResults(Result r) {
  if(r instanceof Clustering<?>) {
    List<Clustering<?>> crs = new ArrayList<>(1);
    crs.add((Clustering<?>) r);
    return crs;
  }
  if(r instanceof HierarchicalResult) {
    return ResultUtil.filterResults(((HierarchicalResult) r).getHierarchy(), r, Clustering.class);
  }
  return Collections.emptyList();
}
 
开发者ID:elki-project,项目名称:elki,代码行数:18,代码来源:Clustering.java

示例8: processNewResult

import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
@Override
public void processNewResult(ResultHierarchy hier, Result newResult) {
  // Get all new outlier results
  ArrayList<OutlierResult> ors = ResultUtil.filterResults(hier, newResult, OutlierResult.class);
  for (OutlierResult o : ors) {
    DoubleRelation scores = o.getScores();
    for (DBIDIter iter = scores.iterDBIDs(); iter.valid(); iter.advance()) {
      System.out.println(DBIDUtil.toString(iter) + " " + scores.doubleValue(iter));
    }
  }
}
 
开发者ID:elki-project,项目名称:elki,代码行数:12,代码来源:SimpleScoreDumper.java

示例9: processNewResult

import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
@Override
public void processNewResult(ResultHierarchy hier, Result newResult) {
  List<OutlierResult> ors = ResultUtil.filterResults(hier, newResult, OutlierResult.class);
  for(OutlierResult or : ors) {
    hier.add(or, split(or));
  }
}
 
开发者ID:elki-project,项目名称:elki,代码行数:8,代码来源:OutlierThresholdClustering.java

示例10: autoEvaluateClusterings

import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
protected void autoEvaluateClusterings(ResultHierarchy hier, Result newResult) {
  Collection<Clustering<?>> clusterings = ResultUtil.filterResults(hier, newResult, Clustering.class);
  if(LOG.isDebugging()) {
    LOG.warning("Number of new clustering results: " + clusterings.size());
  }
  for(Iterator<Clustering<?>> c = clusterings.iterator(); c.hasNext();) {
    Clustering<?> test = c.next();
    if("allinone-clustering".equals(test.getShortName())) {
      c.remove();
    }
    else if("allinnoise-clustering".equals(test.getShortName())) {
      c.remove();
    }
    else if("bylabel-clustering".equals(test.getShortName())) {
      c.remove();
    }
    else if("bymodel-clustering".equals(test.getShortName())) {
      c.remove();
    }
  }
  if(!clusterings.isEmpty()) {
    try {
      new EvaluateClustering(new ByLabelClustering(), false, true).processNewResult(hier, newResult);
    }
    catch(NoSupportedDataTypeException e) {
      // Pass - the data probably did not have labels.
    }
  }
}
 
开发者ID:elki-project,项目名称:elki,代码行数:30,代码来源:AutomaticEvaluation.java

示例11: ensureClusteringResult

import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
/**
 * Ensure that the result contains at least one Clustering.
 *
 * @param db Database to process
 * @param result result
 */
public static void ensureClusteringResult(final Database db, final Result result) {
  Collection<Clustering<?>> clusterings = ResultUtil.filterResults(db.getHierarchy(), result, Clustering.class);
  if(clusterings.isEmpty()) {
    ResultUtil.addChildResult(db, new ByLabelOrAllInOneClustering().run(db));
  }
}
 
开发者ID:elki-project,项目名称:elki,代码行数:13,代码来源:AutomaticEvaluation.java

示例12: processNewResult

import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
@Override
public void processNewResult(ResultHierarchy hier, Result newResult) {
  final Database db = ResultUtil.findDatabase(hier);
  List<OutlierResult> ors = ResultUtil.filterResults(hier, newResult, OutlierResult.class);
  if(ors == null || ors.isEmpty()) {
    // logger.warning("No outlier results found for
    // "+ComputeOutlierHistogram.class.getSimpleName());
    return;
  }

  for(OutlierResult or : ors) {
    db.getHierarchy().add(or, evaluateOutlierResult(db, or));
  }
}
 
开发者ID:elki-project,项目名称:elki,代码行数:15,代码来源:ComputeOutlierHistogram.java

示例13: getOutlierResult

import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
/**
 * Find an OutlierResult to work with.
 * 
 * @param hier Result hierarchy
 * @param result Result object
 * @return Iterator to work with
 */
private OutlierResult getOutlierResult(ResultHierarchy hier, Result result) {
  List<OutlierResult> ors = ResultUtil.filterResults(hier, result, OutlierResult.class);
  if(!ors.isEmpty()) {
    return ors.get(0);
  }
  throw new IllegalStateException("Comparison algorithm expected at least one outlier result.");
}
 
开发者ID:elki-project,项目名称:elki,代码行数:15,代码来源:RescaleMetaOutlierAlgorithm.java

示例14: executeForCorrectness

import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
public double executeForCorrectness(
									String inDens,
									ArrayList<ArrayList<Double>> normalized, 
									ArrayList<String> labels, 
									ArrayList<String> minpts, 
									double eps
									)
throws IOException 
{	
	ClusteringTools tools=new ClusteringTools();

	//build the database from the normalized matrix
	//the column of timestamp values is not present in the variable "normalized"
	Database db=tools.buildDatabaseFromMatrix(normalized);

	//fill in the feature hashmap only with single features
	HashMap<Integer, String> featuresMap=tools.getFeaturesMap(labels);

	//fill in the deltad hashmap
	HashMap<String, Double> deltadMap=tools.getDeltadMap(labels, minpts);

	//% of cells
	Double density=normalized.size()*0.9;

	CSVDataIO dataIO=new CSVDataIO();
	List<CSVRecord> listDens=dataIO.readCSVFile(inDens);
	ArrayList<Pair<Double, Double>> boundaries = tools.getFeatureBoundariesFromCSV(listDens);
	
	//Run GEOSUBCLU algorithm and get the clustering result
	Clustering<?> result = tools.runGEOSUBCLU(db, boundaries, featuresMap, deltadMap, density.intValue(), eps, new StringBuilder());
	ArrayList<Clustering<?>> cs = ResultUtil.filterResults(result, Clustering.class);

	//Get the SSE
	double sse=tools.getClusteringSSE(db, cs, featuresMap);

	return sse;
}
 
开发者ID:giusepperizzo,项目名称:geosummly,代码行数:38,代码来源:ClusteringOperator.java

示例15: autoEvaluateOutliers

import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
protected void autoEvaluateOutliers(ResultHierarchy hier, Result newResult) {
  Collection<OutlierResult> outliers = ResultUtil.filterResults(hier, newResult, OutlierResult.class);
  if(LOG.isDebugging()) {
    LOG.debug("Number of new outlier results: " + outliers.size());
  }
  if(!outliers.isEmpty()) {
    Database db = ResultUtil.findDatabase(hier);
    ensureClusteringResult(db, db);
    Collection<Clustering<?>> clusterings = ResultUtil.filterResults(hier, db, Clustering.class);
    if(clusterings.isEmpty()) {
      LOG.warning("Could not find a clustering result, even after running 'ensureClusteringResult'?!?");
      return;
    }
    Clustering<?> basec = clusterings.iterator().next();
    // Find minority class label
    int min = Integer.MAX_VALUE;
    int total = 0;
    String label = null;
    if(basec.getAllClusters().size() > 1) {
      for(Cluster<?> c : basec.getAllClusters()) {
        final int csize = c.getIDs().size();
        total += csize;
        if(csize < min) {
          min = csize;
          label = c.getName();
        }
      }
    }
    if(label == null) {
      LOG.warning("Could not evaluate outlier results, as I could not find a minority label.");
      return;
    }
    if(min == 1) {
      LOG.warning("The minority class label had a single object. Try using 'ClassLabelFilter' to identify the class label column.");
    }
    if(min > 0.05 * total) {
      LOG.warning("The minority class I discovered (labeled '" + label + "') has " + (min * 100. / total) + "% of objects. Outlier classes should be more rare!");
    }
    LOG.verbose("Evaluating using minority class: " + label);
    Pattern pat = Pattern.compile("^" + Pattern.quote(label) + "$");
    // Evaluate rankings.
    new OutlierRankingEvaluation(pat).processNewResult(hier, newResult);
    // Compute ROC curve
    new OutlierROCCurve(pat).processNewResult(hier, newResult);
    // Compute Precision at k
    new OutlierPrecisionAtKCurve(pat, min << 1).processNewResult(hier, newResult);
    // Compute ROC curve
    new OutlierPrecisionRecallCurve(pat).processNewResult(hier, newResult);
    // Compute outlier histogram
    new ComputeOutlierHistogram(pat, 50, new LinearScaling(), false).processNewResult(hier, newResult);
  }
}
 
开发者ID:elki-project,项目名称:elki,代码行数:53,代码来源:AutomaticEvaluation.java


注:本文中的de.lmu.ifi.dbs.elki.result.ResultUtil.filterResults方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。