NXL2
|
Home
NEW:
US Markets Daily |
NXL2: QuickProp "C" Neural Library for Excel VBAPreliminary note:You may be able to find some so-called "no-brainer" neural software on the Internet from people who certainly mean well, or at least want to overcome fear or resistance to using artificial intelligence. The truth unfortunately is that developers of such software assume the way neural nets should be built and applied to data, and have most of the parameters hard-coded. In our opinion however, a "one-size-fits-all" neural net simply does not exist. However, being a little critical about the 'easy way out' does not mean neural nets have to be complex. The whole point of NXL is to show that with a little tuning, building a good neural net remains relatively simple and fast. If you feel you need a technical primer on neural nets,
please try
Google "Intro to Neural Nets", or try this
link.
NXL:NXL2 is a relatively simple Neural Network Library (DLL) implementing an algorithm very close to QuickProp (Prof. Scott Fahlman). QuickProp is way faster than the standard back-propagation algorithm commonly found in shareware or other low cost commercial neural network software. Its only valid competitor (among local search methods) in our opinion is RPROP from the University of Stuttgart. NXL2 is first targeted to the curious trader or any Excel/VBA programmer interested in learning more about neural nets and use them in real applications. Some basic knowledge of the mechanics of neural networks and VB programming is recommended if not necessary, however they are (sometimes deceptively) easy to build. NXL2 comes with a few neural network Excel examples using API calls to the DLL. The VBA code attached to the spreadsheet is fully commented in our Excel samples, and constitutes a good template for most neural applications: It includes the following functions: creating a new net, setting up parameters, training, saving, restoring, and execution of a neural net, which is in most cases all what we need (c.f. technical notes for more details). The only aspect left to the user-programmer's discretion is the implementation of additional custom exit conditions during training. A picture may be worth a thousand words, and this can apply to our first Excel sample spreadsheet QP2.2.xls which describes essential calls to the library and performing a mapping operation on a relatively complex non-linear function. It does a pretty good job at it (cf. Net Error and Net Output versus Actual Output pictures). This example can easily be modified to be used in trading with your favorite indicators or for any pattern detection. A typical neural net code in VB or VBA takes between 30 and 50 lines max, which can be easily derived from one of our sample spreadsheets. Not quite "cut & paste", but very easy nonetheless.
Before going any further, to get a better feel for what NXL can do, it
may be useful to just load the sample spreadsheet
now
where a neural optimization has already been run (the DLL is
not needed for this). You will see a simple data fitting exercise, with
preprocessing, neural optimisation and graphical output of the error level.
Back to QP: Our QuickProp inspired algorithm has been streamlined to run fast and is far more versatile than the original code from Prof. Falhman. It for instance includes optional weight pruning, to ensure the neural network remains as simple as possible for better generalisation. However, it must be again emphasised that all feed-forward neural nets have a tendency to keep on searching for better solutions so one or several additional exit conditions (usually called "early stopping" conditions) must be implemented. In the provided VBA code, training will stop when a predetermined number of training epochs has been reached, or when the error curve (on test data) becomes almost flat. In trading, one might not always need such a high level of accuracy to generate good data models. Some users may object that the DLL could have been compiled as an ActiveX/COM object, instead of using a plain good old C-type DLL. We are however unsure the impact an ActiveX component would have on performance, so we have so far left it in its simplest C-style form (i.e. direct shared memory access) for the time being. Such a straightforward interface makes it possible to run NXL2 from virtually any kind of client (VB/VBA/C/C++). Users can for instance develop simple data mining applications by using similar VB code in a MS Access module, and work off a DataSet instead of Excel cells. The code will also run without any modifications in a standalone VB application as well as VBScript. Shareware version vs. registered version The library will run in default demo or shareware mode. The shareware mode is fully functional with a restriction of a maximum of 15 nodes (including input and output nodes). The data file restriction in previous "demo" mode has been removed, thus making it a true shareware tool applicable to many many neural exercises. The library activation is no longer needed. Samples:QP2.2.xls is included in the setup file, or can be downloaded separately. QP2.2 is a fairly simple function mapping exercise. In such simple cases, any neural net (including your favorite 'black box') should do a good job. There is no particular selection of inputs, and noiseless training and test data do represent well the patterns embedded in your training data. Real-life applications however, particularly in trading generally do require much more attention to internal structure, training parameters and most important data preprocessing when building a solid neural model. Besides curve fitting or predictive models, neural nets can do a great job at classifying data. A classification example (based on a lithology exercise) is therefore also available. This shows the versatility of the QuickProp algorithm. For comparison purposes, the common XOR example used to benchmark neural nets for many years has also been coded with NXL2. A sample NXL2 prediction using AOL daily data is available (not included in the setup file). You will notice that the VBA code is slightly different from the original QP2.2.xls and QP3.2.xls. Stock market data is inherently more noisy, hence convergence is always more difficult to achieve. The best net is therefore saved every time a newer better net is found. In normal function mapping exercises with no or little noise, it is usually good enough to save the net after a number of epochs, or when the error level has become acceptable. In practice however, problems are more difficult to solve and the neural network will not always converge to a simple solution. One of the purposes of NXL is certainly to also highlight the difficulty of the neural modeling exercise, and you should actually never trust any neural software vendor who tells you it is easy. Building a neural net may be easy indeed, but building a sound data model with neural nets isn't. The algorithm is mathematically not too complicated, but tuning is always needed, and most important, sound data preprocessing is essential. This example does not imply the selection of inputs is here adequate. In other words, always keep in mind the well known adage: "garbage in, garbage out..." Looking for more sample problems, we came across some engineering data from the University of Texas (http://www-ue.uta.edu/eeweb/IP/training_data_files.htm). Here is an example using their first FM data sets. The only change done to data is that the output has been mapped to [-0.5;0.5] range. Input data was already preprocessed and scaled down to the same range. No change in the VB was needed to run a neural net on this data: FM.zip and results are just fine! :) January 2007: An enhanced shareware version now replaces the previous 'demo' mode, and will as of now be the standard *FREE* version of NXL2. A commercial more powerful version, including the source code will soon be available both in C and C++ (VC8). Please contact us for prices. This new shareware version is limited to 15 neurons, but has no limitation in data patterns. There is no trial period, expiry etc... it is a fully functional version only limited to small size data modeling, which should be adequate for most neural net exercises. Updated samples have now been posted for the new DLL. We might have
left a few older links here and there on the site. Older samples work with
the older lib, new samples with the new one, but they're functionally identical.
A typical error will be if you see "Can't find entry point... in DLL".
Then you know you have not installed the new DLL, or haven't downloaded the
updated samples.
July
11th 2006: July 1st 2006: NXL3 beta is available for download. It is basically the same library rewritten in VC++ for better solution scalability. June 2006: A few new accessors have been added to the library, and despite the fact that the call sequence is relatively self-explanatory, added checks now better control the odd case like for instance training a non existent network... We have slightly improved the algorithm and noticed quite some speed improvement.
We believe the occasional Underflow/Overflow errors in previous versions should no longer occur. New API declarations are available here. They can be copy/pasted straight into your VBA code. To keep things simple, we would recommend building new nets from the existing sample spreadsheets. February 2006: A XOR example spreadsheet has been posted. Please
click here to download. Related links on this site:
Current NXL2 version:The latest API version number will be published on the news page. We have jumped a few digits to version 1.99 for no other reason to make it clear the API declarations had been changed to show no aliases. However the VB code remains exactly the same, there is no new API call. There will likely be no further update on the C version, unless we see a substantial drop in performance in the C++ version (which will be NXL3). C++ will provide better scalability and therefore will likely be of more interest to power users. Price:NXL2 is now FREE. This product is targeted at beginner to intermediate VB/VBA programmers with some knowledge of neural networks. Users will benefit from learning how to better use nets in their application field. This may sound like a lot of work, but it isn't really, and is well worth the effort. Unlike most other (commercial) neural software, source code (C language) is also available for sale. The C++ version is now also available in beta stage. References:QuickProp from Prof S.Fahlman (PostScript and PDF documents available on this site) Click here for "Details and Implementation of the Algorithm" Note to current NXL users (or NXL "v1" i.e. the original version): The current version NXL2, has been recompiled for higher double precision under Visual C (previously compiled with Borland). The API format is very little changed from previous NXL but is more comprehensive. NXL "1" is now removed from the site, and we invite all
users to upgrade (at no charge), as we shall unfortunately no longer offer any technical support for it. |
Page last modified:
December 09, 2007 |