I have matrix say a in matlab. I wish to some feature selection using relieff function.
The problem I have is that some values in the matrix are complex numbers. How can I convert the complex numbers to represent their magnitude in the matrix?
You can find the complex valued entries in your matrix A
using
cmplx = imag(A) ~= 0;
Once you found them, you can replace them
A(cmplx) = abs( A(cmplx) );
Note that requiring floating-point numbers to be exactly zero might be too restrictive and a threshold might be needed instead, eg,
cmplx = abs( imag(A) ) > 1e-8;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.