diff options
author | Andrej Shadura <andrewsh@debian.org> | 2019-03-09 22:30:32 +0000 |
---|---|---|
committer | Andrej Shadura <andrewsh@debian.org> | 2019-03-09 22:30:32 +0000 |
commit | c36aa2a8fd31ca5e225ff30278e910070cd2c8c1 (patch) | |
tree | bdfe1a5ccb57999d4d664a2a44121a78c88b19d4 /src/de/lmu/ifi/dbs/elki/algorithm/outlier/spatial/CTLuScatterplotOutlier.java | |
parent | 89aa1958dbaf9052da0c24706308a2ef8cefa96e (diff) |
Import Upstream version 0.5.0~beta2
Diffstat (limited to 'src/de/lmu/ifi/dbs/elki/algorithm/outlier/spatial/CTLuScatterplotOutlier.java')
-rw-r--r-- | src/de/lmu/ifi/dbs/elki/algorithm/outlier/spatial/CTLuScatterplotOutlier.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/de/lmu/ifi/dbs/elki/algorithm/outlier/spatial/CTLuScatterplotOutlier.java b/src/de/lmu/ifi/dbs/elki/algorithm/outlier/spatial/CTLuScatterplotOutlier.java index d18e4130..8e4ab32c 100644 --- a/src/de/lmu/ifi/dbs/elki/algorithm/outlier/spatial/CTLuScatterplotOutlier.java +++ b/src/de/lmu/ifi/dbs/elki/algorithm/outlier/spatial/CTLuScatterplotOutlier.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.algorithm.outlier.spatial; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2011 + Copyright (C) 2012 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team @@ -30,7 +30,7 @@ import de.lmu.ifi.dbs.elki.data.type.TypeUtil; import de.lmu.ifi.dbs.elki.data.type.VectorFieldTypeInformation; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreFactory; import de.lmu.ifi.dbs.elki.database.datastore.DataStoreUtil; -import de.lmu.ifi.dbs.elki.database.datastore.WritableDataStore; +import de.lmu.ifi.dbs.elki.database.datastore.WritableDoubleDataStore; import de.lmu.ifi.dbs.elki.database.ids.DBID; import de.lmu.ifi.dbs.elki.database.ids.DBIDs; import de.lmu.ifi.dbs.elki.database.relation.MaterializedRelation; @@ -97,7 +97,7 @@ public class CTLuScatterplotOutlier<N> extends AbstractNeighborhoodOutlier<N> { */ public OutlierResult run(Relation<N> nrel, Relation<? extends NumberVector<?, ?>> relation) { final NeighborSetPredicate npred = getNeighborSetPredicateFactory().instantiate(nrel); - WritableDataStore<Double> means = DataStoreUtil.makeStorage(relation.getDBIDs(), DataStoreFactory.HINT_TEMP, Double.class); + WritableDoubleDataStore means = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_TEMP); // Calculate average of neighborhood for each object and perform a linear // regression using the covariance matrix @@ -122,7 +122,7 @@ public class CTLuScatterplotOutlier<N> extends AbstractNeighborhoodOutlier<N> { m = local; } // Store the mean for the score calculation - means.put(id, m); + means.putDouble(id, m); covm.put(new double[] { local, m }); } // Finalize covariance matrix, compute linear regression @@ -137,13 +137,13 @@ public class CTLuScatterplotOutlier<N> extends AbstractNeighborhoodOutlier<N> { } // calculate mean and variance for error - WritableDataStore<Double> scores = DataStoreUtil.makeStorage(relation.getDBIDs(), DataStoreFactory.HINT_STATIC, Double.class); + WritableDoubleDataStore scores = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_STATIC); MeanVariance mv = new MeanVariance(); for(DBID id : relation.iterDBIDs()) { // Compute the error from the linear regression double y_i = relation.get(id).doubleValue(1); - double e = means.get(id) - (slope * y_i + inter); - scores.put(id, e); + double e = means.doubleValue(id) - (slope * y_i + inter); + scores.putDouble(id, e); mv.put(e); } @@ -153,9 +153,9 @@ public class CTLuScatterplotOutlier<N> extends AbstractNeighborhoodOutlier<N> { final double mean = mv.getMean(); final double variance = mv.getNaiveStddev(); for(DBID id : relation.iterDBIDs()) { - double score = Math.abs((scores.get(id) - mean) / variance); + double score = Math.abs((scores.doubleValue(id) - mean) / variance); minmax.put(score); - scores.put(id, score); + scores.putDouble(id, score); } } // build representation |