[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

I have two signals, each one of them is a sum of random cosine

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 11
Thread images: 1

File: 1424966132517.jpg (164KB, 620x849px) Image search: [Google]
1424966132517.jpg
164KB, 620x849px
I have two signals, each one of them is a sum of random cosine & sine waves.
I need to classify them using a clustering algorithm.
How do I go about that using python?
>>
classify what exactly?
>>
>>8143761
I don't know this question is driving me crazy.
That's all what the exercise says.
My best guess is classify them according to the frequencies maybe?
>>
Don't know what the clustering algorithm part of the question is talking about. I would use an FFT in Python using NumPy so you can get a graph with frequency on the X axis. There you will be able to see the frequency spectrum and understand what sine and cosine waves went into making your signal. You'll get awesome graphs if you make sure the frequency resolution is 1 Hz or smaller, but I don't know what you mean by "classify".
>>
Just do FFT and then some clustering algorithm from scikit-learn. ezpz
>>
>>8143835
>>8143842
A previous question asked about the FFT and this question specifically asked to use the clustering algorithms
>>
>>8143789
find some k means algorithm for python

draw the fft of your signal
I might be wrong, but I suggest that as your features, you use frequencies AND phases, you might get something interesting. If phases are irrelevant, you will notice anyway.

each component of the signal corresponds to a point in a 2D space (frequency,phase).

try to visually see how many groups you can form (you can use better methods, but this is just a first test)

use your k-means on the set of obtained points, with the number of groups you want to get

don't know what your signal looks like so you might need more steps, but that's a way to start.
>>
>>8143846
these are my two random signals. It's my first time with python I'm sure it's messy.

N = 10001 # Number of samples
Nf = np.sum(n) # number of Frequencies
t = np.arange(N, dtype= float)
Ts = np.random.rand(Nf)*2000+10
fs = 1/Ts #random frequencies
print(fs)
#random amplitudes
amp= np.random.rand(Nf)*200+10
#First signal
for num in range(0, int(n[0])):
signal1 = np.array(signal1 + np.array(amp[num]* np.cos(fs[num]*2*np.pi*t)))
for num in range(0, int(n[1])):
signal1 = np.array(signal1 + np.array(amp[num+int(n[0])]* np.sin(fs[num+int(n[0])]*2*np.pi*t)))
#Second signal
for num in range(0, int(n[2])):
signal2 = np.array(signal2 + np.array(amp[num+int(n[0])]* np.cos(fs[num+int(n[0])]*2*np.pi*t)))
for num in range(0, int(n[3])):
signal2 = np.array(signal2 + np.array(amp[num+int(n[0])]* np.sin(fs[num+int(n[0])]*2*np.pi*t)))
>>
>>8143854
sorry this is the second signal

#Second signal
for num in range(0, int(n[2])):
signal2 = np.array(signal2 + np.array(amp[num+int(sum(n[0:2]))]* np.cos(fs[num+int(sum(n[0:2]))]*2*np.pi*t)))
for num in range(0, int(n[3])):
signal2 = np.array(signal2 + np.array(amp[num+int(sum(n[0:3]))]* np.sin(fs[num+int(sum(n[0:3]))]*2*np.pi*t)))
>>
>>8143854
I forgot something: you can also consider amplitude as a feature. And here it looks like there is no phase so you can remove that.

and instead of k-means, I suggest a gaussian mixture model because of the rand.
>>
>>8143904
I'm really new to all of this. any help concerning the Gaussian mixture ?
Thread posts: 11
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.