Skip to content

Commit 0c54546

Browse files
committed
fix: do not use train_loss_test metrics on MeasureChart
1 parent b60e125 commit 0c54546

File tree

1 file changed

+40
-7
lines changed
  • src/components/widgets/TrainingMonitor/components/MeasureChart

1 file changed

+40
-7
lines changed

src/components/widgets/TrainingMonitor/components/MeasureChart/index.js

+40-7
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,20 @@ class MeasureChart extends React.Component {
212212
} else if (
213213
measure_hist &&
214214
Object.keys(measure_hist)
215-
.find(k => k.startsWith(attr))
215+
.find(k => {
216+
return attr === "train_loss" ?
217+
k.startsWith(attr) && k.indexOf("_test") === -1
218+
:
219+
k.startsWith(attr)
220+
})
216221
) {
217222
const attrKey = Object.keys(measure_hist)
218-
.find(k => k.startsWith(attr))
223+
.find(k => {
224+
return attr === "train_loss" ?
225+
k.startsWith(attr) && k.indexOf("_test") === -1
226+
:
227+
k.startsWith(attr)
228+
})
219229
value =
220230
measure_hist[attrKey][measure_hist[attrKey].length - 1];
221231
}
@@ -241,10 +251,20 @@ class MeasureChart extends React.Component {
241251
if (
242252
measure_hist &&
243253
Object.keys(measure_hist)
244-
.find(k => k.startsWith(attr))
254+
.find(k => {
255+
return attr === "train_loss" ?
256+
k.startsWith(attr) && k.indexOf("_test") === -1
257+
:
258+
k.startsWith(attr)
259+
})
245260
) {
246261
const attrKey = Object.keys(measure_hist)
247-
.find(k => k.startsWith(attr))
262+
.find(k => {
263+
return attr === "train_loss" ?
264+
k.startsWith(attr) && k.indexOf("_test") === -1
265+
:
266+
k.startsWith(attr)
267+
})
248268
measures = toJS(measure_hist[attrKey]);
249269
// Remove Infinity values from measure_hist
250270
if (measures.some(x => x === Infinity)) {
@@ -302,10 +322,20 @@ class MeasureChart extends React.Component {
302322
if (
303323
measure_hist &&
304324
Object.keys(measure_hist)
305-
.find(k => k.startsWith(attr))
325+
.find(k => {
326+
return attr === "train_loss" ?
327+
k.startsWith(attr) && k.indexOf("_test") === -1
328+
:
329+
k.startsWith(attr)
330+
})
306331
) {
307332
const attrKey = Object.keys(measure_hist)
308-
.find(k => k.startsWith(attr))
333+
.find(k => {
334+
return attr === "train_loss" ?
335+
k.startsWith(attr) && k.indexOf("_test") === -1
336+
:
337+
k.startsWith(attr)
338+
})
309339
let labels = [],
310340
measures = toJS(measure_hist[attrKey]),
311341
datasets = services.map((s, index) => {
@@ -385,7 +415,10 @@ class MeasureChart extends React.Component {
385415
if (service) {
386416
displayedValue = this.getValue(service, attribute);
387417

388-
if (attribute.startsWith("train_loss") && displayedValue !== "--") {
418+
if (
419+
attribute.startsWith("train_loss") &&
420+
displayedValue !== "--"
421+
) {
389422
displayedValue = parseFloat(displayedValue);
390423

391424
if (typeof displayedValue.toFixed === "function") {

0 commit comments

Comments
 (0)