Class: Google::Apis::BigqueryV2::AggregateClassificationMetrics

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/bigquery_v2/classes.rb,
lib/google/apis/bigquery_v2/representations.rb,
lib/google/apis/bigquery_v2/representations.rb

Overview

Aggregate metrics for classification/classifier models. For multi-class models, the metrics are either macro-averaged or micro-averaged. When macro-averaged, the metrics are calculated for each label and then an unweighted average is taken of those values. When micro-averaged, the metric is calculated globally by counting the total number of correctly predicted rows.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ AggregateClassificationMetrics

Returns a new instance of AggregateClassificationMetrics.



75
76
77
# File 'lib/google/apis/bigquery_v2/classes.rb', line 75

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#accuracyFloat

Accuracy is the fraction of predictions given the correct label. For multiclass this is a micro-averaged metric. Corresponds to the JSON property accuracy

Returns:

  • (Float)


37
38
39
# File 'lib/google/apis/bigquery_v2/classes.rb', line 37

def accuracy
  @accuracy
end

#f1_scoreFloat

The F1 score is an average of recall and precision. For multiclass this is a macro-averaged metric. Corresponds to the JSON property f1Score

Returns:

  • (Float)


43
44
45
# File 'lib/google/apis/bigquery_v2/classes.rb', line 43

def f1_score
  @f1_score
end

#log_lossFloat

Logarithmic Loss. For multiclass this is a macro-averaged metric. Corresponds to the JSON property logLoss

Returns:

  • (Float)


48
49
50
# File 'lib/google/apis/bigquery_v2/classes.rb', line 48

def log_loss
  @log_loss
end

#precisionFloat

Precision is the fraction of actual positive predictions that had positive actual labels. For multiclass this is a macro-averaged metric treating each class as a binary classifier. Corresponds to the JSON property precision

Returns:

  • (Float)


55
56
57
# File 'lib/google/apis/bigquery_v2/classes.rb', line 55

def precision
  @precision
end

#recallFloat

Recall is the fraction of actual positive labels that were given a positive prediction. For multiclass this is a macro-averaged metric. Corresponds to the JSON property recall

Returns:

  • (Float)


61
62
63
# File 'lib/google/apis/bigquery_v2/classes.rb', line 61

def recall
  @recall
end

#roc_aucFloat

Area Under a ROC Curve. For multiclass this is a macro-averaged metric. Corresponds to the JSON property rocAuc

Returns:

  • (Float)


66
67
68
# File 'lib/google/apis/bigquery_v2/classes.rb', line 66

def roc_auc
  @roc_auc
end

#thresholdFloat

Threshold at which the metrics are computed. For binary classification models this is the positive class threshold. For multi-class classfication models this is the confidence threshold. Corresponds to the JSON property threshold

Returns:

  • (Float)


73
74
75
# File 'lib/google/apis/bigquery_v2/classes.rb', line 73

def threshold
  @threshold
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



80
81
82
83
84
85
86
87
88
# File 'lib/google/apis/bigquery_v2/classes.rb', line 80

def update!(**args)
  @accuracy = args[:accuracy] if args.key?(:accuracy)
  @f1_score = args[:f1_score] if args.key?(:f1_score)
  @log_loss = args[:log_loss] if args.key?(:log_loss)
  @precision = args[:precision] if args.key?(:precision)
  @recall = args[:recall] if args.key?(:recall)
  @roc_auc = args[:roc_auc] if args.key?(:roc_auc)
  @threshold = args[:threshold] if args.key?(:threshold)
end