0

I am currently looking at the effects of sampling rate and quantization on tumour signals during classification. I get the error 'The pooled covariance matrix of TRAINING must be positive definite.' ONLY when I try to classify the quantised signal (8 bits). If quantizatoin is set to >8 bits, then the codes runs perfectly!

I am a little bit confused and would appreciate any assistance anyone may have.

My code is as follows:

    clear all;
    close all;
    clc;

    load('AllSignalsModified.mat')

    % =================================%
    % PCA - Feature Extraction
    % =================================%
    [cl, pcaAll]= princomp(allSignals);
    bestFeatures = pcaAll(:,1:100);

    %==============================%
    % Decimate allSignals
    %==============================%

    nsamp = 100;
    fs1 = 50e9;
    N = 2;
    fs2 = fs1/N;
    x = allSignals;

    % iterate thru each tumour signal

    for i = 1:960,
        oneRow= allSignals(i,:);
        downSampleRow(i,:) = oneRow(1:N:end);
    end;

    oneSampleRow = downSampleRow(1,:);

    %==========================================%
    % Quantisation 
    %==========================================%

    nbits = 8;

    for i = 1:960,
        x = downSampleRow(i,:);
        x2 = x / max(abs(x));
        x3= x2 .* 2^(nbits-1)-1;
        quantisedSig(i,:) = round(squeeze(x3));
    end;

    % =================================%
    % LDA Classification 
    % =================================%

    typeOfTumour(typeOfTumour<=2) = 0;
    typeOfTumour(typeOfTumour>=3) = 1;

    testSetResult = classify(quantisedSig,quantisedSig,typeOfTumour,'linear');
    testSetResult1 = classify(quantisedSig,quantisedSig,typeOfTumour,'quadratic');

    count = 0;
    for i = 1:960,
        if(testSetResult(i) == typeOfTumour(i))
            count = count + 1;
        end;
    end;

    count1 = 0;
    for i = 1:960,
        if(testSetResult1(i) == typeOfTumour(i))
            count1 = count1 + 1;
        end;
    end;

    percentageCorrect = (count/960)*100;
    percentageCorrect1 = (count1/960)*100;
    display(percentageCorrect);
    display(percentageCorrect1);
  • this is not really a matlab question - it seems like you are using some special add-on, and the problem arises there. are there no support resources for that add-on? – Kaare Mar 15 '13 at 12:42
  • First of all: why are you using the same data set for training and test? I think your problem is that your training data has too little variance when you have too few 'bins'. Usually you would add some artificial noise in the diagonal of the covariance matrix to avoid that. – julietKiloRomeo Mar 15 '13 at 12:49

0 Answers0