本文整理汇总了C++中TrainingSet::train方法的典型用法代码示例。如果您正苦于以下问题:C++ TrainingSet::train方法的具体用法?C++ TrainingSet::train怎么用?C++ TrainingSet::train使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrainingSet
的用法示例。
在下文中一共展示了TrainingSet::train方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WinMain
//*******************************************************************
// WinMain - Neural main
//
// parameters:
// hInstance - The instance of this instance of this
// application.
// hPrevInstance - The instance of the previous instance
// of this application. This will be 0
// if this is the first instance.
// lpszCmdLine - A long pointer to the command line that
// started this application.
// cmdShow - Indicates how the window is to be shown
// initially. ie. SW_SHOWNORMAL, SW_HIDE,
// SW_MIMIMIZE.
//
// returns:
// wParam from last message.
//
//*******************************************************************
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int cmdShow)
{
/*
Declarations of local variables
*/
int control_file_number = -1 ; // Stack pointer for control files
FILE *control_files[MAX_CONTROL_FILES] ; // This is the stack
char *control_line ; // User's commands here
char *command, *rest ; // Pointers to its command and parameter parts
int n_command, n_rest ; // Lengths of those parts
int net_model = -1 ; // Network model (see NETMOD_? in CONST.H)
int out_model = -1 ; // Output model (see OUTMOD_? in CONST.H)
int n_inputs = -1 ; // Number of input neurons
int n_outputs = -1 ; // Number of output neurons
int n_hidden1 = -1 ; // Number of hidden layer one neurons
int n_hidden2 = -1 ; // Ditto layer 2 (0 if just one hidden layer)
TrainingSet *tset = NULL ; // Training set here
Network *network = NULL ; // Network here
struct LearnParams learn_params ; // General learning parameters
struct AnnealParams anneal_params ; // Simulated annealing parameters
struct GenInitParams geninit_params ; // Genetic initialization parameters
struct KohParams koh_params ; // Kohonen parameters
int classif_output = -1 ; // Current class (0=reject) for classif training
char out_file[80] = "" ; // File for EXECUTE output
float threshold ; // CLASSIFY confusion reject cutoff
char resp_file[80]=""; // file for initializing output neuron's name
char train_file[80]="";
/*
Miscellaneous variables
*/
int i, n, m ;
float p ;
char *msg ;
FILE *fp ;
unsigned long me,mc;
char *fname;
char *control;
#if VERSION_16_BIT
if (sizeof(int) > 2) {
printf ( "\nRecompile with VERSION_16_BIT set to 0 in CONST.H" ) ;
exit ( 1 ) ;
}
#else
if (sizeof(int) < 4) {
printf ( "\nRecompile with VERSION_16_BIT set to 1 in CONST.H" ) ;
exit ( 1 ) ;
}
#endif
printf ( "\nNEURAL SYSTEM - Program to train and test neural networks" ) ;
if (argc>1)
{
strcpy(fname,argv[1]);
}
/*
Process command line parameters
*/
mem_name[0] = 0 ; // Default is no memory allocation file
/*
if (strlen ( mem_name )) {
strcat ( mem_name , ":mem.log" ) ;
fp = fopen ( mem_name , "wt" ) ;
if (fp == NULL) {
printf ( "\nCannot open debugging file %s", mem_name ) ;
exit ( 1 ) ;
//.........这里部分代码省略.........
示例2: main
int main (
int argc , // Number of command line arguments (includes prog name)
char *argv[] // Arguments (prog name is argv[0])
)
{
/*
Declarations of local variables
*/
/*
User's command control line related variables are here.
Control_file_number and control_files permit nesting of 'CONTROL' commands.
If control_file_number equals -1, control commands are read from stdin.
Otherwise they are read from that file in FILE *control_files.
Up to MAX_CONTROL_FILES can be stacked.
*/
int control_file_number = -1 ; // Stack pointer for control files
FILE *control_files[MAX_CONTROL_FILES] ; // This is the stack
char *control_line ; // User's commands here
char *command, *rest ; // Pointers to its command and parameter parts
int n_command, n_rest ; // Lengths of those parts
/*
These are network parameters which may be set by the user via commands.
They are initialized to defaults which indicate that the user has not
yet set them. As they are set, their current values are placed here.
When learning is done for a network, their values are copied from here
into the network object. When a network is read, the object's values
are copied from it to here. Otherwise, these variables are not used;
the values in the network object itself are used. The only purpose of
these variables is to keep track of current values.
*/
int net_model = -1 ; // Network model (see NETMOD_? in CONST.H)
int out_model = -1 ; // Output model (see OUTMOD_? in CONST.H)
int n_inputs = -1 ; // Number of input neurons
int n_outputs = -1 ; // Number of output neurons
int n_hidden1 = -1 ; // Number of hidden layer one neurons
int n_hidden2 = -1 ; // Ditto layer 2 (0 if just one hidden layer)
TrainingSet *tset = NULL ; // Training set here
Network *network = NULL ; // Network here
struct LearnParams learn_params ; // General learning parameters
struct AnnealParams anneal_params ; // Simulated annealing parameters
struct GenInitParams geninit_params ; // Genetic initialization parameters
struct KohParams koh_params ; // Kohonen parameters
int classif_output = -1 ; // Current class (0=reject) for classif training
char out_file[80] = "" ; // File for EXECUTE output
double threshold ; // CLASSIFY confusion reject cutoff
/*
Miscellaneous variables
*/
int i, n, m ;
double p ;
char *msg ;
FILE *fp ;
/*
--------------------------------------------------------------------------------
Program starts here.
Verify that a careless user didn't fail to set the integer size
correctly when compiling.
--------------------------------------------------------------------------------
*/
#if VERSION_16_BIT
if (sizeof(int) > 2) {
printf ( "\nRecompile with VERSION_16_BIT set to 0 in CONST.H" ) ;
exit ( 1 ) ;
}
#else
if (sizeof(int) < 4) {
printf ( "\nRecompile with VERSION_16_BIT set to 1 in CONST.H" ) ;
exit ( 1 ) ;
}
#endif
printf ( "\nNEURAL - Program to train and test neural networks" ) ;
printf("\nCopyright (c) 1993 by Academic Press, Inc.");
printf("\nAll rights reserved. Permission is hereby granted, until further notice,");
printf("\nto make copies of this diskette, which are not for resale, provided these");
printf("\ncopies are made from this master diskette only, and provided that the");
printf("\nfollowing copyright notice appears on the diskette label:");
printf("\n(c) 1993 by Academic Press, Inc.");
printf("\nExcept as previously stated, no part of the computer program embodied in");
printf("\nthis diskette may be reproduced or transmitted in any form or by any means,");
printf("\nelectronic or mechanical, including input into storage in any information");
printf("\nsystem for resale, without permission in writing from the publisher.");
printf("\nProduced in the United States of America.");
//.........这里部分代码省略.........