Techno Blender
Digitally Yours.

Introduction to ICA: Independent Component Analysis | by Jonas Dieckmann | Feb, 2023

0 38


Image by Unsplash
Image by author
Image by Unsplash

The cocktail party problem

Cocktail party problem. Image by author.
Image by author
Image by author

ICA vs. PCA

Image by author
Image by author
Image by author
Image by author
# install fastICA package in R
install.packages("fastICA")

# load required libraries
library(MASS) # To use mvrnorm()
library(fastICA)

# random data for signal 1 
s1=as.numeric(0.7*sin((1:1000)/19+0.57*pi) + mvrnorm(n = 1000, mu = 0, Sigma = 0.004))
plot(s1, col="red", main = "Signal 1", xlab = "Time", ylab = "Amplitude")

# random data for signal 1
s2=as.numeric(sin((1:1000)/33) + mvrnorm(n = 1000, mu = 0.03, Sigma = 0.005))
plot(s2, col="blue", main = "Signal 2",xlab = "Time", ylab = "Amplitude")

Screenshots from R-output: original signals. Image by author
# measurements with mixed data x1 and x2
x1 <- sine1-2*sine2
plot(x1, main = "Linearly Mixed Signal 1", xlab = "Time", ylab = "Amplitude")

x2 <- 1.73*sine1 +3.41*sine2
plot(x2, main = "Linearly Mixed Signal 2", xlab = "Time", ylab = "Amplitude")

Screenshots from R-output: measurements. Image by author
# apply fastICA function to identify independent signals
measurements <- t(rbind(x1,x2))

estimation <- fastICA(measurements, 2, alg.typ = "parallel", fun = "logcosh", alpha = 1, method = "C", row.norm = FALSE, maxit = 200, tol = 0.0001, verbose = TRUE)

plot(estimation$S[,1], col="red", main = "Estimated signals", xlab = "Time", ylab = "Amplitude")
lines(estimation$S[,2], col="blue")
mtext("Signal 1 estimation in red, Signal 2 estimation in blue")

Screenshots from R-output: independent signals separated again. Image by author

Time for real cocktails parties 🍹


Image by Unsplash
Image by author
Image by Unsplash

The cocktail party problem

Cocktail party problem. Image by author.
Image by author
Image by author

ICA vs. PCA

Image by author
Image by author
Image by author
Image by author
# install fastICA package in R
install.packages("fastICA")

# load required libraries
library(MASS) # To use mvrnorm()
library(fastICA)

# random data for signal 1 
s1=as.numeric(0.7*sin((1:1000)/19+0.57*pi) + mvrnorm(n = 1000, mu = 0, Sigma = 0.004))
plot(s1, col="red", main = "Signal 1", xlab = "Time", ylab = "Amplitude")

# random data for signal 1
s2=as.numeric(sin((1:1000)/33) + mvrnorm(n = 1000, mu = 0.03, Sigma = 0.005))
plot(s2, col="blue", main = "Signal 2",xlab = "Time", ylab = "Amplitude")

Screenshots from R-output: original signals. Image by author
# measurements with mixed data x1 and x2
x1 <- sine1-2*sine2
plot(x1, main = "Linearly Mixed Signal 1", xlab = "Time", ylab = "Amplitude")

x2 <- 1.73*sine1 +3.41*sine2
plot(x2, main = "Linearly Mixed Signal 2", xlab = "Time", ylab = "Amplitude")

Screenshots from R-output: measurements. Image by author
# apply fastICA function to identify independent signals
measurements <- t(rbind(x1,x2))

estimation <- fastICA(measurements, 2, alg.typ = "parallel", fun = "logcosh", alpha = 1, method = "C", row.norm = FALSE, maxit = 200, tol = 0.0001, verbose = TRUE)

plot(estimation$S[,1], col="red", main = "Estimated signals", xlab = "Time", ylab = "Amplitude")
lines(estimation$S[,2], col="blue")
mtext("Signal 1 estimation in red, Signal 2 estimation in blue")

Screenshots from R-output: independent signals separated again. Image by author

Time for real cocktails parties 🍹

FOLLOW US ON GOOGLE NEWS

Read original article here

Denial of responsibility! Techno Blender is an automatic aggregator of the all world’s media. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials, please contact us by email – [email protected]. The content will be deleted within 24 hours.
Leave a comment