elki-project / elki

ELKI Data Mining Toolkit
https://elki-project.github.io/
GNU Affero General Public License v3.0
780 stars 321 forks source link

Bugfix: fixed incorrrect typing in outlier histogram computation #18

Closed patrickkostjens closed 8 years ago

patrickkostjens commented 8 years ago

When using the automatic visualisation for LOF and other outlier algorithms, the following exception would be thrown:

java.lang.ClassCastException: [D cannot be cast to de.lmu.ifi.dbs.elki.data.NumberVector
    at de.lmu.ifi.dbs.elki.visualization.visualizers.visunproj.HistogramVisualization.makeVisualization(HistogramVisualization.java:96)
    at de.lmu.ifi.dbs.elki.visualization.gui.overview.OverviewPlot.embedOrThumbnail(OverviewPlot.java:420)
    at de.lmu.ifi.dbs.elki.visualization.gui.overview.OverviewPlot.reinitialize(OverviewPlot.java:322)
    at de.lmu.ifi.dbs.elki.visualization.gui.overview.OverviewPlot.initialize(OverviewPlot.java:256)
    at de.lmu.ifi.dbs.elki.visualization.gui.ResultWindow.<init>(ResultWindow.java:504)
    at de.lmu.ifi.dbs.elki.result.AutomaticVisualization.processNewResult(AutomaticVisualization.java:112)
    at de.lmu.ifi.dbs.elki.workflow.OutputStep.runResultHandlers(OutputStep.java:73)
    at de.lmu.ifi.dbs.elki.KDDTask.run(KDDTask.java:121)
    at de.lmu.ifi.dbs.elki.application.KDDCLIApplication.run(KDDCLIApplication.java:61)
    at [...]

I tracked the problem to the creation of the histogram result which is expected to contain NumberVectors, but instead contained arrays of doubles. With this change, the visualisation works as expected.

codecov-io commented 8 years ago

Current coverage is 33.05%

Merging #18 into master will not affect coverage as of 3d94f68

@@            master     #18   diff @@
======================================
  Files         1332    1332       
  Stmts        66138   66138       
  Branches     14253   14253       
  Methods          0       0       
======================================
+ Hit          21860   21861     +1
+ Partial       2536    2535     -1
  Missed       41742   41742       

Review entire Coverage Diff as of 3d94f68

Powered by Codecov. Updated on successful CI builds.

kno10 commented 8 years ago

The histogram classes should use double[]; the visualizer should be changed to handle this instead. Using the type DoubleVector in the histogram does not make sense - it is not really a vector space.

patrickkostjens commented 8 years ago

That indeed makes more sense. I'll close this one. See my improved solution in pull request #19.