Decompose your mixed signals with Kydavra ICAFilter
What is ICAFilter?
It’s a filter that uses the Fast ICA algorithm. Unlike PCA that reduces the dimensions, Independent Component Analysis decomposes the mixed signals. After that it brings the filtered form of the pandas data frame as independent non-Gaussian signals.
ICA will find these independent components, also called sources, factors or latent variables from the data variables which are assumed to be linear mixtures. That’s why ICA is considered to be a more powerful technique.
Using Kydavra ICAFilter.
Let’s first install kydavra by typing the following line. (Ensure that you have the 0.3 version).
pip install kydavra
Next, let’s import the filter:
from kydavra import ICAFilter
Now, we will import the Hearth Disease UCI dataset.
import pandas as pddf = pd.read_csv('heart.csv')
Let’s create an object and apply it to our dataset.
for i in range(1, 10):
ica_filt = ICAFilter(n_components=i)
new_df = ica_filt.filter(df, 'target')
X = new_df.iloc[:, :-1].values
y = new_df['target'].values
print(f"{i} - {np.mean(cross_val_score(logit, X, y))}")
We get the following result:
1 - 0.5314207650273224
2 - 0.7095628415300547
3 - 0.6998907103825136
4 - 0.6998907103825136
5 - 0.7954098360655737
6 - 0.8084153005464481
7 - 0.8051366120218578
8 - 0.8381420765027322
9 - 0.8380874316939891
From the following output, we can see the best cross_val_score is 0.838. Also, we recommend trying other selectors from kydavra to have higher accuracy.
Made with ❤ by Sigmoid.
Follow us on Facebook, Instagram and LinkedIn:
https://www.facebook.com/sigmoidAI