From af3895545d03c7426be06de979aceb69316dc9a9 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 27 Dec 2023 12:44:52 +0100 Subject: [PATCH] Improved MLPPData::set_data_supervised(). --- mlpp/data/data.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mlpp/data/data.cpp b/mlpp/data/data.cpp index f0a4220..c07e717 100644 --- a/mlpp/data/data.cpp +++ b/mlpp/data/data.cpp @@ -243,8 +243,6 @@ void MLPPData::set_data_supervised(int k, const String &file_name, Ref> input_set_tmp; - input_set_tmp.resize(k); - Vector output_set_tmp; FileAccess *file = FileAccess::open(file_name, FileAccess::READ); @@ -254,10 +252,13 @@ void MLPPData::set_data_supervised(int k, const String &file_name, Refeof_reached()) { Vector ll = file->get_csv_line(); + Vector row; + for (int i = 0; i < k; ++i) { - input_set_tmp.write[i].push_back(static_cast(ll[i].to_double())); + row.push_back(static_cast(ll[i].to_double())); } + input_set_tmp.push_back(row); output_set_tmp.push_back(static_cast(ll[k].to_double())); } @@ -265,9 +266,7 @@ void MLPPData::set_data_supervised(int k, const String &file_name, Refset_from_vector(output_set_tmp); - input_set->set_from_vectors(input_set_tmp); - input_set = alg.transposenm(input_set); } void MLPPData::set_data_unsupervised(int k, const String &file_name, Ref input_set) {