Sunday, November 27, 2005

Cumulative Normal Distribution Function

The cumulative normal distribution function is actually an integral formula. There is no explicit closed form solution. A good approximation can be found at Milton Abramowiz and Irene A Stegun. Handbook of Mathematical Functions. National Bureau of Standards, 1964.

The following code is a java function for calculating the cumulative normal distribution.

public double CNDF(double z)
{
double mean = calculateMean();
double sd = calculateSD();
z = z - mean;
if (z> 6.0) return 1.0;
if (z<-6.0) return 0;
double b1 = 0.31938153;
double b2 = -0.356563782;
double b3 = 1.781477937;
double b4 = -1.821255978;
double b5 = 1.330274429;
double p = 0.2316419;
double c2 = 0.3989423;
double a = Math.abs(z);
double t = 1.0/(1.0 + a*p);
double b = c2 * Math.exp((-z)*(z/2.0));
double n = ((((b5 * t + b4)*t+b3)*t+b2)*t+b1)*t;
n = 1.0 - b*n;
if (z<0.0) n = 1.0 - n;
return n;
}

Normality Testing

There are many algorithms for testing the normality of a data set.
Some of the tests include:

1. Kolmogorov-Smirnov test
2. Lilliefors test
3. Shapiro-Wilks’ W test

Shapiro-Wilks test seems to the best because of its good power properties. But, Kolmogorov-Smirnov test is easier to implement.

Tuesday, November 22, 2005

NSF grant proposal: Organization

I found Expert Opinon's link useful and interesting.

Monday, November 21, 2005

CLASSPATH

I have worked only on C# for the past one year. Today, I got a chance to work on my favorite programming language, Java. I always forget to set the CLASSPATH after I install Java SDK. This solved a lot of issues.

Wednesday, November 16, 2005

Types of output

Binary classification problem - A learning problem with binary outputs
Multi-class classification problem - A learning problem with finite number of categories
Regression - A learning problem with real-valued outputs

Monday, November 14, 2005

Report

The report that I would recommend in a typical NN experiment can be divided into the following sections:

  1. Objective of the experiment
  2. Data description - Preprocessing of the data (if any)
  3. Architecture of the Neural Network used
  4. Pseudo code
  5. Results
  6. Discussion
  7. Conclusion
  8. Matlab code as an appendix

Sunday, November 13, 2005

Matlab script

I used this MATLAB script using Neural Network toolbox. The important features were selected based on a threshold.



clear all;
P = load('train1.txt');
T = load('trainout1.txt');
Ps = load('test1.txt');
Ts = load('testout1.txt');
Net = newff(minmax(P), [300, 200, 150, 1], {'logsig', 'logsig', 'logsig', 'logsig'}, 'trainscg' );
Net.trainParam.epochs = 1000;
Net.trainParam.goal = 0.0001;
[Net_t, TR] = train(Net,P,T);
y = sim(Net_t,Ps);
% figure
x=[1:37]; % to draw the x axis values
efficiency = 1 - (sum(abs(round(y)-Ts)))/37;
efficiency
% plot(x, y, 'bo--', x, Ts, 'r*-');
% legend('network','actual');

% Selection of Features
Threshold = 0.90;
for i=1:300
disp 'Current Iteration'
disp(i)
FP = P;
FPs = Ps;
FP(i,:) = [];
FPs(i,:) = [];
Net = newff(minmax(FP), [299, 200, 150, 1], {'logsig', 'logsig', 'logsig', 'logsig'}, 'trainscg' );
Net.trainParam.epochs = 1000;
Net.trainParam.goal = 0.0001;
[Net_t, TR] = train(Net,FP,T);
y = sim(Net_t,FPs);
efficiency = 1 - (sum(abs(round(y)-Ts)))/37;
disp(efficiency);
if (efficiency < Threshold)
disp(i)
disp(' is an Important Feature');
end
end

Thursday, October 20, 2005

Red-Black Trees

I found an interesting website for object oriented programming and other computer science concepts. I added OOPWEB.com in the links section also.

Cormen, p269 has the pseudocode for inserting a node in the Red-Black Tree. The else part in the pseudocode has been left out. I have made an attempt to write the else part as follows:

If p[x] = right[p[p[x]]]
Then y <- left[p[p[x]]]
If color[y] = RED
Then color[p[x]] <- BLACK
Color[y] <- BLACK
Color[p[p[x]]] <- RED
X <- p[p[x]]
Else if x = left[p[x]]
Then x<- p[x]
RIGHT-ROTATE(T,x)
Color[p[x]] <- BLACK
Color[p[p[x]] <- RED
LEFT-ROTATE(T, p[p[x]])


Thursday, September 08, 2005

Random numbers with normal distribution

It is easy to create them with excel. Tools -> Data Analysis -> Random Number Generation.

Tuesday, September 06, 2005

What is model based design?

Sunday, August 21, 2005

Tuesday, August 09, 2005

Power Trading

I made a copy of chapter 11 from Investment Science. I have to read that chapter to use the wiener and ito's model for creating prices.

Also, I have to incorporate type I, type II, and neural networks into the agents in the software.

Tuesday, August 02, 2005

Alchemi [.NET Grid Computing Framework]

This might be useful for me to test my program in a grid computing environment.

Alchemi [.NET Grid Computing Framework]: "can be behind firewalls and NAT servers.
Only idle CPU time of machines on the grid is used; user programs are not impacted."

Grid computing

One of my friend was asking about grid computing. I suggested him to do the following:

  1. Get some spare computers from GSA.
  2. Set up a grid.
  3. Install Globus toolkit.
  4. Run a set of examples and see what happens.

I asked him to spare 3 hours everyday and set up the basic infrastructure. I explained him to then publicize his grid and encourage other people to execute their applications on his grid. This will help both the parties and will also validate and publicize his project. He can also provide motivation to the undergraduate and graduate students of cross-disciplinary nature.

I hope he succeeds in his endeavors.

This is the email that I sent to him:


See this website:http://www.private-grid.nl/
Some group in Netherlands is providing a 10 machine
grid for free. They are offering people to sign up and run their applications
for free.

This is a very good way to validate your grid and
publicize. This will not only help you academically and politically, but
also boost your confidence when you talk about it. You can start
something similar to this and add manpower, thus enhancing your
managerial and administration skills. This will help you in any of
the long-term goals you might want to pursue.


Most of the schools have an open-source labs. Our
school lacks this one. This might be one of the reasons why you should start one
in our school.


Good Luck!

IEEE Transactions

My paper got published yesterday on the webpage:

This paper appears in: Power Systems, IEEE Transactions onPublication Date: Aug. 2005Volume: 20, Issue: 3On page(s): 1330- 1340ISSN: 0885-8950 Digital Object Identifier: 10.1109/TPWRS.2005.851948Posted online: 2005-08-01 09:45:17.0

Tuesday, July 26, 2005

Todays Job

Earlier before going to work, I had planned that I should write something about the data description of the high-frequency data and also do some experiments with the neural network.

I had to find the daily average price for all the 1826 points. I had to do this to find if there is any correlation between everyday temperature and price. Also, I found out the first-order serial correlation coefficient for hourly prices. I used the "correl" function of excel to do this. More details to be added later.

During the winter break of 2005 (Jan), I created a RBFF network using MATLAB. I created a file named ANN.m. The data used during that time was a simple price and load data. Now, I have more dimensions in the high-frequency data set. So, I modified the old ANN.m file and created ANNNew.m file. The new data has 43824 (1826 x 24) points. The neural network gives an out of memory error when executed as a whole. So, I have to do redo by taking some part of the data set for testing and training.

Took the printout of the tutorial about codeDOM.
I almost have 5 years of data. I have to redo the tests like this: Train with the data in the first year and then test with the data of second year. Simply alternate the training and testing data.

Sunday, July 24, 2005

Genetic Programming

Currently I am reading the c# article on genetic programming. Also, I borrowed John Koza's Genetic Programming: On the Programming of Computers by Means of Natural Selection from the library. This is the same book that the article refers to.

Thursday, July 21, 2005

Genetic Algorithms

I was reading the book "An Introduction to Genetic Algorithms by Melanie Mitchell " from the online bookstore on the IEEE Computer Society website and also reading the user guide of the GA toolbox to start implementing atleast a simple Genetic Algorithm.

Tuesday, July 19, 2005

Open Source Software in C# and Library

http://csharp-source.net/

I went to library to pick up the ILL book Tomorrow's professor : preparing for academic careers in science and engineering . Later, I went to the journals section and was browsing at some of the journals. I found the following:


  1. The journal Applied Stochastic Models in Business & Industry has a special issue on Statistical Learning in March-April 2005 (Vol 21, No. 2) It is available electronically also.
  2. www.kansascityfed.org has some articles in their economic review section which are interesting to read. I skimmed through their article How long is a long term investment?.
  3. MSDN Magazines came up with really nice and interesting articles. Check out http://msdn.microsoft.com/msdnmag
  4. Couple of articles which I thought might interest me in my project:
    Concurrency What Every Dev Must Know About Multithreaded Apps and Winsock Get Closer to the Wire with High-Performance Sockets in .NET. I have printed these articles.