Skip to content
Snippets Groups Projects
Commit c25c2c71 authored by Martin Beseda's avatar Martin Beseda
Browse files

MERGE with kra568/tmp

parents 4221f729 ffa9d07d
No related branches found
No related tags found
No related merge requests found
...@@ -285,6 +285,7 @@ namespace lib4neuro { ...@@ -285,6 +285,7 @@ namespace lib4neuro {
} }
void DataSet::normalize() { void DataSet::normalize() {
this->normalized = false;
if(!this->normalization_strategy) { if(!this->normalization_strategy) {
THROW_INVALID_ARGUMENT_ERROR("There is no normalization strategy given for this data set, so it can not be " THROW_INVALID_ARGUMENT_ERROR("There is no normalization strategy given for this data set, so it can not be "
"normalized!"); "normalized!");
...@@ -333,10 +334,17 @@ namespace lib4neuro { ...@@ -333,10 +334,17 @@ namespace lib4neuro {
} }
} }
// this->normalized = true; this->normalized = true;
} }
double DataSet::get_normalized_value(double val){
if(!this->normalized || !this->normalization_strategy) {
return val;
}
return this->normalization_strategy->normalize(val, this->max_min_inp_val.at(0), this->max_min_inp_val.at(1));
}
void DataSet::get_input(std::vector<double> &d, size_t idx){ void DataSet::get_input(std::vector<double> &d, size_t idx){
assert(d.size() == this->data[idx].first.size()); assert(d.size() == this->data[idx].first.size());
for (size_t j = 0; j < this->data[idx].first.size(); ++j) { for (size_t j = 0; j < this->data[idx].first.size(); ++j) {
......
...@@ -51,6 +51,8 @@ namespace lib4neuro { ...@@ -51,6 +51,8 @@ namespace lib4neuro {
// */ // */
// double min_inp_val = std::numeric_limits<double>::quiet_NaN(); // double min_inp_val = std::numeric_limits<double>::quiet_NaN();
bool normalized = false;
/** /**
* Maximum (index 0) and minimum (index 1) input value * Maximum (index 0) and minimum (index 1) input value
*/ */
...@@ -233,6 +235,13 @@ namespace lib4neuro { ...@@ -233,6 +235,13 @@ namespace lib4neuro {
*/ */
LIB4NEURO_API void normalize(); LIB4NEURO_API void normalize();
/**
* returns the normalized value of @val
* @param val
* @return
*/
LIB4NEURO_API double get_normalized_value(double val);
/** /**
* Denormalizes the data set * Denormalizes the data set
*/ */
......
...@@ -506,7 +506,7 @@ namespace lib4neuro { ...@@ -506,7 +506,7 @@ namespace lib4neuro {
return this->connection_list->size() - 1; return this->connection_list->size() - 1;
} }
void size_t
NeuralNetwork::add_connection_constant(size_t n1_idx, size_t n2_idx, double weight) { NeuralNetwork::add_connection_constant(size_t n1_idx, size_t n2_idx, double weight) {
ConnectionFunctionConstant *con_weight_u1u2 = new ConnectionFunctionConstant( weight ); ConnectionFunctionConstant *con_weight_u1u2 = new ConnectionFunctionConstant( weight );
...@@ -517,6 +517,8 @@ namespace lib4neuro { ...@@ -517,6 +517,8 @@ namespace lib4neuro {
this->add_inward_connection(n2_idx, n1_idx, conn_idx); this->add_inward_connection(n2_idx, n1_idx, conn_idx);
this->layers_analyzed = false; this->layers_analyzed = false;
return conn_idx;
} }
void NeuralNetwork::add_existing_connection(size_t n1_idx, size_t n2_idx, size_t connection_idx, void NeuralNetwork::add_existing_connection(size_t n1_idx, size_t n2_idx, size_t connection_idx,
......
...@@ -279,7 +279,7 @@ namespace lib4neuro { ...@@ -279,7 +279,7 @@ namespace lib4neuro {
* @param n2_idx * @param n2_idx
* @param weight * @param weight
*/ */
LIB4NEURO_API void add_connection_constant(size_t n1_idx, size_t n2_idx, double weight); LIB4NEURO_API size_t add_connection_constant(size_t n1_idx, size_t n2_idx, double weight);
/** /**
* Take the existing connection with index 'connection_idx' in 'parent_network' and adds it to the structure of this * Take the existing connection with index 'connection_idx' in 'parent_network' and adds it to the structure of this
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment