(
metrics []metric.Metric,
namePrefix string,
isLastBatch bool,
yTrue interface{},
yPred interface{},
)
| 848 | } |
| 849 | |
| 850 | func (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 | |
| 900 | func (m *TfkgModel) processCallbacks( |
| 901 | callbacks []callback.Callback, |
no test coverage detected