Skip to content

Commit

Permalink
#320 and #355 related notes.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolay-r committed Jul 8, 2022
1 parent 302a446 commit 8f1ea70
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions arekit/common/experiment/api/ops_opin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class OpinionOperations(object):
"""
TODO. #320 related. Move this into `rusentrel_experiment` project.
Provides operations with opinions and related collections
"""

Expand Down
10 changes: 10 additions & 0 deletions arekit/contrib/utils/handlers/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@


class EvalIterationHandler(ExperimentIterationHandler):
""" TODO: #355 affected.
Этот класс устарел ввиду зависимостей на Opinion, в то время как
нас в оценке результатов могут, например, интересовать TextOpinion.
Поэтому здесь нужно избавиться от opin_ops, а также возможно что
от класса в целом, так как предполагаются отдельные реализации
различных оценок в виде отдельных функций.
"""

def __init__(self, data_type, doc_ops, opin_ops, epoch_indices, evaluator):
assert(isinstance(data_type, DataType))
assert(isinstance(doc_ops, DocumentOperations))
# TODO. #355 related. OpinionOperations limit this onto `Opinion` type only.
assert(isinstance(opin_ops, OpinionOperations))
assert(isinstance(epoch_indices, list))
assert(isinstance(evaluator, BaseEvaluator))
Expand Down Expand Up @@ -46,8 +54,10 @@ def __evaluate(self, data_type, epoch_index):
# Compose cmp pairs iterator.
cmp_pairs_iter = DataPairsIterators.iter_func_based_collections(
doc_ids=[doc_id for doc_id in doc_ids_iter if doc_id in cmp_doc_ids_set],
# TODO. #355 related. OpinionOperations limit this onto `Opinion` type only.
read_etalon_collection_func=lambda doc_id: self.__opin_ops.get_etalon_opinion_collection(
doc_id=doc_id),
# TODO. #355 related. OpinionOperations limit this onto `Opinion` type only.
read_test_collection_func=lambda doc_id: self.__opin_ops.get_result_opinion_collection(
data_type=data_type,
doc_id=doc_id,
Expand Down
1 change: 1 addition & 0 deletions arekit/contrib/utils/handlers/to_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def __convert(self, output_storage, target_func):
doc_id=doc_id,
opinions_view=self.__exp_io.create_opinions_view(self._data_type)),
doc_ids_set=cmp_doc_ids_set,
# TODO: #320 related. Create a separate parameter.
create_opinion_collection_func=self.__opin_ops.create_opinion_collection,
labels_scaler=self.__label_scaler,
label_calc_mode=LabelCalculationMode.AVERAGE)
Expand Down

0 comments on commit 8f1ea70

Please sign in to comment.