Add the power of Neural Networks to your own software. Create interactive
software, that can process the data as they arrive, record by record.
|
"Cortex API" ver.3.0 Tutorial.
A Backpropagation Neural Network API.
What is "Cortex API"?
The Cortex program comes with the SP_NN.DLL that is the core of Cortex
data processor. However this DLL expors classes instead of functions,
so to work with it you need to be a C++ programmer, and even then it is
quite inconvenient.
The Cortex API DLL solves this problem, providing a wrapper that you can
use the way most programmers do, through calls to functions exported by this DLL.
Installation.
Download the Cortex API DLL, headers and examples
archive.
Some programs that you can download from this site can work
together. If you want (strongly recommended) this kind of functionality
to be available, you should create a common folder, called (recommended)
S_PROJECTS, and to unzip all software in this folder. The sub-folders
will be created for you automatically.
When specifying options in your Winzip software, make sure that
all subdirectories (subfolders) are restored. Usually it is the default
setting
for the WinZip. Installation is complete.
On 20-May-2003, the S.Projects changed the passwords for all the
software.
If you have purchased the software before this date, we strongly advice
you to make a backup copy of the entire folder, prior to re-downloading.
Uninstallation.
Delete the folder containing the NN_API_Demo and SP_NN_API files.
Registration
If you choose to
register the Cortex API software, you will need to enter
the password (provided in the e.mail that you will receive
after the registration) into the registration prompt.
Getting started.
The following chapters will walk you through the simple example
of using the "Cortex API" Neural Networks software - we are going to
use the jaco.nn network that was created by the Cortex program.
The API itself is located at SP_NN_API directory, and the sample code
can be found in NN_API_Demo.
The sample comes with two functions (available from the "View" of the
main menu. First function loads the data file, and produces the output
file for these data. The second function does the same record by record,
so if you want to process your data as they arrive, you can use it as an
example.
The sample code is written using C++, in theory, any language that can
import DLL functions will do.
Note that in the real life situation you may want to use your own data,
and to be able to provide minimum and maximum values for the range.
Usually, it is not a problem. However in the example we used, the
.LGG file produced by the Cortex as a source of data. It means that we
don't have to produce lags, and the min/max are calculated automatically,
too. Just keep in mind, that if you don't want to load data from file,
you don't have to.
API functions
Functions are listed in NN_API.h file.
DllExport BOOL SP_NnLoad(char* strFileName, BOOL bIsPathRelative);
Loads the NN from the file. If the bIsPathRelative is TRUE, the path is expected
to be relative to the location of the executable (all DLLs and the
executable are supposed to be in the same place, in a Bin folder).
DllExport BOOL SP_FileLoader(char* strFileName, int* pnInputs, int nInputs,
BOOL bReverse);
Load the data from the file. Here is an example of the file:
Date,Open,High,Low,Close,Volume
1-Mar-02,5.20,5.29,5.15,5.16,5800
28-Feb-02,5.20,5.37,5.20,5.20,16800
27-Feb-02,5.25,5.36,5.10,5.15,57000
26-Feb-02,5.18,5.20,5.12,5.18,20800
The header (1 line) is expected, so the function is not very sophisticated.
pnInputs contains zero based number of columns. bReverse is a flag specifying
if the latest data are located first (as in the example above) and the arrays
should be reversed.
You don't have to use this function, if
you prefer to supply your own data, record by record.
DllExport BOOL SP_Normalize(int nDataSize, double dExtendRange);
Can only be used after the FileLoader(). It works with the internally stored data,
normalizing them to 0-1 range.
You don't have to use this function, if
you prefer to supply your own data, record by record.
DllExport BOOL SP_NnLoadAndApplyData(char* strFileName,
// Obtain dMin, dMax for this interval
int nNumOfLearningRecords,
double dExtendRange,
int* pnInputs, int nInputs, int* pnOutputs, int nOutputs,
int* pnLags, int nNumOfLags, BOOL bReverse);
The use of this function is shown in an example that comes with the API.
strFileName is the data file. nNumOfLearningRecords is the range (0 to
nNumOfLearningRecords - 1) that is used for normalization, it is the same range,
that was used when Cortex created the network.
You don't have to use this function, if
you prefer to supply your own data, record by record.
DllExport int SP_NnGetDataLength();
Returns the length of the data, loaded by FileLoader.
You don't have to use this function, if
you prefer to supply your own data, record by record.
DllExport int SP_NnGetDataWidth();
Returns the width (number of columns) of the data, loaded by FileLoader.
You don't have to use this function, if
you prefer to supply your own data, record by record.
DllExport double SP_NnGetData(int nRow, int nColumn);
Retrieve one value from the internal data structure.
You don't have to use this function, if
you prefer to supply your own data, record by record.
DllExport double* SP_GetMinArray();
DllExport double* SP_GetMaxArray();
Return minimums and maximums for the internally stored data. Can be used for
normalization / de-normalization.
You don't have to use this function, if
you prefer to supply your own data, record by record.
DllExport BOOL SP_NnApplyToRecord(double* pdData, int nInputs, int nOutputs);
Take a crosscut of the data (a record) and produce the NN output. The
output is written to the same array, next to inputs. Call this function in
cycle to process your data record by record.
DllExport BOOL SP_NnUnLoad()
Performs the cleanup.
Walking through the code
The code for sample functions is located in MainFrm.cpp.
OnApplyNn()
This function serves as an example of a simple case when you have data
stored in a file. The file does not include lags, NN will calculate them
for you.
First we load the NN. Then we specify the indexes for the inputs and
outputs. The file has the following format: Date,High,Low,Close,Volume.
We use the High,Low,Close and their lags (...-4, ...-5, ...-6, ...-9).
The data are in reversed order (last dates first), so we need to reverse the
arrays.
After the job is done, we export the data to the jaco.APL file.
void CMainFrame::OnApplyNn()
{
SP_NnLoad("c:\\S_Projects\\NN_API_Demo\\data\\jaco.nn", FALSE);
// Important: We have Date, Open, High, Low, Close, Volume
// First array is referencing
// Open, High, Low, Close (1, 2, 3, 4)
// The second array is referencing Close WITHIN the first
// array, so it is 3, and not 4
int pnInputs[] = { 1, 2, 3, 4 };
int pnOutputs[] = { 3 };
int pnLags[] = { 4, 5, 6, 9 };
SP_NnLoadAndApplyData(
"c:\\S_Projects\\NN_API_Demo\\data\\jaco.txt",
100, // Obtain dMin, dMax for this interval
1.0, // dExtendRange
pnInputs, 4,
pnOutputs, 1,
pnLags, 4,
TRUE // BOOL bReverse
);
FILE* file = fopen(
"c:\\S_Projects\\NN_API_Demo\\data\\jaco.apl", "wb");
if(file)
{
fputs("Date, Close, NN:Close\r\n", file);
for(int i = 0; i < SP_NnGetDataLength(); i++)
{
fprintf(file, "%d, %f, %f\r\n", i, SP_NnGetData(i, 5),
SP_NnGetData(i, SP_NnGetDataWidth() - 1));
}
fclose(file);
}
}
To build the chart of the Close vs NN:Close prediction, you can use the
last tab of the Cortex program.
OnApplyToRecords()
This is a slightly more complex task, as we need to do more work explicitly,
rather than calling the DLL function.
Note that we need to get the data from somewhere, so we take them from
the jaco.LGG file, produced by the Cortex. It makes our task simpler,
as we don't have to write data loader, normalizer, and so on. If you
want to use your own (non-file) data source, you can do it as well.
Before we start, we need to create arrays with indexes of input and
(for the reason explained below) output columns.
// ...-4, ...-5, ...-6, ...-9 for Open, High, Low,
// Close, and the last entry for the Close
int pnInputs[] = { 5, 6, 7, 10, 15, 16, 17, 20, 25,
26, 27, 30, 35, 36, 37, 40, 41 };
// Close
int pnOutputs[] = { 41 }; // or 31
// The real number of inputs NN is expecting is 16.
// We load Close to get it normalized, so that we
// know the normalization range. Later we will decrease
// the nInputs to 16.
int nInputs = 17;
int nOutputs = 1;
double dExtendRange = 1.0;
We load the NN.
SP_NnLoad("c:\\S_Projects\\NN_API_Demo\\data\\jaco.nn", FALSE)
Then we load the data file. As was mentioned too many times, it is not
a required step, we do it simply because we need to get the data from
somewhere. As we already have the loader function, we use it for the
demo purpose. In a real life situation you will compose the input array
from whatever data you want.
SP_FileLoader("c:\\S_Projects\\NN_API_Demo\\data\\jaco.lgg",
pnInputs, nInputs, FALSE);
Also note that we use the .LGG file here, that already contains lags. Again,
in the real life it is up to you to create lag arrays, to normalize them and so on.
Here is the list of headers for the .LGG file we use, with column numbers, it will
be used in "inputs" and "outputs":
No(0),Open(1),Open-1(2),Open-2(3),Open-3(4),Open-4(5),Open-5(6),Open-6(7),
Open-7(8),Open-8(9),Open-9(10),High(11),High-1(12),High-2(13),High-3(14),High-4(15),
High-5(16),High-6(17),High-7(18),High-8(19),High-9(20),Low(21),Low-1(22),Low-2(23),
Low-3(24),Low-4(25),Low-5(26),Low-6(27),Low-7(28),Low-8(29),Low-9(30),Close(31),
Close-1(32),Close-2(33),Close-3(34),Close-4(35),Close-5(36),Close-6(37),Close-7(38),
Close-8(39),Close-9(40),Close(41)
The NN we use in this example was trained using ...-4, ...-5, ...-6, ...-9 as
inputs, and Close as the output. This is exactly what we need to supply,
otherwise the output fill be wrong.
Once again: we only load data file to have some data source. You don't
have to load the data file, and can use any data source, record by record.
Note that bReverse is FALSE, as our lag file is already reversed.
Then we need to normalize the data to the 0 - 1 range. Again, as this is
just an example, we cheat. The FileLoader function loads the data in the
internal data structure, that you can only access through SP_NnGetDataLength,
SP_NnGetDataWidth and SP_NnGetData functions. The Normalize function will
normalize the data in this internal structure.
If we load the data using the FileLoader function, we can simply call the DLL's
Normalize function:
Normalize(100 /*nNumOfLearningRecords*/, dExtendRange);
On the next step we create an array pdData, with one number for each input column.
We copy the input data there and we feed this input array (a crosscut of the input
arrays, a record) to the NN. The output data are copied to the end of the pdData
array, after the inputs, so you must allocate enough space.
double* pdData = new double[nInputs + nOutputs];
After the NN produced output data, we need to de-normalize it. We have a choice.
First of all, it you feed your data (without cheating, as we do), you are supposed
to normalize them yourself, and therefore, you know the max and min of the data.
In case you do it the way we did here, you can call DLL function to find the
min and max stored during the normalization.
Important: the SP_NnGetData, GetMinArray and GetMaxArray functions return arrays of
minimums and maximums for the LOADED data, therefore to access the individual
values we need to use the index of the LOADED data. For example, the Close
(41 in data file) can be accessed by index 16. This is the ONLY reason we
included 41 (Close) as the last input in the list of inputs - to get it loaded
and normalized, so that we can get its max and min. After we did it, we
reduced the nInputs (nInputs--), so that all further processing ignores the Close.
If we did it without "cheating", we would have to write our own function to obtain
data arrays, to calculate max and min, and to normalize the data. Then
we would go straight to SP_NnApplyToRecord. However, if we work with the file
in the appropriate format, as the functions are already in the DLL, why not
to use them?
double* dMinArray = SP_GetMinArray();
double* dMaxArray = SP_GetMaxArray();
We fill the array (the record) that we will feed to the network:
for(int j = 0; j < nInputs; j++)
pdData[j] = SP_NnGetData(i, j);
And we process all records in cycle. As we obtain the data, we write it to
the output file:
if(SP_NnApplyToRecord(pdData, nInputs, nOutputs))
fprintf(file, "%d, %f, %f\r\n",
i,
SP_NnGetData(i, 16) * (dMaxArray[16] - dMinArray[16])
+ dMinArray[16],
pdData[16] * (dMaxArray[16] - dMinArray[16])
+ dMinArray[16]);
A complete listing of the sample function comes with an archive.
To get fully enabled version of the Cortex API, you need
to
register.
And do not forget about the navigation bar at the bottom of the
page - it will take you to other pages, some of them using neural
networks, and all of them facinating ;)
|
|
|
|
Neural Networks
Neural networks are modelled after the brain (not necessarily a human brain)
and provide the learning algorythm that does not require any knowkedges
of the formulas for the process being researched, instead, it is based on
the familiarity and pattern recognition.
data mining
The neural networks have unique ability to extract the relevant information
from the noisy and incomplete data. In terms of machine learning,
it is a valuable feature.
machine learning
The machine learning using the neural networks consists of two
stages (repeated many times). First, we present the system with the input
data and obtain the output. Second, we adjust the system, to make output closer to
what it should be.
The first stage is refered as feedforward, the second - as a backpropagation.
neural net methodology
On this site you will find free tutorial, covering basics of the
Feedforward Backpropagation neural networks.
knowledge discovery
Knowledge based algorythms are often considered as something opposite to
the data based algorythms. However, the Neural Networks
are both - they store the information, as a internal structure of a
network, making possible to recognize the patterns, including those, that
the system never seen before.
speech recognition neural networks
The recognition of speech is an example of the problem that neural
networks can solve. The patterns are noisy, they are different from time to
time and from person to person, and they are not presented in a form that can
be used by algorythm based programs.
Stock market neurals network
There are endless discussions on stock market prediction using neural
networks, and the argument are pretty much the same as in discussions about
the technical analysis in general.
Neural networks can be used to predict the stock price, to a reasonable
extent, they are valuab;e part of modern automated trading systems.
neural networks extrapolation
Neural Networks can work with the data they never seen before, and
therefore, can be used for extrapolation. The problem appears when the data go
outside the range for which the network was trained. There are tips,
described in neural networks introduction
to handle this problem.
neural networks stock prediction
The Cortex neural networks software that you can download
from this site comes with the network trained to predict the price of a stock.
Usually, this kind of networks are working well only for limited time range,
and have to re re-trained to handle new data.
neural networks download
Download the Cortex neural networks software
from this site.
free neural networks software
The Cortex neural networks software is feature limited,
however you can use even a free version to solve many practical tasks.
neural networks introduction
A free introduction to neural networks is
available on this site. It explains the algorythm of the so called
Feedforward Backpropagation networks, the most commonly used and
probably the most powerfull.
tutorial on neural networks
On this site you will find both the tutorial on the neural nets and the
user guide for the Cortex program, the easy to use and powerfull
neural networks software.
neural networks book
Check out our list of recommended books of
Neural Networks and related subjects of data mining.
neural network course
The Introduction to Neural Networks,
available from this site, is a good (and free) start, if you want to learn the
algorythms of Feedforward Backpropagation neural networks.
Feedforward
The word Feedforward stands for the first stage of the Neural
Network learning process, when the system is presented with the input data.
Backpropagation
The word Backpropagation stands for the second stage of the
Neural Network learning process, when the system is adjusted, to make
its output closer to what it should be.
network neural type
There are few types of Neural Networks and many variations of the
types. On this site you will find the information and software
on Feedforward Backpropagation Neural Networks.
neural network free software
Download and try the Cortex program, the easy to use and powerfull
neural networks software.
invest network neural
The neural networks are used in the investment analysis, particularly
in the stock prediction. The Neural Networks tutorial, available
from this site, has an example of such a network.
fuzzy network neural
Fuzzy logic deals with the rules taht are flexible or not constant.
That is exactly how the Neural Network works, by recognizing
"fuzzy", noisy or incomplete data.
stock market neural network
The Cortex neural networks software works with stock
data as with any other data. The Trader
stock trading simulator can use these neural networks to generate trading signals.
feed forward network neural
The Feedforward stage of Neural Network algorythm takes the
input data and presents it to the first layer of the neurons. The output
of the first layer is presented to the second layer, and so on.
trend data mining
Knowing the current trend provides us with some ability to predict the future
price change. It is possible to use Neural Networks for this task.
Alternatively, check out the Trader
stock trading simulator.
basics data mining
Using some kind of tools to extract data, satisfying to some criteria, from
the large amount of raw data.
stock data mining
Using the Neural Networks you can detect tendencies in a stock price,
even if they are small or hidden. It requires some work on the side of
data preparation.
data knowledge mining
The Neural Networks can be used to filter the data, in order to
extract the relevant data.
advantage data mining
See the list of recommended books
neural network book
See the list of recommended books for a list of the
most relevant books on Neural Networks and related totics.
neural network tool box
The Cortex neural networks software provides you with the
easy to use interface, allowing to create, teach and use the Neural Networks
with your data.
neural network financial
The algorythm can be used in any area, where the data can be presented in a
tabular form.
data mining article
See the list of recommended books
data mining neural network
As the computer systems become faster, the value of the NN as the data
mining tool will only increase.
future neural network
The ability ot the Neural Networks to predict the future is limeted,
as one can expect, to the common sence. For example, if the way the market
is treating the stock changes, the old network may become useless, and
a new one will have to be trained, using new data.
data mining case study
See the list of recommended books for the data mining
tutorials and case studies.
algorithm backpropagation
During the Backpropagation stage of the neural network training,
the output layer of neurons is adjusted, to make the output closer to
what it need to be. Then the layer before is adjusted, based on the
adjusted last layer and so on.
application data mining
The Cortex neural networks software can be used
to create the neural networks, that can become part of the custom
data mining tools.
data mining example
See the list of recommended books for the data mining
tutorials and examples.
neural network artificial intelligence
Neural Networks are considered important step in our understanding of the
way human brain works.
data mining papers
As large amounts of data are usually processed during the data mining, the
neural networks applications may become the bottle neck. The hardware
is available to make it fast, as a mater of fact, hardware based NN are
fast enough for almost any task.
network neural programming
The software that you find on this site allows seamless neural
network programming, it includes both creating neural networks and
teaching them using the feedforward backpropagation algorythm.
stock neural network
One of the most demanded areas of the neural networks prediction is
predicting stock prices, as this task is one of the most
difficult to formalize, and neural networks do not require
the formal task description.
fuzzy network neural
To some extent, neural networks DO implement fuzzy logic, as they can
produce results, that are close to correct ones, based on samples,
that are close to familiar ones.
boosting data mining
Data mining can be boosted, in some cases, by applying neural network
algorythms. It may involve predicting optimal ways to a place,
where the information is located, rather than brutal search,
however, this approach shouls be used with caution, as with neural
networks, there is always a risk of finding a local minimum
solution, instead of a global one.
neural network free software
On this site, you will find a feature-limited free trial version of the
software.
stock market neural network
Stock market predictions are not as easy, as people usually think.
One of the most important reasons for this to be true is the
way data are organized. Generally, we need to know exactly what
we use as an input and what we are expecting as an output, rather
than feeding the network the raw data, hoping to get meaningfull
results.
invest network neural
Before investing your time in the solution, based on neural networks,
do a homework to figure out, what the exact nature of a task is.
The nn can do anything, but WHAT to do - this is a human's decision.
data decision mining tree
As in any decision making process, there may be a way to speed up
the data decision tree crawling, by applying the neural network
algorythms.
bots data mining
As for the data mining bots, the use of neural networks is limited,
if any. There is, of course, always a chance of adopting a new technology
in a new way.
data mining benefit
The main benefit of data mining approach is in reducing the dimension of
a task, making it more manageable, and less complex. Often, most
important moving forces are hidden behind the scene, and neural
networks are very good in finding them.
data mining resume
What is he data mining? Looking up for the relevant information in a large
multidimentional data continuum, with little, if any, advance knowlege
of the dependencies the data have.
neural network financial
Financial area is one where neural computations are used heavily. There
are many areas where they provide signifficant help, and some areas,
where they are the only solution.
neural network book
There are many books on the general neural networks theory available at
Amazon, as well as few articles on this site, both general-purpose
basic introductions, and specialized ones.
data mining article
There are many data mining articles and books, available in
the Internet.
data mining neural network
The importance of neural networks in data mining is in their ability
to find non-evident dependencies, thereby reducing dimension and
increasing the quality of an answer.
data mining storage
As data mining storage, the object databases of hypercubes are often used.
data mining job
Neural networks can be used as a part of a data mining software. Their
job in this tast may differ from identifiying binary or stored in tables
data patterns, to suggesting the most promicing approach to a search.
data data mining mining
As a data mining algorythm per se, neural computations are just a tool.
Using it depends on the person, specifying the mining algorythms.
data mining case study
To get a better idea of possible scenarios of data mining usage, we suggest
performing the search in the Internet.
data mining warehouse
Data mining warehouses often use their own software, optimized,
depending of the task it performs. For example, in face
recognition, neural networks can be used, as a low level
algorythm, while the generic database is used to store and
maintain records.
algorithm backpropagation
Backpropagation algorythm is one of the most promicing. It uses
the data pattern (so called supervised learning) to compute
the signal (during the feedforward part of
the learning), and then uses the error, to adjust the
weights of the neurons (during the backpropagation part).
data mining concept
The overall concept of the data mining is based on the assumption,
that the multi dimensional data continuum can be cross-cut
by the (again - multi dimensional) surface, and that the
intersection will contain a result we are after.
neural stock
As a demonstration of the complexity of the stock trading using neural
networks, we provided, on this site, a simple article, that
is attempting to do a small case study, examining the pitfalls of
the task, as they arrive.
application data mining
"Cortex", the neural networks package, may, to some extent, be considered
as a data mining tool.
data mining definition
Data mining requires the search (mining) algorythm to be provided,
without such definition, it will not be usefull. Here, you will
find a small article about stock price prediction. We start with
a simple (and incorrect) task, and arrive to a more or less
correct one.
data mining example
In that example (see the previous paragraph), it is interesting to mention,
that in order to solve the problem, we had to re-state it. Indeed,
we do not care about the stock price, we need trading signals instead!
neural network artificial intelligence
Some most promicing solutions in the area of artifficial
intelligence use neural networks. This is not surprising, as
the very idea of neural networks is copied from the structure of
brain.
data mining papers, data mining sas
Data mining information is available online, both
as whitepapers, articles and reviews.
fuzzy neural system
Neural networks do implement some kind of the fuzzy
logic, though it is not the fuzzy logic as it is
formally defined.
classification data mining
Classification is another area, where neural networks shine.
It is possible to write both supervised classification
software, for example, using feedforward backpropagation
algorythms, and not-superwised automatic classification,
where the network will break the data into the cetegories.
neural network for pattern recognition
Pattern recognition is one of the most important areas of
neural networks application. The pattern may be provided as
a text or binary (sound, image) sequence, and similarity
between it and previously seen patterns used for
classification.
data mining tutorial
This site is not intended as the data mining tutorial,
except for a small subset, related to neural networks.
You can find all the necessary information in the Internet.
neural network tutorial
On this site, you will find few tutorials, covering
different aspects of the neural computations. First,
these are introductions, and second, in-depth stock
and FOREX trading.
data mining training
The most important - and the most confusing - part of
the data mining using neural networks, is not in thaining
itself, but in defining the algorythms, inputs and
outputs, as well as finding the inner logic in data.
introduction to neural network
The articles on this site may be used as a good basic introduction
to neural network computations.
data mining multimedia
When data mining is performed on a database, using the
criteria that are not part of the index, neural networks can be
used to do a recognition task. It is particularly true
with analog, multimedia records.
introduction data mining
For an introductory data mining information,
the best source is probably the Amazon book collection.
data mining on the web
To perform data mining on the web, we can use so called
bots. Collected information can then be treated as any
database, and data mining applies, as always. Also,
the neural networks may be used to figure out ways of
accelerating the web crawling.
neural network computer
To perform neural network computation faster, high degree
of parallelism is required, ideally, every neuron should
have its own thread. To implement it, special hardware
exists, called neuristors.
data mining internet
The Internet is a very promicing media for data mining.
As the mater of fact, the very nature of the Internet,
created by people, and therefore, structured according
to some intelligent logic, allows us to look for
hidden important dependencies in it. For example, Google
uses this approach to find "true meaning" of words and
even phrases.
data mining conference
There are many, happening online and offline.
data mining course
There are many, happening online and offline.
neural network hardware
As was mentioned above, some very fast chips are available
for neural computations.
matlab neural network
Matlab is one of the general purpose applications,
that inclused neural networks block.
data mining data warehouse
Data warehouse software (used for data mining against large
data arrays) is available off-the-shelf (do an online research).
business intelligence data mining
The term "business intelligence" is not strict enough.
The data mininng can be performed to improve business, and yes,
neural networks can be part of it.
|
|
|