Class: Delphin::OutputProfileName
- Inherits:
-
Struct
- Object
- Struct
- Delphin::OutputProfileName
- Defined in:
- lib/delphin.rb
Overview
The name of a Logon TSDB output profile.
These are long strings with information about the features used to generate them in brackets.
Instance Attribute Summary collapse
-
#active_edges ⇒ Object
Returns the value of attribute active_edges.
-
#constituent_weight ⇒ Object
Returns the value of attribute constituent_weight.
-
#grandparenting ⇒ Object
Returns the value of attribute grandparenting.
-
#name ⇒ Object
readonly
The basename of the profile.
-
#ngram_back_off ⇒ Object
Returns the value of attribute ngram_back_off.
-
#ngram_size ⇒ Object
Returns the value of attribute ngram_size.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#relative_tolerance ⇒ Object
Returns the value of attribute relative_tolerance.
-
#variance ⇒ Object
Returns the value of attribute variance.
Instance Method Summary collapse
-
#equal_learner_features?(other) ⇒ Boolean
Do this profile name and other have the all same machine learning features?.
-
#feature_string ⇒ Object
A compact and readable representation of all the feature values.
-
#initialize(name) ⇒ OutputProfileName
constructor
Create a output profile name from a directory name.
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ OutputProfileName
Create a output profile name from a directory name
Path information will be stripped from the name parameter.
- name
-
A directory name
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/delphin.rb', line 132 def initialize(name) @name = File.basename(name) @name =~ /\[(\S+)\]\s # 1 Prefix GP\[(\d+)\]\s # 2 Grandparenting [+-]PT\s [+-]LEX\s CW\[(\d*)\]\s # 3 Constituent weight ([+-])AE\s # 4 Active edges NS\[(\d+)\]\s # 5 N-gram size NT\[\w*\]\s ([+-])NB\s # 6 N-gram backoff LM\[\d+\]\s FT\[:::\d+\]\s RS\[\]\s MM\[\S+\]\s MI\[\d+\]\s RT\[(\d+(?:\.\d+)?e[+-]\d+)\]\s # 7 Relative tolerance AT\[\d+(?:\.\d+)?e[+-]\d+\]\s VA\[(\d+(?:\.\d+)?e[+-]\d+)?\]\s # 8 Variance PC\[\d+\] /x or raise ArgumentError.new("Invalid profile name #{name}") super($1, $2.to_i, $3.to_i, $4 == "+", $5.to_i, $6 == "+", $7.to_f, $8.nil? ? nil : $8.to_f) end |
Instance Attribute Details
#active_edges ⇒ Object
Returns the value of attribute active_edges
120 121 122 |
# File 'lib/delphin.rb', line 120 def active_edges @active_edges end |
#constituent_weight ⇒ Object
Returns the value of attribute constituent_weight
120 121 122 |
# File 'lib/delphin.rb', line 120 def constituent_weight @constituent_weight end |
#grandparenting ⇒ Object
Returns the value of attribute grandparenting
120 121 122 |
# File 'lib/delphin.rb', line 120 def grandparenting @grandparenting end |
#name ⇒ Object (readonly)
The basename of the profile
125 126 127 |
# File 'lib/delphin.rb', line 125 def name @name end |
#ngram_back_off ⇒ Object
Returns the value of attribute ngram_back_off
120 121 122 |
# File 'lib/delphin.rb', line 120 def ngram_back_off @ngram_back_off end |
#ngram_size ⇒ Object
Returns the value of attribute ngram_size
120 121 122 |
# File 'lib/delphin.rb', line 120 def ngram_size @ngram_size end |
#prefix ⇒ Object
Returns the value of attribute prefix
120 121 122 |
# File 'lib/delphin.rb', line 120 def prefix @prefix end |
#relative_tolerance ⇒ Object
Returns the value of attribute relative_tolerance
120 121 122 |
# File 'lib/delphin.rb', line 120 def relative_tolerance @relative_tolerance end |
#variance ⇒ Object
Returns the value of attribute variance
120 121 122 |
# File 'lib/delphin.rb', line 120 def variance @variance end |
Instance Method Details
#equal_learner_features?(other) ⇒ Boolean
Do this profile name and other have the all same machine learning features?
164 165 166 167 168 169 |
# File 'lib/delphin.rb', line 164 def equal_learner_features?(other) [:grandparenting, :constituent_weight, :active_edges, :ngram_size, :ngram_back_off, :relative_tolerance, :variance].all? do |feature| send(feature) == other.send(feature) end end |
#feature_string ⇒ Object
A compact and readable representation of all the feature values.
172 173 174 175 176 177 |
# File 'lib/delphin.rb', line 172 def feature_string [:grandparenting, :constituent_weight, :active_edges, :ngram_size, :ngram_back_off, :relative_tolerance, :variance].collect do |feature| "#{feature.to_s}=#{send(feature)}" end.join(",") end |
#to_s ⇒ Object
158 159 160 |
# File 'lib/delphin.rb', line 158 def to_s "#{prefix}:#{feature_string}" end |