Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit032c93c

Browse files
committed
Changes for v.0.2.6
1 parent3dbc99e commit032c93c

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

‎DESCRIPTION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: nnlib2Rcpp
22
Type: Package
33
Title: A Tool for Creating Custom Neural Networks in C++ and using Them in R
4-
Version: 0.2.5.5
4+
Version: 0.2.5.6
55
Author: Vasilis Nikolaidis [aut, cph, cre] (<https://orcid.org/0000-0003-1471-8788>)
66
Maintainer: Vasilis Nikolaidis <v.nikolaidis@uop.gr>
77
Description: Contains a module to define neural networks from custom components and versions of Autoencoder, BP, LVQ, MAM NN.

‎src/nn_lvq.cpp‎

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -637,16 +637,35 @@ int lvq_nn::recall_class( DATA PTR input,
637637
INPUT_LAYER.input_data_from_vector(input,input_dim);
638638
recall();
639639

640-
// find which output nodeis best for input vector (has smallest distance)
640+
// find which output nodewins, i.e ishas smallest distance to input vector
641641

642642
int current_winner_pe=0;
643-
int current_winner_pe_rewards=0;
644643

645-
DATA current_win_output = OUTPUT_LAYER.PE(0).output;// this should be the distance, see lvq_output_layer::recall.
644+
// find at least one output node with requested number of rewards.
645+
646+
if(min_rewards>0)
647+
{
648+
bool found_rewarded =false;
649+
for(int i=0;i<output_dimension() AND NOT found_rewarded;i++)
650+
{
651+
if(OUTPUT_LAYER.PE(i).misc >= min_rewards)// misc in output PEs is just a counter of rewards given to the PE
652+
{
653+
current_winner_pe = i;
654+
found_rewarded =true;
655+
}
656+
}
657+
if(NOT found_rewarded)
658+
{
659+
error(NN_METHOD_ERR,"No output node has requested number of rewards");
660+
return(-1);
661+
}
662+
}
663+
664+
DATA current_win_output = OUTPUT_LAYER.PE(current_winner_pe).output;// this should be the distance, see lvq_output_layer::recall.
646665

647666
for(int i=0;i<output_dimension();i++)
648667
{
649-
OUTPUT_LAYER.PE(i).bias = LVQ_DEACTI_PE;
668+
OUTPUT_LAYER.PE(i).bias = LVQ_DEACTI_PE;// (is this really necessary?) deactivate all
650669

651670
if(OUTPUT_LAYER.PE(i).misc >= min_rewards)// misc in output PEs is just a counter of rewards given to the PE
652671
{
@@ -655,7 +674,6 @@ int lvq_nn::recall_class( DATA PTR input,
655674
{
656675
current_win_output = d;
657676
current_winner_pe = i;
658-
current_winner_pe_rewards = OUTPUT_LAYER.PE(i).misc;
659677
}
660678
}
661679
}
@@ -664,12 +682,6 @@ int lvq_nn::recall_class( DATA PTR input,
664682

665683
returned_class =
666684
(int)(current_winner_pe / m_number_of_output_nodes_per_class);
667-
668-
if(current_winner_pe_rewards<min_rewards)
669-
{
670-
error(NN_METHOD_ERR,"No winning output node had required number of rewards");
671-
returned_class = -1;
672-
}
673685
}
674686

675687
return returned_class;

‎src/nnlib2_error.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ switch(i)
9494
break;
9595

9696
case NN_METHOD_ERR:
97-
m1 ="methodfailure";
97+
m1 ="methoderror";
9898
severity=1;
9999
break;
100100

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp