2

I am trying to reduce dimensionality of multiple scalograms having same dimension of size[5x3844]. How can I apply that using LDA in python ??

Any help would be appreciated.

code:

def wavelet(data):
    fs=256
    lowcut=117
    highcut=123
    y=butter_bandstop_filter(data, lowcut, highcut, fs, order=6)
    lowcut=57
    highcut=63
    y=butter_bandstop_filter(y, lowcut, highcut, fs, order=6)
    cutoff=1
    y=butter_highpass_filter(y, cutoff, fs, order=6)
    coeffs = wavedec(y, 'sym5', level=5)
    cA5,cD5,cD4,cD3,cD2,cD1=coeffs
    result = []
    common_x = np.linspace(0,3844, len(cD1))
    for c in [cD5,cD4,cD3,cD2,cD1]:
        x = np.linspace(0, 3844, len(c))
        f = interp1d(x, c)
        result.append(f(common_x)) 
    return result
Eda
  • 565
  • 1
  • 7
  • 18
  • Have you looked at [this](https://scikit-learn.org/stable/modules/generated/sklearn.discriminant_analysis.LinearDiscriminantAnalysis.html) scikit learn LDA implementation? – Kirtiman Sinha Apr 27 '20 at 23:08
  • @KirtimanSinha Yes but I don't know how to apply it on my data. – Eda Apr 27 '20 at 23:13
  • LDA is Supervised, do you have class labels that you are trying to predict? In case you want to go for Unsupervised learning, you might want to check out PCA or SVD. – Kirtiman Sinha Apr 27 '20 at 23:50
  • @KirtimanSinha yes I am working on seizure epilepsy dataset to predict seizure.I want to apply LDA to reduce dimensionality reduction. – Eda Apr 28 '20 at 00:43
  • If result list is your predictor(`X`) and you have a training label list (`Y`) then its as simple as `clf.fit(X, y)`. What am I missing? – Kirtiman Sinha Apr 28 '20 at 00:48
  • @KirtimanSinha first I worked on the normal data which don't have epilepsy and create a scalogram then I worked on epilepsy data and create a scalogram then I feed all these scalograms to CNN, I want to apply LDA on the normal scalogram then on the epilepsy scalograms. I don't know what is X and what is Y in my scalograms – Eda Apr 28 '20 at 02:01
  • assign a label to normal data (i.e. without epilepsy) scalograms(say label `0`), then assign a label to epilepsy data scalograms (say label `1`). Now you have your predictors(`X`): scalogram data and your labels (`Y`): which are either `0` (without epilepsy) or `1`(with epilepsy) for each scalogram data point. – Kirtiman Sinha Apr 28 '20 at 05:25

0 Answers0