Commit ff20ee6c authored by Leigh Smith's avatar Leigh Smith

Factored out the classification of lab4 to classify_separated_signals

parent 82db1c6b
{
"metadata": {
"name": "",
"signature": "sha256:98b053589d06e625718d1e1c0a2b65a02f9098813c4b80e061bb5732bb95b293"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Classification of Separated Signals\n",
"-----------------------------------\n",
"\n",
"Follow the K-NN example in Lab 1, but classify the *separated* signals.\n",
"\n",
"As in Lab 1, extract features from each training sample in the kick and snare drum directories.\n",
"\n",
"1. Train a K-NN model using the kick and snare drum samples."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"labels = np.empty(20, np.int32)\n",
"labels[0:9] = 1 # First 10 are the first sample type, e.g. kick\n",
"labels[10:19] = 2 # Second 10 are the second sample type, e.g snare\n",
"\n",
"model_snare = KNeighborsClassifier(n_neighbors = 1)\n",
"model.fit(scaledTrainingFeatures, labels.take(train_index, 0))\n",
"model_output = model_snare.predict(scaledTestingFeatures)"
],
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"2. Extract features from the drum signals that you separated in Lab 4 Section 1. \n",
"\n",
"3. Classify them using the K-NN model that you built.\n",
"\n",
" Does K-NN accurately classify the separated signals?\n",
"\n",
"4. Repeat for different numbers of separated signals (i.e., the parameter `K` in NMF). \n",
"\n",
"5. Overseparate the signal using `K = 20` or more. For those separated components that are classified as snare, add them together using `sum}. The listen to the sum signal. Is it coherent, i.e., does it sound like a single separated drum?\n",
"\n",
"...and more!\n",
"\n",
"* If you have another idea that you would like to try out, please ask me!\n",
"* Feel free to collaborate with a partner. Together, brainstorm your own problems, if you want!\n",
"\n",
"Good luck!"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
\ No newline at end of file
......@@ -358,4 +358,4 @@
"metadata": {}
}
]
}
\ No newline at end of file
}
{
"metadata": {
"name": "",
"signature": "sha256:8cb92bce0fc8cd2698239681515f405f57245c6def0ac2620d221a3f49fcad54"
"signature": "sha256:eb40e34116f231d0e2616b21dbd3eaac2494c326f9b61a67dc99f2bd3b9cb7ba"
},
"nbformat": 3,
"nbformat_minor": 0,
......@@ -124,39 +124,7 @@
"\n",
" Compared to the noisy input signal, how much noise is left in the output signals? \n",
"\n",
" Which output contains more noise? Why?\n",
"\n",
"\n",
"Section 3: Classification\n",
"-------------------------\n",
"\n",
"Follow the K-NN example in Lab 1, but classify the *separated* signals.\n",
"\n",
"As in Lab 1, extract features from each training sample in the kick and snare drum directories.\n",
"\n",
"1. Train a K-NN model using the kick and snare drum samples.\n",
"\n",
" labels=[[ones(10,1) zeros(10,1)];\n",
" [zeros(10,1) ones(10,1)]];\n",
" model_snare = knn(5, 2, 1, trainingFeatures, labels);\n",
" [voting, model_output] = knnfwd(model_snare, featuresScaled)\n",
"\n",
"2. Extract features from the drum signals that you separated in Lab 4 Section 1. \n",
"\n",
"3. Classify them using the K-NN model that you built.\n",
"\n",
" Does K-NN accurately classify the separated signals?\n",
"\n",
"4. Repeat for different numbers of separated signals (i.e., the parameter `K` in NMF). \n",
"\n",
"5. Overseparate the signal using `K = 20` or more. For those separated components that are classified as snare, add them together using `sum}. The listen to the sum signal. Is it coherent, i.e., does it sound like a single separated drum?\n",
"\n",
"...and more!\n",
"\n",
"* If you have another idea that you would like to try out, please ask me!\n",
"* Feel free to collaborate with a partner. Together, brainstorm your own problems, if you want!\n",
"\n",
"Good luck!\n"
" Which output contains more noise? Why?\n"
]
},
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment