P300Classifier

Locked
timo.veldt
Posts: 23
Joined: 12 Feb 2010, 04:08

P300Classifier

Post by timo.veldt » 12 May 2010, 11:30

I was wondering if the P300Classifier is still being developed? My experiments have turned up some unconvincing results so far (I know, this could also be my own fault). To check if everything goes well in all steps, I'm now running through the P300Classifier Code and in the first few lines I'm picking up all kinds of strange constructs that I interpret differently than they are implemented.

An example from DataPage::ValidateTrainingDataFiles (or from DataPage::ValidateTestDataFiles, the code seems largely the same):

Code: Select all

for(file = 0; file < files < this->TrainingDataFilesList->count(); files++)
{
    ...
    const StateList* statelist = CurrentFile->States();
    for (i = 0; i < statelist->Size(); i++ )
    {
    	if( !CurrentFile->States()->Exists((*statelist)[i].Name()))
	{
		ostringstream oss;
		oss << "Incompatible states information for " << pathArr[files].c_str();
		QMessageBox msgBox(QMessageBox::Warning, tr("Warning"),
			oss.str().c_str(), 0, this);
			msgBox.addButton(tr("&Continue"), QMessageBox::AcceptRole);
		if (msgBox.exec() == QMessageBox::AcceptRole)
		{
			this->TrainingDataFilesList->item(files)->setBackgroundColor(QColor(tr("lightpink")));
			this->GenerateFeatureWeights->setEnabled(false);
			return false;
		}
	}
    }
    ...
}
As far as I can interpret, this piece of code is responsible for checking whether all files have the same states defined. However in the first line within the for-loop the states to be checked against are read from the current file. So basically this piece of code asks: What are the states in this file? And are these states really in this file?

When I loaded an example file (eeg3-1.dat) and one of my own experiments, which do not have the same states, I did not get an error on this. Whichever order I loaded them.

My question is whether or not this is already looked into or if I should look into this stuff myself. I mean no offense, I just want to know if I can continue my experiments or if I should put some effort in checking the source. And as said before, I've found more things like the example above.

gschalk
Posts: 615
Joined: 28 Jan 2003, 12:37

P300Classifier

Post by gschalk » 12 May 2010, 22:11

Timo,

The P300Classifier is replacing the Matlab-based P300GUI, and uses the same algorithm. We ran many tests to see whether it produces the same results as the P300GUI, and these tests have all been successful. We have also run many online experiments with the P300Classifier, and they have been successful as well.

This does not mean that there cannot be remaining bugs. We will be looking into what you reported, and will fix it immediately if this in fact is a bug.

Gerv

cmpotes
Posts: 13
Joined: 03 Oct 2009, 11:24

Post by cmpotes » 13 May 2010, 01:00

Timo,

You are right. That was my mistake, and I just simply overlooked it when I wrote the code. Even though the P300Classifier has been tested several times and has been produced successful results (compared to the P300GUI), I think there might be some bugs (e.g., checking the compatibility of the states across the files) that need to be fixed. I apologized for the error and I will work on it.

Thank you very much for your contribution.

timo.veldt
Posts: 23
Joined: 12 Feb 2010, 04:08

Post by timo.veldt » 15 May 2010, 06:34

As said before, I'm running through the code and at this point I'm just adding a lot of comments to generate doxygen. However this morning I had to merge a new version with my current, documented version and it was a LOT of work.

So for me, it would be ideal if I could check in my version with comments which would prevent half a day's of merge-work on my part. On your part, you'd get files which have been commented thoroughly and will provide doxygen support.
However since I have a specific goal in mind, not everything will be documented. This means that there are some personal notes as well on where I think I should be making modifications. Additionally, I could be wrong about some lines and meanings.

My question is if you'd like my comments in the SVN? I can send over some stuff first if you'd like to see how it looks etc., just ask me what you'd like.

timo.veldt
Posts: 23
Joined: 12 Feb 2010, 04:08

SWLDA

Post by timo.veldt » 19 May 2010, 04:24

Still running through the code and I'm stuck at the SWLDA code. Is there some documentation on the algorithms that are used?

So far I've been able to check the Moving Average Filter that is applied and I think there is a division missing (i.e. with respect to the wiki-entry, see the code below (from the file filter.cpp, wit my additional comments between /!**/ or starting with "//Timo:"):

Code: Select all

/*!
	 * The next part looks like the Moving Average Filter, except that there is no division by the number of samples taken to calculate the new value, which seem required for a moving average.
	 * \see 
	 * <a href="http://en.wikipedia.org/wiki/Moving_average">Wiki-entry on Moving Average</a>
	 */
	// cumulative sum 
	val = 0;
	for(i=0; i<np+1; i++)
	{
		if (i<ord+1)
		{
			val += y(i); 
			tmp(i) = val; //Timo: Divide by order? Or in this case i, since the sum does not consist of the maximum number of values.
		}
		else
		{
			val += y(i); 
			val = val - y(i-(ord+1));
			tmp(i) = val; //Timo: Divide by order?
		}
	}
I'm currently stuck in the file stepcalc.cpp, where I see what is happening, but I don't see the outline. Is there a description of the methods available that are actually implemented, with the steps taken to get to the result?

I'm also aware that ALGLIB plays an important role in the implementation, but I cannot match the files in the src/extlib/alg folder to any of the file in the original package (downloaded from the website above), except for the datastructures.

Thanks in advance![/url]

cmpotes
Posts: 13
Joined: 03 Oct 2009, 11:24

Post by cmpotes » 19 May 2010, 12:17

Timo,

I am very glad to have your input in the P300Classifier. I would like you to send me (cmpotes@miners.utep.edu) the c functions you have documented and changed. I will take a look at it and test it with all the data files I have. Once they have been tested I will submit your changes into BCI2000. Also, please send me an email where I can send you all the references I used to develop the P300Classifier.

I followed the P300GUI that was developed by dean Krusienski, and other algorithms such as the stepwisefit from Matlab. Most of the algorithms (e.g., the SWLA) was developed as a mex file to compare it to the output from the P300GUI.

Some other references I used

1. The book "Applied Regression Analysis (Draper)" explains the "Stepwise Regression Alg" (pg 171) and cites the book "Mathematical Methods for Digital Computers (Ralston) pg 191".

2. Numerical recipes in C : the art of scientific computing / William H. Press ... [et al.]. Some part of the code Moving average filter was taken from this book.

Thank you,

timo.veldt
Posts: 23
Joined: 12 Feb 2010, 04:08

Post by timo.veldt » 28 May 2010, 04:23

I've been testing my modifications and I found an error in a data-file (I assume).

I've loaded the sample file eeg2_1.dat, which is supposedly recorded by the P3SpellerTask-paradigm. However when I ran it through debug mode I noticed that my code thought it was a StimulusPresentationTask. Assuming I made some mistake, I also ran the original code on this file. Again it was designated a StimulusPresentationTask.

Also, is there a concise list that tells me what each file should contain? It's really time-consuming to browse all the tutorials in search of a description for each sample file.

Locked

Who is online

Users browsing this forum: No registered users and 3 guests