rafguns / linkpred

Easy link prediction tool
Other
140 stars 46 forks source link

Add Scoresheet.from_file() and Scoresheet.to_file() methods #5

Closed rafguns closed 9 years ago

rafguns commented 9 years ago

It should be possible to save Scoresheets to a CSV-like format and easily create them as well. This would also allow us to replace the code in CachePredictionListener.on_prediction_finished with

def on_prediction_finished(self, scoresheet, dataset, predictor):
    self.fname = _timestamped_filename("%s-%s-predictions" % (dataset, predictor))
    scoresheet.to_file(self.fname)

Added bonus: subclasses of Scoresheet could change the serialization; it would no longer be presupposed that scoresheet keys are tuples.

rafguns commented 9 years ago

Closed by PR #6.