MCPcopy Create free account
hub / github.com/CodingBeard/tfkg / getMetricLogs

Method getMetricLogs

model/model.go:850–898  ·  view source on GitHub ↗
(
	metrics []metric.Metric,
	namePrefix string,
	isLastBatch bool,
	yTrue interface{},
	yPred interface{},
)

Source from the content-addressed store, hash-verified

848}
849
850func (m *TfkgModel) getMetricLogs(
851 metrics []metric.Metric,
852 namePrefix string,
853 isLastBatch bool,
854 yTrue interface{},
855 yPred interface{},
856) []callback.Log {
857 var logs []callback.Log
858 for _, met := range metrics {
859 if isLastBatch {
860 met.Compute(yTrue, yPred)
861 final := met.ComputeFinal()
862
863 logs = append(logs, callback.Log{
864 Name: namePrefix + final.Name,
865 Value: final.Value,
866 Precision: final.Precision,
867 })
868
869 if metWithExtra, ok := met.(metric.HasExtraMetrics); ok {
870 for _, extraMetric := range metWithExtra.GetExtraMetrics() {
871 logs = append(logs, callback.Log{
872 Name: namePrefix + extraMetric.Name,
873 Value: extraMetric.Value,
874 Precision: extraMetric.Precision,
875 })
876 }
877 }
878 } else {
879 value := met.Compute(yTrue, yPred)
880 logs = append(logs, callback.Log{
881 Name: namePrefix + met.GetName(),
882 Value: value.Value,
883 Precision: value.Precision,
884 })
885 if metWithExtra, ok := met.(metric.HasExtraMetrics); ok {
886 for _, extraMetric := range metWithExtra.GetExtraMetrics() {
887 logs = append(logs, callback.Log{
888 Name: namePrefix + extraMetric.Name,
889 Value: extraMetric.Value,
890 Precision: extraMetric.Precision,
891 })
892 }
893 }
894 }
895 }
896
897 return logs
898}
899
900func (m *TfkgModel) processCallbacks(
901 callbacks []callback.Callback,

Callers 2

FitMethod · 0.95
EvaluateMethod · 0.95

Calls 4

ComputeMethod · 0.65
ComputeFinalMethod · 0.65
GetExtraMetricsMethod · 0.65
GetNameMethod · 0.65

Tested by

no test coverage detected