@@ -422,23 +422,15 @@ fun calculate_loss(rnn, frames, label) {
422422fun training_actor(detection_actor_id) {
423423 rand_init($time_current_ms());
424424 let var rnn = RNN(INPUT_SIZE, HIDDEN_SIZE, OUTPUT_SIZE);
425- let var best_loss = -1.0 ;
425+ let var best_loss = nil ;
426426
427427 let training_data = [];
428428 let var iteration_count = 0;
429- let var positive_examples_count = 0;
430- let var negative_examples_count = 0;
431429
432430 for (let var training_itr = 1;;) {
433431 let msg = $actor_poll();
434432 if (msg != nil) {
435433 training_data.push(msg);
436- if (msg[1] > 0) {
437- positive_examples_count = positive_examples_count + 1;
438- } else {
439- negative_examples_count = negative_examples_count + 1;
440- }
441- $println("Positive samples: " + positive_examples_count.to_s() + ", negative samples: " + negative_examples_count.to_s());
442434 }
443435
444436 if (training_data.len == 0) {
@@ -455,7 +447,7 @@ fun training_actor(detection_actor_id) {
455447 let current_loss = calculate_loss(rnn, frames, label);
456448
457449 // On the first run, initialize the loss for display
458- if (best_loss < 0.0 ) {
450+ if (best_loss == nil ) {
459451 best_loss = current_loss;
460452 }
461453
@@ -471,13 +463,10 @@ fun training_actor(detection_actor_id) {
471463 }
472464
473465 if (iteration_count % 20 == 0) {
474- $println(
466+ $println(
475467 "Itr#" + training_itr.to_s() +
476468 ", loss: " + best_loss.format_decimals(9) +
477- ", pos: " +
478- positive_examples_count.to_s() +
479- ", neg: " +
480- negative_examples_count.to_s()
469+ ", examples: " + training_data.len.to_s()
481470 );
482471 }
483472
0 commit comments