Monday, March 30, 2009

Loebner Prize at InterSpeech 2009

I have recetly written an article about the Loebner Prize contest. The contest has been organized every year since 1991 and it will be held in conjunction with InterSpeech, in Brighton, UK this year. Check out the whole article!

Tuesday, March 24, 2009

Difference between the Standard Deviation, Standard Error and Confidence Itervals

In its simplest:
  • the standard deviation represents the variability of input values,
  • the standard error (of the mean) represents variability of computed mean,
  • the confidence intervals represents where the 'true' mean value might lie.
Computation:
  • the standard deviation is computed from the variance of your data - input values,
  • the standard error is computed from the standard deviation,
  • the confidence intervals are computed from the standard error.
Read this:

Many people confuse the standard deviation (SD) and the standard error of the mean (SE) and are unsure which, if either, to use in presenting data in graphical or tabular form. The SD is an index of the variability of the original data points and should be reported in all studies. The SE reflects the variability of the mean values, as if the study were repeated a large number of times. By itself, the SE is not particularly useful; however, it is used in constructing 95% and 99% confidence intervals (CIs), which indicate a range of values within which the “true” value lies. The CI shows the reader how accurate the estimates of the population values actually are. If graphs are used, error bars equal to plus and minus 2 SEs (which show the 95% CI) should be drawn around mean values. Both statistical significance testing and CIs are useful because they assist the reader in determining the meaning of the findings.

(Can J Psychiatry 1996;41:498–502)

Monday, March 16, 2009

Google Testing Blog: TotT: EXPECT vs. ASSERT

Google commented on different types of assertations in their testing framework (Google Testing Blog: EXPECT vs. ASSERT) 

I have found assertations in my code very useful on many occasions; however, I do not see any need for the EXPECT function. If your code is broken then it is broken and there is no point in continuing and testing conditions which are not likely to be met. 

It is like with C++ compiler errors. The most important error is the firtst error. The rest of the erorrs is usually rubish and useless. 

Wednesday, March 11, 2009

Linked list sorted in an ascending order

Again to practice some of skills I wrote linked list sorted in an ascending order. It is very simple example and it performs only two operation:
  • inserting an item into the appropriate position in the list
  • printing the whole list on the screen
The following code is placed in the public domain. Use it as you wish. The code can be downloaded with the solution project file for MS Visual Studio 2008 from here.

// LinkedList.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include

/*
The supplied C code fragment is intended to implement a linked list of
integers stored in ascending order. Each element of the list is a struct
of type Item holding the integer value, a pointer pred to the previous
element, if any, and a pointer succ to the succeeding element, if any. The
variable head points to the ?rst element in the list, and tail points to
the last element. Initially, both head and tail are NULL. The function
insert is intended to insert its argument x into the list. If x is already in
the list, insert should do nothing.
*/

using namespace std;

struct Item {
int value; // the integer value
Item* succ; // succeeding value
Item* pred; // preceding value
};

Item* head = NULL;
Item* tail = NULL;

Item* createItem(int x, Item* succ, Item* pred)
{
Item* item = new Item;
item->value = x;
item->succ = succ;
item->pred = pred;

return item;
}

/**
Insert x into linked list

There are 5 possible cases, any four of these will suffice
- list is initially empty
- x is smaller than any number in the list
- x is larger than any number in the list
- x is already in the list
- the normal case i.e. none of the above

*/

void insert(int x)
{
Item *p = head , *q;
if(!p) {
// add the first item
head = tail = createItem(x,NULL,NULL);
}
else if (x > tail->value){
// add the largest item in the list
tail->succ = createItem(x,NULL,tail);
tail = tail->succ;
}
else{
while (x > p->value)
p = p->succ;

if (x==p->value)
// do not add itme because it already exists
return;

// add the item before p because x < q =" createItem(x,">pred); // create item, pass the succesor and the predcesor
q->succ->pred = q; // modify the succesor of q so that it points to q
q->pred->succ = q; // modify the predcesor of q so that it points to q
}
}

void printList(void)
{
Item* p = head;
int counter = 0;

cout << "------------------------------------------------------------" <<>value << p =" p-">succ;
}
}

int _tmain(int argc, _TCHAR* argv[])
{
cout << "Ascending linked list demonstration." << i =" 0;">


The output of the program is as follows:

Ascending linked list demonstration.
--------------------------------------
Item number:0 Item value:1
--------------------------------------
Item number:0 Item value:1
Item number:1 Item value:10
--------------------------------------
Item number:0 Item value:1
Item number:1 Item value:5
Item number:2 Item value:10
--------------------------------------
Item number:0 Item value:1
Item number:1 Item value:5
Item number:2 Item value:10