neulab / ExplainaBoard

Interpretable Evaluation for AI Systems
MIT License
360 stars 36 forks source link

Make Result/AnalysisResult Serializable. #571

Closed odashi closed 1 year ago

odashi commented 1 year ago

Overview

This change introduces Serializable interface to Result and AnalysisResult with a reorganizing the internal structure.

Details

AnalysisResult is originally an extensible dataclass. This design is problematic because all subclasses have to implement serialization of base members.

This change introduces AnalysisDetails abstract marker class, which is inherited by specific classes representing details of analyses. AnalysisResult holds details: AnalysisDetails member to represent its extension. This design allows to write serialization of each member only once.

(Also this design avoids some potential bugs around initializers of extensible dataclasses: if the base class changes the number of members, the arrangement of positional arguments of the subclass initializer also affects, causing potential failures).

other changes:

References

Blocked by

odashi commented 1 year ago

I noticed that there is no tests for the change. fixing it--

odashi commented 1 year ago

Merging main, since #570 added a useful CI to figure out this error.