Class: NexosisApi::AlgorithmContestant
- Inherits:
-
Object
- Object
- NexosisApi::AlgorithmContestant
- Defined in:
- lib/nexosis_api/algorithm_contestant.rb
Overview
Class to parse results of an algorithm run
Instance Attribute Summary collapse
-
#algorithm ⇒ NexosisApi::Algorithm
Identifier of algorithm run.
-
#data ⇒ Array of Hash
readonly
The test dataset used to score the algo.
-
#datasource_properties ⇒ Array
readonly
Operations performed on datasource prior to run.
-
#id ⇒ Object
readonly
Unique identifier for this contestant.
-
#links ⇒ Array
Relevant hypermedia as Link.
-
#metrics ⇒ Hash
Name and value for metrics calculated for this algorithm.
Instance Method Summary collapse
-
#initialize(contestant_hash) ⇒ AlgorithmContestant
constructor
A new instance of AlgorithmContestant.
Constructor Details
#initialize(contestant_hash) ⇒ AlgorithmContestant
Returns a new instance of AlgorithmContestant.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/nexosis_api/algorithm_contestant.rb', line 5 def initialize(contestant_hash) contestant_hash.each do |k, v| if k.to_s == 'links' instance_variable_set("@#{k}", v.map { |l| NexosisApi::Link.new(l) unless l.nil? }) elsif k.to_s == 'dataSourceProperties' @datasource_properties = v elsif k.to_s == 'algorithm' instance_variable_set("@#{k}", NexosisApi::Algorithm.new(v)) unless v.nil? else instance_variable_set("@#{k}", v) end end end |
Instance Attribute Details
#algorithm ⇒ NexosisApi::Algorithm
Identifier of algorithm run
24 25 26 |
# File 'lib/nexosis_api/algorithm_contestant.rb', line 24 def algorithm @algorithm end |
#data ⇒ Array of Hash (readonly)
Note:
-
may be nil when reviewing contestant lists
The test dataset used to score the algo
41 42 43 |
# File 'lib/nexosis_api/algorithm_contestant.rb', line 41 def data @data end |
#datasource_properties ⇒ Array (readonly)
Operations performed on datasource prior to run
36 37 38 |
# File 'lib/nexosis_api/algorithm_contestant.rb', line 36 def datasource_properties @datasource_properties end |
#id ⇒ Object (readonly)
Unique identifier for this contestant
20 21 22 |
# File 'lib/nexosis_api/algorithm_contestant.rb', line 20 def id @id end |
#links ⇒ Array
Relevant hypermedia as Link
32 33 34 |
# File 'lib/nexosis_api/algorithm_contestant.rb', line 32 def links @links end |
#metrics ⇒ Hash
Name and value for metrics calculated for this algorithm
28 29 30 |
# File 'lib/nexosis_api/algorithm_contestant.rb', line 28 def metrics @metrics end |