Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE HELP IN PYTHON When we are in an airplane, we count on the pilots and control towers maintaining clear communication. The voice signal of
PLEASE HELP IN PYTHON
When we are in an airplane, we count on the pilots and control towers maintaining clear communication. The voice signal of the pilot can be impacted by the turbine noise making it difficult for pilots voices to come across communication channels clearly. Training an Adaline Neural Network ANN to filter the noise creates clearer signals between pilots and control tower operators leading to safer flights. For this assignment, you use ANN to simulate filtering a pilots signal.
ANN also known as Adaptive Linear Neuron or later as Adaptive Linear Element, are singlelayer artificial neural networks. Adaline differs from the standard perceptron during the learning phase, when the weights are adjusted according to the weighted sum of the inputs also known as the net. In the standard perceptron, the net is passed to the activation function and the function's output is used for adjusting the weights.
The outputs of the Adaline are real numbers as opposed to the binary outputs of the perceptron. Adaline uses a linear function as a transfer function instead of a hardlim. Using Adaline in this manner, establishes a mathematical function to assess the networks performance during learning and makes the network suitable for modeling nonlinear problems, which the perceptron cannot model.
For this assignment, you apply the Adaline Neural Network to a realworld problem by solving problems. Fill out the section that is missing code needed to complete the script below.
import numpy as np
import scipy.iowavfile
import matplotlib.pyplot as plt
#Problem:
#There is a voice signal of a pilot affected by an turbine of the airplane mixedwav, have a listen! We have access to the contaminated signal and the noisy signal of the turbine noisewav, have a listen! An Adeline neural network has to be trained to filter the noise from the contaminated signal and recover the cleaned voice of the pilot you have to provide this wav file, although I also attached my result as a reference for you, have a liste!
#This Adaline has only one output neuron and ninputs' inputs. The idea is to use this Adaline as a real time adaptive filter the main application it is used for Therefore, the noise signal will be the input of the Adaline although, to feed this signal ino the network, you will have to go across the signal sample by sample taking slices of size ninputs'. We want our Adaline to respond to each sample of the noise input or the slice that starts with such a sample with the corresponding sample of the voicenoise signal target T ei mixed.wav
#During some few first inputs, the Adaline will not be capable of responding as we wish, but soon after some slices have been input it will adapt and the response will resemble our target T mixedwav more and more. Notice that since our output tends to T and finally equals T thus such output is not really the signal we are looking for then which? Also, since the Adaline is an adaptive filter you only have to input the whole noise signal once the training lasts as long as there is T and Noise to train because by the time the signal is reaching the end, the network has to be already well adapted the cleaned voiced is already accessible
#Read the signals for this assignment:
# the turbine noise which we have access to
samplerate, P scipy.iowavfile.readnoiseWAV'
# our target
samplerate, T scipy.iowavfile.readmixedWAV'
#Prepare the signals for this problem:
# preprocessing the signals
T TnpmeanT
T TmaxT
P PnpmeanP
P PmaxP
# lenght of the training
llenT
# Number of inputs of the network
ninputs
# learning rate
alpha
#Initialize weights W and error E:
# please use this instead of pure randomly
Wnponesninputs
# initialize in
Enpzerosl
#Train the network:
# Write your code here
#Save final signals:
# who is cleaned?
cleanednpintcleanednpmaxcleaned
scipy.iowavfile.writecleanedWAV', samplerate,cleaned
#Print the final signals:
time nplinspace l Tshape
pltplottime cleaned label"The cleaned Voice Signal"
pltlegend
pltxlabelTime s
pltylabelAmplitude
pltshow
pltplottime T label"VoiceNoise Target T
pltlegend
pltxlabelTime s
pltylabelAmplitude
pltshow
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started