On Thu, Aug 18, 2011 at 3:01 PM, Jörn Kottmann <[email protected]> wrote:
> On 8/18/11 5:00 PM, [email protected] wrote: > >> + public synchronized void addListener(**EvaluationSampleListener<T> >> listener) { >> + this.listeners.add(listener); >> + } >> + >> + public synchronized void removeListener(**EvaluationSampleListener<T> >> listener) { >> + this.listeners.remove(**listener); >> + } >> + >> > > Why did you declared these as synchronized? Anyway I think the way it was > before was > actually better. There we just had one listener per evaluator, which could > be set in the > constructor. > We should add more listeners. For example one to get detailed F-measure, another to have detailed output of false positives and false negatives. First I tried passing a list of listeners, but it would require more code. This way we don't need implementers of Evaluator to modify their constructor to pass the listeners. I don't think we need the synchronized. We don't perform evaluation concurrently anyway. > An evaluator is not something which lives long, and you really want to make > sure to > hook up your listeners, before you started with the evaluation, otherwise > you might > miss samples. > > We need to spend a little time to think about how these > correctly/miss-classified notifications > can be done for the cross validator. Maybe we need to extend the interface > a little to make that meaningful. > > > + protected void notifyCorrectlyClassified(T reference, T prediction) { >> + for (EvaluationSampleListener<T> listener : listeners) { >> + listener.correctlyClassified(**reference, prediction); >> + } >> + } >> + >> + protected void notifyMissclassified(T reference, T prediction) { >> + for (EvaluationSampleListener<T> listener : listeners) { >> + listener.missclassified(**reference, prediction); >> + } >> + } >> > > These you declared later as private, we can then just inline that. Makes > the > code easier to read. > OK. I will do it.
