Skip to content

Commit

Permalink
#212 todo comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolay-r committed Oct 14, 2021
1 parent 5546e89 commit e442077
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions arekit/common/experiment/annot/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def __iter_annotated_collections(self, data_type, filter_func, doc_ops, opin_ops
assert(isinstance(doc_ops, DocumentOperations))
assert(isinstance(opin_ops, OpinionOperations))

# TODO. 212. Pass tag ("annotate")
docs_to_annot_list = list(filter(filter_func,
doc_ops.iter_doc_ids_to_annotate()))

Expand Down
1 change: 1 addition & 0 deletions arekit/common/experiment/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def evaluate(self, data_type, epoch_index):
assert(isinstance(self.__experiment_data, TrainingData))

# Extracting all docs to cmp and those that is related to data_type.
# TODO. 212. Pass tag ("compare")
cmp_doc_ids_iter = self.__doc_operations.iter_doc_ids_to_compare()
doc_ids_iter = self.__doc_operations.iter_doc_ids(data_type=data_type)
cmp_doc_ids_set = set(cmp_doc_ids_iter)
Expand Down
2 changes: 2 additions & 0 deletions arekit/common/experiment/api/ops_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ def DataFolding(self):
def get_doc(self, doc_id):
raise NotImplementedError()

# TODO. 212. Unify, add tag.
def iter_doc_ids_to_annotate(self):
""" provides set of documents that utilized by annotator algorithm in order to
provide the related labeling of annotated attitudes in it.
By default, we consider an empty set, so there is no need to utilize annotator.
"""
raise NotImplementedError()

# TODO. 212. Unify, add tag.
def iter_doc_ids_to_compare(self):
""" provides set of documents that utilized in model evaluation process
"""
Expand Down
1 change: 1 addition & 0 deletions arekit/contrib/bert/run_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def _handle_iteration(self, iter_index):

# TODO. This should be removed as this is a part of the particular
# experiment, not source!.
# TODO. 212. Pass tag ("compare")
cmp_doc_ids_set = set(self._experiment.DocumentOperations.iter_doc_ids_to_compare())

if callback.check_log_exists():
Expand Down
1 change: 1 addition & 0 deletions arekit/contrib/experiment_rusentrel/exp_ds/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def _create_parse_options(self):
return RuAttitudesParseOptions(stemmer=self.__exp_data.Stemmer,
frame_variants_collection=self.__exp_data.FrameVariantCollection)

# TODO. 212. Rename, add tag parameter.
def iter_doc_ids_to_annotate(self):
return
yield
Expand Down
2 changes: 2 additions & 0 deletions arekit/contrib/experiment_rusentrel/exp_joined/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ def _create_parse_options(self):
# Therefore we provide rusentrel_doc by default.
return self.__rusentrel_doc._create_parse_options()

# TODO. 212. Unify (use only one method for both below)
def iter_doc_ids_to_annotate(self):
return self.__rusentrel_doc.iter_doc_ids_to_annotate()

# TODO. 212. Unify (use only one method for this and one above)
def iter_doc_ids_to_compare(self):
return self.__rusentrel_doc.iter_doc_ids_to_compare()

Expand Down
2 changes: 2 additions & 0 deletions arekit/contrib/experiment_rusentrel/exp_sl/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ def __init__(self, exp_data, folding, version, get_synonyms_func):

# region DocumentOperations

# TODO. 212. Unify with the one below, add tag.
def iter_doc_ids_to_annotate(self):
return self.DataFolding.iter_doc_ids()

# TODO. 212. Unify with the one above, add tag.
def iter_doc_ids_to_compare(self):
return self.DataFolding.iter_doc_ids()

Expand Down
1 change: 1 addition & 0 deletions arekit/contrib/networks/core/callback/utils_model_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def __convert_output_to_opinion_collections(exp_io, opin_ops, doc_ops, labels_sc
assert(isinstance(label_calc_mode, LabelCalculationMode))
assert(isinstance(labels_formatter, StringLabelsFormatter))

# TODO. 212. Pass tag ("compare")
cmp_doc_ids_set = set(doc_ops.iter_doc_ids_to_compare())

output_view = MulticlassOutputView(labels_scaler=labels_scaler,
Expand Down
2 changes: 2 additions & 0 deletions examples/network/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ class SingleDocOperations(DocumentOperations):
""" Operations over a single document for inference.
"""

# TODO. 212. Rename, add tag.
def iter_doc_ids_to_annotate(self):
return 0

# TODO. 212. Remove (we don't need it in such case).
def iter_doc_ids_to_compare(self):
raise NotImplementedError()

Expand Down

0 comments on commit e442077

Please sign in to comment.