diff --git a/src/feature_creation/node/value_storage/nodes_value_containers.cpp b/src/feature_creation/node/value_storage/nodes_value_containers.cpp index 55f5d705f9eb11398c655b40cdaccde5425b0eba..8799576cf2657db25b6bdd7e85a61e24998f81c3 100644 --- a/src/feature_creation/node/value_storage/nodes_value_containers.cpp +++ b/src/feature_creation/node/value_storage/nodes_value_containers.cpp @@ -31,6 +31,7 @@ int node_value_arrs::MAX_N_THREADS = omp_get_max_threads(); int node_value_arrs::N_OP_SLOTS = 0; int node_value_arrs::N_PARAM_OP_SLOTS = 0; int node_value_arrs::MAX_RUNG = 0; +int node_value_arrs::SZ_STAND_FEAT = 0; std::vector<int> node_value_arrs::TEMP_STORAGE_REG; std::vector<int> node_value_arrs::TEMP_STORAGE_TEST_REG; @@ -47,6 +48,10 @@ std::vector<double> node_value_arrs::TEST_VALUES_ARR; std::vector<double> node_value_arrs::TEMP_STORAGE_ARR; std::vector<double> node_value_arrs::TEMP_STORAGE_TEST_ARR; +std::vector<double> node_value_arrs::STANDARDIZED_D_MATRIX; +std::vector<double> node_value_arrs::STANDARDIZED_STORAGE_ARR; +std::vector<double> node_value_arrs::STANDARDIZED_TEST_STORAGE_ARR; + void node_value_arrs::initialize_values_arr( const int n_samples, const int n_samples_test, @@ -58,9 +63,13 @@ void node_value_arrs::initialize_values_arr( N_RUNGS_STORED = 0; N_STORE_FEATURES = n_primary_feat; N_PRIMARY_FEATURES = n_primary_feat; + SZ_STAND_FEAT = std::max(N_SAMPLES, N_SELECTED); VALUES_ARR = std::vector<double>(N_STORE_FEATURES * N_SAMPLES); TEST_VALUES_ARR = std::vector<double>(N_STORE_FEATURES * N_SAMPLES_TEST); + + STANDARDIZED_STORAGE_ARR = std::vector<double>((N_STORE_FEATURES + 1) * MAX_N_THREADS * SZ_STAND_FEAT); + STANDARDIZED_TEST_STORAGE_ARR = std::vector<double>((N_STORE_FEATURES + 1) * MAX_N_THREADS * N_SAMPLES_TEST); } void node_value_arrs::initialize_values_arr( @@ -236,6 +245,7 @@ void node_value_arrs::initialize_d_matrix_arr() { N_SELECTED = 0; D_MATRIX = std::vector<double>(0); + STANDARDIZED_D_MATRIX = std::vector<double>(0); } void node_value_arrs::resize_d_matrix_arr(const int n_select) @@ -243,6 +253,12 @@ void node_value_arrs::resize_d_matrix_arr(const int n_select) N_SELECTED += n_select; D_MATRIX.resize(N_SELECTED * N_SAMPLES, 0.0); D_MATRIX.shrink_to_fit(); + + STANDARDIZED_D_MATRIX.resize(N_SELECTED * N_SAMPLES, 0.0); + STANDARDIZED_D_MATRIX.shrink_to_fit(); + + SZ_STAND_FEAT = std::max(N_SAMPLES, N_SELECTED); + STANDARDIZED_STORAGE_ARR = std::vector<double>((N_STORE_FEATURES + 1) * MAX_N_THREADS * SZ_STAND_FEAT); } void node_value_arrs::finalize_values_arr() diff --git a/src/feature_creation/node/value_storage/nodes_value_containers.hpp b/src/feature_creation/node/value_storage/nodes_value_containers.hpp index 0b793bfe4d2668c5d7f8581956ff2b784423de21..03d864d7009b29798d2164643ee4e13cfabc3def 100644 --- a/src/feature_creation/node/value_storage/nodes_value_containers.hpp +++ b/src/feature_creation/node/value_storage/nodes_value_containers.hpp @@ -58,7 +58,12 @@ namespace node_value_arrs extern std::vector<int> TASK_START_TRAIN; //!< The starting point for each task in the training data extern std::vector<int> TASK_SZ_TEST; //!< Number of test sample per task + extern std::vector<double> STANDARDIZED_D_MATRIX; //!< The descriptor matrix filled with standardized feature values (Central storage for the selected feature space) + extern std::vector<double> STANDARDIZED_STORAGE_ARR; //!< //!< The vector used to temporarily store the values of the standardized feature training values + extern std::vector<double> STANDARDIZED_TEST_STORAGE_ARR; //!< //!< The vector used to temporarily store the values of the standardized feature test values + extern int N_SELECTED; //!< Number of selected features + extern int SZ_STAND_FEAT; //!< std::max(N_SELECTED, N_SAMPLES) extern int N_SAMPLES; //!< Number of training samples for each feature (Sum of all elements in TASK_SZ_TRAIN) extern int N_SAMPLES_TEST; //!< Number of test samples for each feature (Sum of all elements in TASK_SZ_TEST) @@ -290,6 +295,24 @@ namespace node_value_arrs */ inline double* access_temp_storage_test(const unsigned long int slot){return &TEMP_STORAGE_TEST_ARR[slot*N_SAMPLES_TEST];} + /** + * @brief Access element of temporary standardized storage array for the training data + * + * @param slot The slot of the temporary storage array + * + * @return pointer to the data stored in the specified slot + */ + inline double* access_temp_stand_storage(const unsigned long int slot){return &STANDARDIZED_STORAGE_ARR[slot*SZ_STAND_FEAT];} + + /** + * @brief Access element of temporary standardized storage array for the test data + * + * @param slot The slot of the temporary storage array + * + * @return pointer to the data stored in the specified slot + */ + inline double* access_temp_stand_storage_test(const unsigned long int slot){return &STANDARDIZED_TEST_STORAGE_ARR[slot*N_SAMPLES_TEST];} + /** * @brief Access the param storage array * @@ -367,7 +390,7 @@ namespace node_value_arrs ); /** - * @brief Get the pointer to a particular selected Node from sis + * @brief Get the pointer to a particular selected Node's data from sis * * @param ind Index of the data in the descriptor matrix * @return The pointer to the descriptor matrix's data @@ -375,7 +398,7 @@ namespace node_value_arrs inline double* get_d_matrix_ptr(const int ind){return &D_MATRIX[ind * N_SAMPLES];} /** - * @brief Get the pointer to a particular selected Node from sis + * @brief Get the pointer to a particular selected Node's data from sis * * @param ind Index of the data in the descriptor matrix * @param taskind The index for the given task @@ -383,6 +406,23 @@ namespace node_value_arrs */ inline double* get_d_matrix_ptr(const int ind, const int taskind){return &D_MATRIX[ind * N_SAMPLES + TASK_START_TRAIN[taskind]];} + /** + * @brief Get the pointer to a particular selected Node's standardized from sis + * + * @param ind Index of the data in the descriptor matrix + * @return The pointer to the descriptor matrix's standardized data + */ + inline double* get_stand_d_matrix_ptr(const int ind){return &STANDARDIZED_D_MATRIX[ind * N_SAMPLES];} + + /** + * @brief Get the pointer to a particular selected Node's standardized from sis + * + * @param ind Index of the data in the descriptor matrix + * @param taskind The index for the given task + * @return The pointer to the descriptor matrix's standardized data + */ + inline double* get_stand_d_matrix_ptr(const int ind, const int taskind){return &STANDARDIZED_D_MATRIX[ind * N_SAMPLES + TASK_START_TRAIN[taskind]];} + /** * @brief Flush the temporary storage register (training data) * @details Reset all slots in the register to -1