Normalizing signal or feature streams

Making & changing box plugins and external apps
Post Reply
Jeff_B
Posts: 37
Joined: Wed Apr 11, 2012 1:31 pm
Location: Nice - Alpes Maritimes

Normalizing signal or feature streams

Post by Jeff_B »

Hi OpenVibers,
The SVM algorithm (libsvm library) seems to perform very poorly on the standard motor imagery scenario bundled with OV (the one with a preliminary SCP filtering)... versus the standard LDA (Linear Discriminant Analysis): it appears that the feature vectors required by the SVM classifier have to be normalized. Have any of you reached satisfactory results with the SVM classifier ?
I was wondering how to normalize (X transformed into (X-mean(X))/sqrt(var(X)) variables on OV ? Some contributors suggest to use the "simple DSP" box but I don't see how to add inputs on it to inject the Mean and Variance signals computed by the "Univariate Statistics" box. Is there a way to do this ? (without having to create the new box "Normalizer")
Image

Jeff_B
Posts: 37
Joined: Wed Apr 11, 2012 1:31 pm
Location: Nice - Alpes Maritimes

Re: Normalizing signal or feature streams

Post by Jeff_B »

Well, if normalization of the feature vectors is mandatory for the SVM classifier to operate correctly, maybe it would be better if it was implemented directly in ovpCAlgorithmClassifierSVM.cpp directly ? I have inserted the following lines, to activate a normalization of the feature vectors if epsilon=0.001 in the settings, to see if I get better classification results with the SVM (versus LDA which reaches 90% on the motor imagery right/left):

Code: Select all

	if(m_oParam.eps==0.001)
	{
		// Normalization of the feature vectors
		for(uint32 j=0;j<m_ui32NumberOfFeatures;j++)
		{
			double moment1 = 0.0;
			double moment2 = 0.0;
			for(int i=0;i<m_oProb.l;i++)
			{
				moment1 = moment1 +  m_oProb.x[i][j].value;
				moment2 = moment2 + (m_oProb.x[i][j].value)*(m_oProb.x[i][j].value);
			}
			moment1 = moment1/m_oProb.l;			// moment1 stores the mean
			moment2 = moment2/m_oProb.l-moment1;	// moment2 stores the variance
			for(int i=0;i<m_oProb.l;i++)
			{
				m_oProb.x[i][j].value=(m_oProb.x[i][j].value - moment1)/sqrt(moment2)/2;
			}
		}
	}

Post Reply