dkpro / dkpro-statistics

DKPro Statistics
https://dkpro.github.io/dkpro-statistics
Apache License 2.0
12 stars 4 forks source link

MASI (and probably other set-valued) distance functions cause ClassCastException on category-wise agreement #10

Open chmeyer opened 9 years ago

chmeyer commented 9 years ago

Originally reported on Google Code with ID 10

What steps will reproduce the problem?
1. create a multi-label study: study.addItem(new SetAnnotation(voter1), new SetAnnotation(voter2));
2. calculate category-wise agreement on e.g. Alpha with MASI distance function: new
KrippendorffAlphaAgreement(study, new MASISet...).calculateCategoryAgreement(new SetAnnotation(CATEGORY));

What is the expected output? What do you see instead?
Exception in thread "main" java.lang.ClassCastException: java.lang.Object cannot be
cast to de.tudarmstadt.ukp.dkpro.statistics.agreement.distance.SetAnnotation
    at de.tudarmstadt.ukp.dkpro.statistics.agreement.distance.MASISetAnnotationDistanceFunction.measureDistance(MASISetAnnotationDistanceFunction.java:46)
    at de.tudarmstadt.ukp.dkpro.statistics.agreement.coding.KrippendorffAlphaAgreement.calculateCategoryAgreement(KrippendorffAlphaAgreement.java:166)
...

What version of the product are you using? On what operating system?
Both in 2.0.0 and latest SNAPSHOT.

This happens because measureDistance() in MASISetAnnotationDistanceFunction tries to
cast an Object (NULL_CATEGORY) to SetAnnotation.
The problem is gone, when passing an empty SetAnnotation instead of Object.

Reported by daxenberger.j on 2014-10-15 14:11:12