Page 1 of 1

Script ETeachResult Data Structure is Defined Where?

Posted: Wed 22. Sep 2010, 19:32
by MrCreosote
Where is ETeachResult defined?

I found the Neuron and Link Data Structure definitions inline in the Edit Neurons Script Section - they were defined after script commands which used them.

However, I found ETeachResult used in the GetLastTeachResult() in the Script Teaching Section, however, there was no definition of that data structure following. In fact,

Thanks,
Tom

Re: Script ETeachResult Data Structure is Defined Where?

Posted: Wed 22. Sep 2010, 22:48
by Admin
'ETeachResult' is an enumeration rather than a data structure. It represents valid return values for the script function 'GetLastTeachResult()'.
It is described in the section 'Teaching' of the 'Script Command Reference' section in the help file (or simply use the serach tab of the help file to search for it).

The following is a copy from the help file that describes the valid enumeration constants:

TR_OK - Normal return value after a single teach step. Also returned if the user stopped the teacher manually.
TR_TARGET_NET_ERROR_REACHED - The teacher detected that the target net error has been reached during teaching.
TR_MAX_NEURONS_ADDED - The teacher reports that the maximum number of neurons has been added without the target net error being reached - Currently only supported by Cascade Correlation teacher.
TR_TEACH_ABORTED - The teach process has been aborted by the user manually.

The data structures for neurons and links can also be found in the help file, simply search for them, they are located in the Command Reference sub section 'Editing Neural Nets'.

Regards,

Re: Script ETeachResult Data Structure is Defined Where?

Posted: Thu 23. Sep 2010, 19:24
by MrCreosote
What are the Data Types?

Re: Script ETeachResult Data Structure is Defined Where?

Posted: Thu 23. Sep 2010, 21:39
by Admin
MrCreosote wrote:What are the Data Types?
Not quite sure if I understand the question...

The data type is 'ETeachResult' which is an enumeration data type. It can be any of the names values. Certainly, behind the scenes the compiler assigns some integer values to the names constants but they should not be of interest.

For example consider the following code snippet:

Code: Select all

ETeachResult result = GetLastTeachResult();

if (result == TR_OK)
{
... // do something
}
else if (result == TR_TARGET_NET_ERROR_REACHED)
{
... // do something
}
else
{
... // do something else
}



or using a switch/case statement:

Code: Select all

ETeachResult result = GetLastTeachResult();

switch (result)
{
    case TR_OK:
        // do something
        break;

    case TR_TARGET_NET_ERROR_REACHED:
        // do something
        break;

    default:
        // do something
}



Does that answer your question?

Regards