Processing Files Through a Trained Network

Processing Files Through a Trained Network

Top  Previous  Next

 

Once you have trained a network, you will want to apply the network to new data that was not included in the training process.  There are several methods you may use to get answers from a trained network.

 

1.  Add more rows of data to an existing .PAT file.

The data does not need to include actual output values.  Once the data has been added, simply click on the Apply module and process the file as you normally would.  The network’s answers may be viewed in the Examine Data module.

 

2.  Create a new data file

A.  The file may be created in either the NeuroShell 2 Datagrid or in a spreadsheet program.  If the file is created in a spreadsheet program, use the Spreadsheet File Import module.

 

B.  The file must have the same columns in the same order as the PROBLEM.PAT file.  The file does not have to include values for the output columns.

 

C.  The file must have the same name as the NeuroShell 2 problem.  NeuroShell 2 defaults to using a .PRO file extension for new data files.  Other extensions may be used, however, so that you may apply the trained network to more than one file.

 

D.  The data in the file should fall within the same minimum and maximum values for each column that were in the PROBLEM.PAT file.  You should NOT recompute minimum and maximum values in the Define Inputs/Outputs module.  (If the values in the new data file are significantly out of range of the values in the PROBLEM.PAT file, the network should be retrained with patterns that include the new values.)

 

E.  Apply the Trained Network

(1)  Beginner’s System

(a)  Select the Apply module.

 

(b)  From the File Menu, use the Select Alternate Pattern File option and select the new data file.

 

(c)  From the Run Menu, select the Begin Processing option.  Once processing is completed, a PROBLEM.OUT file is created that contains the network’s answers.  The file may be viewed in the Examine Data module.

 

(2)  Advanced System

(a)  From the Advanced System window, select the Options Menu and then select the Production option.  This causes the modules in the Advanced System to default to using a .PRO file rather than a .PAT file.

 

(b) Select the Apply Module to process the new data through the trained network.

 

3. Call the trained network from a programming language with the DLL server.

Once you train a neural network in NeuroShell 2, the DLL Server in the Runtime module gives you the means of saving the network in a .DEF file so it can later be accessed via the NS2-32.DLL.  Execution of a trained network is simply the process of feeding an array of inputs to the network and receiving back the appropriate array of outputs.  The DLL may be called from programming languages such as Visual Basic or C that can call double precision floating point arrays and pass arguments by reference (pointers).  Refer to DLL Server, for details.

 

4. Call the Predict function in Excel.

Once you have generated a .DEF file for a trained network using the DLL Server in the Runtime module, you may compute the network’s answer by calling the Predict function in a cell in an Excel spreadsheet.  Refer to the section Calling the DLL Functions from Microsoft Excel on the DLL Server - Detail help page for details.

 

5.  Use the Source Code Generator

The source code generator was designed to provide computer code to execute small or medium sized networks you build with NeuroShell 2.  It can be used for large networks, but you will probably have to do a little custom work to get the code running, because many compilers will fail to compile the large amount of code it could generate.

 

If you want to execute your networks from programs written to run on Microsoft Windows, then you should not use the source code generator; it is much easier and faster to call the FireNet function in our Dynamic Link Library (DLL).  Refer to DLL Server, for more information on calling the DLL.

 

If, however, you want to be able to call (fire) your network from a DOS program, a workstation, a mainframe, or some special purpose processor, the source code generator is appropriate for you.  The source code it generates is very generic, entirely self contained, and does not contain any library calls or sophisticated constructs.

 

The source code generator will generate code in C, Microsoft Visual Basic, or a very generic language we call "formulas for a calculator".  For details, refer to Source Code Generator.