Class: Broadlistening::Steps::InitialLabelling
- Defined in:
- lib/broadlistening/steps/initial_labelling.rb
Constant Summary collapse
- SAMPLING_NUM =
30
Instance Attribute Summary
Attributes inherited from BaseStep
Instance Method Summary collapse
Methods inherited from BaseStep
Constructor Details
This class inherits a constructor from Broadlistening::Steps::BaseStep
Instance Method Details
#execute ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/broadlistening/steps/initial_labelling.rb', line 8 def execute return context if context.arguments.empty? || context.cluster_results.empty? max_level = context.cluster_results.keys.max cluster_ids = context.cluster_results[max_level].uniq labels = label_clusters_in_parallel(context.arguments, max_level, cluster_ids) context.initial_labels = labels.to_h { |l| [ l[:cluster_id], l ] } context end |