Examples of DoubleMinMax


Examples of de.lmu.ifi.dbs.elki.math.DoubleMinMax

  }

  @Override
  public void prepare(OutlierResult or) {
    if(min == null) {
      DoubleMinMax mm = new DoubleMinMax();
      for(DBID id : or.getScores().iterDBIDs()) {
        double val = or.getScores().get(id);
        if(!Double.isNaN(val) && !Double.isInfinite(val)) {
          mm.put(val);
        }
      }
      min = mm.getMin();
    }
    if(mean == null) {
      MeanVariance mv = new MeanVariance();
      for(DBID id : or.getScores().iterDBIDs()) {
        double val = or.getScores().get(id);
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.math.DoubleMinMax

  @Override
  public void prepare(OutlierResult or) {
    if(usemean) {
      MeanVariance mv = new MeanVariance();
      DoubleMinMax mm = (max == null) ? new DoubleMinMax() : null;
      boolean skippedzeros = false;
      for(DBID id : or.getScores().iterDBIDs()) {
        double val = or.getScores().get(id);
        if(nozeros && val == 0.0) {
          skippedzeros = true;
          continue;
        }
        if(!Double.isNaN(val) && !Double.isInfinite(val)) {
          mv.put(val);
        }
        if(max == null) {
          mm.put(val);
        }
      }
      if(skippedzeros && mm.getMin() == mm.getMax()) {
        mm.put(0.0);
        mv.put(0.0);
      }
      min = mv.getMean();
      if(max == null) {
        max = mm.getMax();
      }
    }
    else {
      if(min == null || max == null) {
        boolean skippedzeros = false;
        DoubleMinMax mm = new DoubleMinMax();
        for(DBID id : or.getScores().iterDBIDs()) {
          double val = or.getScores().get(id);
          if(nozeros && val == 0.0) {
            skippedzeros = true;
            continue;
          }
          mm.put(val);
        }
        if(skippedzeros && mm.getMin() == mm.getMax()) {
          mm.put(0.0);
        }
        if(min == null) {
          min = mm.getMin();
        }
        if(max == null) {
          max = mm.getMax();
        }
      }
    }
    factor = (max - min);
  }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.math.DoubleMinMax

  double scaledmax;

  @Override
  public void prepare(OutlierResult or) {
    MeanVariance mv = new MeanVariance();
    DoubleMinMax minmax = new DoubleMinMax();

    for(DBID id : or.getScores().iterDBIDs()) {
      double val = or.getScores().get(id);
      if(!Double.isNaN(val) && !Double.isInfinite(val)) {
        mv.put(val);
        minmax.put(val);
      }
    }

    mean = mv.getMean();
    stddev = mv.getSampleStddev();
    scaledmax = getScaled(minmax.getMax());
    scaledmin = getScaled(minmax.getMin());
  }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.math.DoubleMinMax

    return 1.0;
  }

  @Override
  public void prepare(OutlierResult or) {
    DoubleMinMax mm = new DoubleMinMax();
    for(DBID id : or.getScores().iterDBIDs()) {
      double val = or.getScores().get(id);
      if(!Double.isNaN(val) && !Double.isInfinite(val)) {
        mm.put(val);
      }
    }
    max = mm.getMax();
    mlogmax = -Math.log(mm.getMin() / max);
  }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.math.DoubleMinMax

  }

  @Override
  public void prepare(OutlierResult or) {
    if(min == null || max == null) {
      DoubleMinMax mm = new DoubleMinMax();
      for(DBID id : or.getScores().iterDBIDs()) {
        double val = or.getScores().get(id);
        if(!Double.isNaN(val) && !Double.isInfinite(val)) {
          mm.put(val);
        }
      }
      if(min == null) {
        min = mm.getMin();
      }
      if(max == null) {
        max = mm.getMax();
      }
    }
    factor = Math.sqrt(max - min);
  }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.math.DoubleMinMax

  @Override
  public void prepare(OutlierResult or) {
    meta = or.getOutlierMeta();
    // Determine Minimum and Maximum.
    DoubleMinMax mm = new DoubleMinMax();
    for(DBID id : or.getScores().iterDBIDs()) {
      double score = or.getScores().get(id);
      if(!Double.isNaN(score) && !Double.isInfinite(score)) {
        mm.put(score);
      }
    }
    max = mm.getMax();
    mlogmax = -Math.log(mm.getMin() / max);
    // with the prescaling, do Gamma Scaling.
    MeanVariance mv = new MeanVariance();
    for(DBID id : or.getScores().iterDBIDs()) {
      double score = or.getScores().get(id);
      score = preScale(score);
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.math.DoubleMinMax

      Vector sim = E.getColumnVector(i);
      similarityVectors.put(id, sim);
    }
    E = null;
    // compute the relevance scores between specified Object and its neighbors
    DoubleMinMax minmax = new DoubleMinMax();
    WritableDataStore<Double> scores = DataStoreUtil.makeStorage(spatial.getDBIDs(), DataStoreFactory.HINT_STATIC, Double.class);
    for(int i = 0; i < ids.size(); i++) {
      DBID id = ids.get(i);
      double gmean = 1.0;
      int cnt = 0;
      for(DBID n : neighbors.get(id)) {
        if(id.equals(n)) {
          continue;
        }
        double sim = MathUtil.cosineSimilarity(similarityVectors.get(id), similarityVectors.get(n));
        gmean *= sim;
        cnt++;
      }
      final double score = Math.pow(gmean, 1.0 / cnt);
      minmax.put(score);
      scores.put(id, score);
    }

    Relation<Double> scoreResult = new MaterializedRelation<Double>("randomwalkec", "RandomWalkEC", TypeUtil.DOUBLE, scores, relation.getDBIDs());
    OutlierScoreMeta scoreMeta = new BasicOutlierScoreMeta(minmax.getMin(), minmax.getMax(), 0.0, Double.POSITIVE_INFINITY, 0.0);
    return new OutlierResult(scoreMeta, scoreResult);
  }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.math.DoubleMinMax

  double scaledmax;

  @Override
  public void prepare(OutlierResult or) {
    MeanVariance mv = new MeanVariance();
    DoubleMinMax minmax = new DoubleMinMax();

    for(DBID id : or.getScores().iterDBIDs()) {
      double val = or.getScores().get(id);
      if(!Double.isNaN(val) && !Double.isInfinite(val)) {
        mv.put(val);
        minmax.put(val);
      }
    }

    mean = mv.getMean();
    stddev = mv.getSampleStddev();
    scaledmax = getScaled(minmax.getMax());
    scaledmin = getScaled(minmax.getMin());
  }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.math.DoubleMinMax

    return 1.0;
  }

  @Override
  public void prepare(OutlierResult or) {
    DoubleMinMax mm = new DoubleMinMax();
    for(DBID id : or.getScores().iterDBIDs()) {
      double val = or.getScores().get(id);
      if(!Double.isNaN(val) && !Double.isInfinite(val)) {
        mm.put(val);
      }
    }
    max = mm.getMax();
    mlogmax = -Math.log(mm.getMin() / max);
  }
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.math.DoubleMinMax

    }
    // Finalize covariance matrix:
    Vector mean = covmaker.getMeanVector();
    Matrix cmati = covmaker.destroyToSampleMatrix().inverse();

    DoubleMinMax minmax = new DoubleMinMax();
    WritableDataStore<Double> scores = DataStoreUtil.makeStorage(attributes.getDBIDs(), DataStoreFactory.HINT_STATIC, Double.class);
    for(DBID id : attributes.iterDBIDs()) {
      Vector temp = deltas.get(id).minus(mean);
      final Vector res = temp.transposeTimes(cmati).times(temp);
      assert (res.getDimensionality() == 1);
      double score = res.get(0);
      minmax.put(score);
      scores.put(id, score);
    }

    Relation<Double> scoreResult = new MaterializedRelation<Double>("Median multiple attributes outlier", "median-outlier", TypeUtil.DOUBLE, scores, attributes.getDBIDs());
    OutlierScoreMeta scoreMeta = new BasicOutlierScoreMeta(minmax.getMin(), minmax.getMax(), 0.0, Double.POSITIVE_INFINITY, 0);
    OutlierResult or = new OutlierResult(scoreMeta, scoreResult);
    or.addChildResult(npred);
    return or;
  }
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.