Closed gijshendriksen closed 4 months ago
Thank you very much for the PR! Could you add some short documentation and type hinting to TiraApplyFeatureTransformer
? I don't find it immediately obvious what it does or why it is equivalent to the code it replaces.
Hi @TheMrSheldon, thank you for the quick feedback! I have added some documentation to the TiraApplyFeatureTransformer
class, which hopefully explains what it's supposed to achieve. If this is still unclear, or the _get_features_from_row
method requires additional docstrings, please let me know!
Thank you for the quick review!
This PR reduces code duplication between
tira.pt.doc_features()
andtira.pt.query_features()
, and makes it easier to add new query-only, doc-only or query-document features.The new
TiraApplyFeatureTransformer
accepts amapping
parameter that assigns input rows to a feature or feature vector. For instance, if we have a mapping withmapping['q0']['doc0'] = np.array([.1, .2])
, we can instantiate the transformer asTiraApplyFeatureTransformer(mapping, ('qid', 'docno'))
. For one row, it will then create the features by selectingmapping[row['qid']][row['docno']]
.@mam10eks if that's alright with you, I will expand the
doc_features
andquery_features
unit tests later, after the LongEval deadline. Do I also need to update or add documentation somewhere?