Class: OCI::AiLanguage::Models::TextClassificationModelMetrics
- Inherits:
-
Object
- Object
- OCI::AiLanguage::Models::TextClassificationModelMetrics
- Defined in:
- lib/oci/ai_language/models/text_classification_model_metrics.rb
Overview
Model level text classification metrics
Instance Attribute Summary collapse
-
#accuracy ⇒ Float
[Required] The fraction of the labels that were correctly recognised .
-
#macro_f1 ⇒ Float
[Required] F1-score, is a measure of a modelu2019s accuracy on a dataset.
-
#macro_precision ⇒ Float
[Required] Precision refers to the number of true positives divided by the total number of positive predictions (i.e., the number of true positives plus the number of false positives).
-
#macro_recall ⇒ Float
[Required] Measures the model's ability to predict actual positive classes.
-
#micro_f1 ⇒ Float
[Required] F1-score, is a measure of a modelu2019s accuracy on a dataset.
-
#micro_precision ⇒ Float
[Required] Precision refers to the number of true positives divided by the total number of positive predictions (i.e., the number of true positives plus the number of false positives).
-
#micro_recall ⇒ Float
[Required] Measures the model's ability to predict actual positive classes.
-
#weighted_f1 ⇒ Float
F1-score, is a measure of a modelu2019s accuracy on a dataset.
-
#weighted_precision ⇒ Float
Precision refers to the number of true positives divided by the total number of positive predictions (i.e., the number of true positives plus the number of false positives).
-
#weighted_recall ⇒ Float
Measures the model's ability to predict actual positive classes.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ TextClassificationModelMetrics
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ TextClassificationModelMetrics
Initializes the object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 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 157 158 159 160 161 162 163 164 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 103 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.accuracy = attributes[:'accuracy'] if attributes[:'accuracy'] self.micro_f1 = attributes[:'microF1'] if attributes[:'microF1'] raise 'You cannot provide both :microF1 and :micro_f1' if attributes.key?(:'microF1') && attributes.key?(:'micro_f1') self.micro_f1 = attributes[:'micro_f1'] if attributes[:'micro_f1'] self.micro_precision = attributes[:'microPrecision'] if attributes[:'microPrecision'] raise 'You cannot provide both :microPrecision and :micro_precision' if attributes.key?(:'microPrecision') && attributes.key?(:'micro_precision') self.micro_precision = attributes[:'micro_precision'] if attributes[:'micro_precision'] self.micro_recall = attributes[:'microRecall'] if attributes[:'microRecall'] raise 'You cannot provide both :microRecall and :micro_recall' if attributes.key?(:'microRecall') && attributes.key?(:'micro_recall') self.micro_recall = attributes[:'micro_recall'] if attributes[:'micro_recall'] self.macro_f1 = attributes[:'macroF1'] if attributes[:'macroF1'] raise 'You cannot provide both :macroF1 and :macro_f1' if attributes.key?(:'macroF1') && attributes.key?(:'macro_f1') self.macro_f1 = attributes[:'macro_f1'] if attributes[:'macro_f1'] self.macro_precision = attributes[:'macroPrecision'] if attributes[:'macroPrecision'] raise 'You cannot provide both :macroPrecision and :macro_precision' if attributes.key?(:'macroPrecision') && attributes.key?(:'macro_precision') self.macro_precision = attributes[:'macro_precision'] if attributes[:'macro_precision'] self.macro_recall = attributes[:'macroRecall'] if attributes[:'macroRecall'] raise 'You cannot provide both :macroRecall and :macro_recall' if attributes.key?(:'macroRecall') && attributes.key?(:'macro_recall') self.macro_recall = attributes[:'macro_recall'] if attributes[:'macro_recall'] self.weighted_f1 = attributes[:'weightedF1'] if attributes[:'weightedF1'] raise 'You cannot provide both :weightedF1 and :weighted_f1' if attributes.key?(:'weightedF1') && attributes.key?(:'weighted_f1') self.weighted_f1 = attributes[:'weighted_f1'] if attributes[:'weighted_f1'] self.weighted_precision = attributes[:'weightedPrecision'] if attributes[:'weightedPrecision'] raise 'You cannot provide both :weightedPrecision and :weighted_precision' if attributes.key?(:'weightedPrecision') && attributes.key?(:'weighted_precision') self.weighted_precision = attributes[:'weighted_precision'] if attributes[:'weighted_precision'] self.weighted_recall = attributes[:'weightedRecall'] if attributes[:'weightedRecall'] raise 'You cannot provide both :weightedRecall and :weighted_recall' if attributes.key?(:'weightedRecall') && attributes.key?(:'weighted_recall') self.weighted_recall = attributes[:'weighted_recall'] if attributes[:'weighted_recall'] end |
Instance Attribute Details
#accuracy ⇒ Float
[Required] The fraction of the labels that were correctly recognised .
13 14 15 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 13 def accuracy @accuracy end |
#macro_f1 ⇒ Float
[Required] F1-score, is a measure of a modelu2019s accuracy on a dataset
29 30 31 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 29 def macro_f1 @macro_f1 end |
#macro_precision ⇒ Float
[Required] Precision refers to the number of true positives divided by the total number of positive predictions (i.e., the number of true positives plus the number of false positives)
33 34 35 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 33 def macro_precision @macro_precision end |
#macro_recall ⇒ Float
[Required] Measures the model's ability to predict actual positive classes. It is the ratio between the predicted true positives and what was actually tagged. The recall metric reveals how many of the predicted classes are correct.
37 38 39 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 37 def macro_recall @macro_recall end |
#micro_f1 ⇒ Float
[Required] F1-score, is a measure of a modelu2019s accuracy on a dataset
17 18 19 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 17 def micro_f1 @micro_f1 end |
#micro_precision ⇒ Float
[Required] Precision refers to the number of true positives divided by the total number of positive predictions (i.e., the number of true positives plus the number of false positives)
21 22 23 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 21 def micro_precision @micro_precision end |
#micro_recall ⇒ Float
[Required] Measures the model's ability to predict actual positive classes. It is the ratio between the predicted true positives and what was actually tagged. The recall metric reveals how many of the predicted classes are correct.
25 26 27 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 25 def micro_recall @micro_recall end |
#weighted_f1 ⇒ Float
F1-score, is a measure of a modelu2019s accuracy on a dataset
41 42 43 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 41 def weighted_f1 @weighted_f1 end |
#weighted_precision ⇒ Float
Precision refers to the number of true positives divided by the total number of positive predictions (i.e., the number of true positives plus the number of false positives)
45 46 47 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 45 def weighted_precision @weighted_precision end |
#weighted_recall ⇒ Float
Measures the model's ability to predict actual positive classes. It is the ratio between the predicted true positives and what was actually tagged. The recall metric reveals how many of the predicted classes are correct.
49 50 51 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 49 def weighted_recall @weighted_recall end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 52 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'accuracy': :'accuracy', 'micro_f1': :'microF1', 'micro_precision': :'microPrecision', 'micro_recall': :'microRecall', 'macro_f1': :'macroF1', 'macro_precision': :'macroPrecision', 'macro_recall': :'macroRecall', 'weighted_f1': :'weightedF1', 'weighted_precision': :'weightedPrecision', 'weighted_recall': :'weightedRecall' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 70 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'accuracy': :'Float', 'micro_f1': :'Float', 'micro_precision': :'Float', 'micro_recall': :'Float', 'macro_f1': :'Float', 'macro_precision': :'Float', 'macro_recall': :'Float', 'weighted_f1': :'Float', 'weighted_precision': :'Float', 'weighted_recall': :'Float' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 173 def ==(other) return true if equal?(other) self.class == other.class && accuracy == other.accuracy && micro_f1 == other.micro_f1 && micro_precision == other.micro_precision && micro_recall == other.micro_recall && macro_f1 == other.macro_f1 && macro_precision == other.macro_precision && macro_recall == other.macro_recall && weighted_f1 == other.weighted_f1 && weighted_precision == other.weighted_precision && weighted_recall == other.weighted_recall end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 212 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) public_method("#{key}=").call( attributes[self.class.attribute_map[key]] .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? public_method("#{key}=").call( OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]) ) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(other) ⇒ Boolean
192 193 194 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 192 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
201 202 203 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 201 def hash [accuracy, micro_f1, micro_precision, micro_recall, macro_f1, macro_precision, macro_recall, weighted_f1, weighted_precision, weighted_recall].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
245 246 247 248 249 250 251 252 253 254 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 245 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_method(attr).call next if value.nil? && !instance_variable_defined?("@#{attr}") hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
239 240 241 |
# File 'lib/oci/ai_language/models/text_classification_model_metrics.rb', line 239 def to_s to_hash.to_s end |