From 5331b20ee41c82944d6e92e96b3ff606f08ff10f Mon Sep 17 00:00:00 2001 From: Adriano Maciel Date: Fri, 27 Jul 2018 18:42:55 -0300 Subject: [PATCH] =?UTF-8?q?-=20Asjutado=20sizeof=20do=20dataset=20y,=20qua?= =?UTF-8?q?ndo=20possui=20apenas=20um=20resultado=20ou=20=C3=A9=20um=20vet?= =?UTF-8?q?or;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test-accuracy-evaluate-model/lib/train.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test-accuracy-evaluate-model/lib/train.php b/test-accuracy-evaluate-model/lib/train.php index 6aa2b74..da1a0c7 100755 --- a/test-accuracy-evaluate-model/lib/train.php +++ b/test-accuracy-evaluate-model/lib/train.php @@ -113,7 +113,12 @@ class FannTrain{ // criando os dados de saida para um arquivo $file = fopen($target, "wb"); - fwrite($file, implode(" ", [ sizeof( $this->x_dataset ), sizeof( $this->x_dataset[0] ), sizeof($this->y_dataset[0]) ]) ); + fwrite($file, implode(" ", [ + sizeof( $this->x_dataset ), + sizeof( $this->x_dataset[0] ), + ( is_array($this->y_dataset[0]) ? sizeof($this->y_dataset[0]) : strlen($this->y_dataset[0]) ) + ]) + ); foreach( $this->x_dataset as $k => $v ){ fwrite($file, chr(13).chr(10) ); @@ -144,7 +149,7 @@ class FannTrain{ // config network $num_input = sizeof( $this->x_dataset[0] ); - $num_output = sizeof( $this->y_dataset[0] ); + $num_output = ( is_array($this->y_dataset[0]) ? sizeof($this->y_dataset[0]) : strlen($this->y_dataset[0]) ); $desired_error = $this->dropout; $max_epochs = $this->number_epochs; $epochs_between_reports = $this->batch_size;