a method to detect the AD patients from NC subjects using a novel approach of channel…
- User
a method to detect the AD patients from NC subjects using a novel approach of channel optimization and TQWT based features extraction. Initially, the number of channels are optimized using Shannon entropy to signal energy ratio. The EEG signals from 10 optimized channels were decomposed into nine different SBs. The four different features are extracted from nine SBs to train and test various classification models. The extracted features from SB7 with EBT produced the highest classification accuracy of 96.20% with ten-fold cross-validation and it outperforms the state of the art methods. Introduction Proposed Method EEG dataset 12-AD and 11-NC subjects 16-electrods used named, Fz, Cz, Pz, O1, O2, F3, F8, Fp1, Fp2, F4, F7, C3, C4, T4, T3, T6 and T5 captured eye-closed and resting state during day time in multiple sessions five seconds, 256Hz using 12-bit Analog to digital converter Flow diagram 1. EEG Data 2. Channel optimization 1. Subband filtering 2. Shannon Entropy (ShEn) and Signal Energy (E) 3. ShEn by E ratio calculation 4. Backward Elimination 3. TQWT decomposition 4. feature extraction 1. Tsallis entropy (TsEn) 2. Renyi's entropy (ReEn) 3. Katz;s fractal dimension (KFD) 4. Kurtosis (K) 5. Classification 1. AD or 2. NC Channel selection method desire for optimal channel selection to reduce data redundancy and computational complexity from each channel is filtered into delta (δ: 0.5-4 Hz), theta (θ: 4-8 Hz), alpha (α: 8-13 Hz), and beta (β: 13-30 Hz) EEG SBs SEREN is measured S E S E R=\frac{S h E n}{E}=\frac{-\sum P_m \log \left(P_m\right)}{\sum s(n)^2} ; Pm = probability of datum being in bin & s(n) = samples in EEG data sequence Out of 16 EEG channels only ten most significant channels ( Cz, Pz, O1, O2, Fp1, Fp2, C3, T4, T3 and T5) were selected for feature extraction followed by classification Pseudo code for channel optimization 1: Filter EEG signal into EEG SBs. Find ShEn/E ratio. Get max(ACC) = T H, channel count j = 16; 2: while (1 ≤ i ≤ 16) do 3: Remove Cj 4: if ShEn/E ≥ TH then 5: Reject the channel Ci; 6: j ← j − 1; 7: else 8: j ← j − 1, Don’t reject Cj 9: end if 10: i ← i + 1; 11: end while 12: The value of j gives the number of optimal channels. Tunable Q-walelet transform TQWT consits of two variable parameters named Redundancy (R) and quality factor (Q), which can be changed to get required time-frequency resolution TQWT consist filter filter bank with two channels; 1st: Lowpass filer (LPS) H_0(w)=\left{\begin{array}{cc} 1, & |w| \leq(1-\beta) \pi \ \Theta\left(\frac{w+(\beta-1) \pi}{\alpha+\beta-1}\right), & (1-\beta) \pi<|w|<\alpha \pi \ 0 & \alpha \pi \leq|w| \leq \pi \end{array}\right. and 2nd : Highpass filter (HPF) H_1(w)=\left{\begin{array}{cc} 0, & |w| \leq(1-\beta) \pi \ \Theta\left(\frac{\alpha \pi-w}{\alpha+\beta-1}\right), & (1-\beta) \pi<|w|<\alpha \pi \ 1 & \alpha \pi \leq|w| \leq \pi \end{array}\right. expression for Θ(w) is \Theta(w)=\frac{1}{2}[\cos (w)+1][2-\cos (w)]^{0.5},|w| \leq \pi α and β are scaling parameter of LPF & HPF in range of 0 to 1, α+β>1 Q is depending on SB central frequency F0 and Bandwith Bw; Q=F0/Bw β=2/Q+1 and α=1-β/R In decomposition of EEG using TQWT, authors selected parameters of Q=1, R=3 and J=8 after doing some testing Thus 9 different SBs have been evaluated Feature extraction decomposed in 9 different SBs using TQWT feature 1:TsEn measure has proved to be more robus compared to ShEn which detects spikes, bursts and EEG rhythms T s E n=\frac{1}{q-1}\left(1-\sum_{m=1}^N p_m(v)^q\right) where, q>0, Pm are the probabilities of a datum being in bin N is number of samples in EEG feature 2:ReEn is used for epilepsy, drowsiness etc. Generalized the Hartley entropy, collision entropy, ShEn and min-entropy. Utilised to calculate entanglement \operatorname{ReEn}=\frac{1}{q-1}\left(\log \sum_{m=1}^N p_m(v)^q\right) where, q is parameter value between 0 and 1. N is maximum number of segments in EEG feature 3: KFD is most important type of fractal dimension used to measure complexity. which can be defined as the sum and average of Euclidean distances between successive points of a sample D and b respectively, are measured also teh maximum distance between the first point and other point of the sample left K F D=\frac{\log (D / b)}{\log (l / a)}=\frac{\log (m)}{\log (m)+\log (l / b)} where, m=D/a feature 4: Kurtosis (K) can be expressed as a measure of how outlier-prone a distribution is K=\frac{E(x-\mu)^4}{\sigma^4} where, µ is mean and σ is standard deviation (STD) Results and Discussion The statistical analysis of extracted feature sets has been performed using the KW test. KW test provides the value of p probability. If values of p 0.05, are significant to discriminate the different classes EBT method was used with highest classification accuracy of 96.20% with ten-fold cross-validation.
- Assistant
- User
so i made this code to load the data input: % Define the folder path data_folder = 'C:\Users\Windows 10\Dataset\dataset\AD_Data_origanl mat file\Dataset 1';
% List all 23 .mat files in the dataset folder file_list = dir(fullfile(data_folder, 'preproctrials*.mat'));
% Initialize variables to store trials and metadata all_EEG_data = {}; % To store trials (EEG data) from all files fs = []; % Sampling frequency (should be constant at 256 Hz) channel_labels = {}; % EEG channel names (same for all files)
% Load data from all 23 files for file_idx = 1:length(file_list) % Load the .mat file file_path = fullfile(file_list(file_idx).folder, file_list(file_idx).name); loaded_data = load(file_path);
% Access the substructure (likely named "data") data_structure = loaded_data.data; % Extract sampling frequency and channel labels (only needed once) if isempty(fs) fs = data_structure.fsample; % Sampling frequency channel_labels = data_structure.label; % Channel labels end % Extract EEG trials (each is 16x1280 matrix) num_trials = length(data_structure.trial); for trial_idx = 1:num_trials all_EEG_data{end+1} = data_structure.trial{trial_idx}; % Store each trial end - Assistant
- User
output: Number of trials loaded: 663 Number of EEG channels: 16 Sampling frequency (Hz): 256 Unrecognized function or variable 'tqwt_filters'.
Error in First (line 48) [lowpass_filter, highpass_filter] = tqwt_filters(Q, R); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Assistant
- User
lets do 1
- Assistant
- User
- Assistant
- User
Number of trials loaded: 663 Number of EEG channels: 16 Sampling frequency (Hz): 256 Error using conv (line 27) A and B must be vectors.
Error in First>tqwt_decompose (line 164) lowpass_coeffs = conv(lowpass_coeffs, H0, 'same'); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error in First (line 58) [lowpass_coeffs, highpass_coeffs] = tqwt_decompose(trial_data, Q, R, J); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Assistant
- User
can you please provide me this update code as whole for everytime?
- Assistant
- User
Number of trials loaded: 663 Number of EEG channels: 16 Sampling frequency (Hz): 256 Error using conv (line 27) A and B must be vectors.
Error in First>tqwt_decompose (line 176) lowpass = conv(lowpass_coeffs, H0, 'same'); % Apply low-pass ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error in First (line 58) [lowpass_coeffs, highpass_coeffs] = tqwt_decompose(trial_data, Q, R, J); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
improve and give me whole code
- Assistant
- User
Number of trials loaded: 663 Number of EEG channels: 16 Sampling frequency (Hz): 256 Error using conv (line 27) A and B must be vectors.
Error in First>tqwt_decompose (line 178) lowpass = conv(lowpass_coeffs, H0, 'same'); % Apply low-pass ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error in First (line 58) [lowpass_coeffs, highpass_coeffs] = tqwt_decompose(trial_data, Q, R, J); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Assistant
- User
Number of trials loaded: 663 Number of EEG channels: 16 Sampling frequency (Hz): 256 Error using / Matrix dimensions must agree.
Error in First (line 109) kfd = log10(D / N) / (log10(2 * N / A));
- Assistant
- User
First Number of trials loaded: 663 Number of EEG channels: 16 Sampling frequency (Hz): 256 Error using / Matrix dimensions must agree.
Error in First (line 114) kfd = log10(D / N) / log10(2 * N / A); % Correct Katz Fractal Dimension formula ^
- Assistant
- User
Number of trials loaded: 663 Number of EEG channels: 16 Sampling frequency (Hz): 256 Unrecognized function or variable 'tqwt_decompose'.
Error in First (line 66) [lowpass_coeffs, highpass_coeffs] = tqwt_decompose(channel_signal, Q, R, J); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Assistant
- User
give me full code
- Assistant
- User
alzheimer_detection_script Number of trials loaded: 663 Number of EEG channels: 16 Sampling frequency (Hz): 256 Error using / Matrix dimensions must agree.
Error in First (line 111) kfd = log10(D / N) / log10((2 * N) / A); ^
also if you dont know this is what i found in research paper so you can improve whole script and give me full improved script: the equation for is KFD = log(D/b)/log(l/a) = log(m)/log(m)+log(l/b) where, m = D/a. In this experiment the KFD values of each EEG subband have been calculated and used as EEG features.
- Assistant
- User
Number of trials loaded: 663 Number of EEG channels: 16 Sampling frequency (Hz): 256 Error using / Matrix dimensions must agree.
Error in First (line 117) kfd = log(m) / (log(m) + log(l / b)); ^
- Assistant
- User
- Assistant
- User
wavedec requires Wavelet Toolbox.
Error in First (line 65) [C, L] = wavedec(channel_signal, level, wavelet_function); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Assistant
- User
Number of trials loaded: 663 Number of EEG channels: 16 Sampling frequency (Hz): 256 Error using signal.internal.classicaliirfilters.classicalIIRFiltersParser (line 138) The specified frequencies must be over the (0,1) interval.
Error in butter>butterImpl (line 31) [Wno,btype,analog,bCtf,sectionOrder] = signal.internal.classicaliirfilters.classicalIIRFiltersParser(mfilename,Wn,varargin{:}); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error in butter (line 11) [varargout{1:nargout}] = butterImpl(n,Wn,varargin{:}); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error in First (line 76) [b, a] = butter(4, subbands(sb_idx, :) / (fs / 2), 'bandpass'); % Bandpass filter ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
dont explain me anything just give me improved code removes the error that i vive
- Assistant
- User
Error using / Matrix dimensions must agree.
Error in First (line 132) kfd = log(m) / (log(m) + log(l / b)); % Katz Fractal Dimension ^
- Assistant
- User
Error using / Matrix dimensions must agree.
Error in First (line 132) kfd = log(max(m, 1e-6)) / (log(max(m, 1e-6)) + log(max(l / b, 1e-6))); % Corrected formula
- Assistant
- User
Error using / Matrix dimensions must agree.
Error in First (line 129) kfd = log(m) / (log(m) + log(l / b)); % Corrected KFD formula ^
- Assistant