Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
musicinformationretrieval-com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
A.S.
musicinformationretrieval-com
Commits
1140c091
Commit
1140c091
authored
Jun 21, 2014
by
Leigh Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up remainder of lab1a
parent
16610ca7
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
205 additions
and
188 deletions
+205
-188
classify_separated_signals.ipynb
notebooks/classify_separated_signals.ipynb
+18
-4
lab1a.ipynb
notebooks/lab1a.ipynb
+187
-184
No files found.
notebooks/classify_separated_signals.ipynb
View file @
1140c091
{
"metadata": {
"name": "",
"signature": "sha256:
7ed94cc2b18891285f61c97615ead2cb2f265d2e6a8d305e44280affbff5a673
"
"signature": "sha256:
87d9daf99e5dd04a4e931b27d00a174351903b19f38f0fc69d0190f437b45b74
"
},
"nbformat": 3,
"nbformat_minor": 0,
...
...
@@ -26,9 +26,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
"import numpy as np\n",
"\n",
"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",
"labels[0:9] = 1 # First 10 are the first sample type, e.g.
snare
\n",
"labels[10:
20] = 2 # Second 10 are the second sample type, e.g kick
\n",
"\n",
"model_snare = KNeighborsClassifier(n_neighbors = 1)\n",
"model.fit(scaledTrainingFeatures, labels.take(train_index, 0))\n",
...
...
@@ -36,7 +38,19 @@
],
"language": "python",
"metadata": {},
"outputs": []
"outputs": [
{
"ename": "NameError",
"evalue": "name 'KNeighborsClassifier' is not defined",
"output_type": "pyerr",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-3-914682621b17>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mlabels\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;36m20\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m2\u001b[0m \u001b[0;31m# Second 10 are the second sample type, e.g kick\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mmodel_snare\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mKNeighborsClassifier\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mn_neighbors\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mscaledTrainingFeatures\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlabels\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtake\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtrain_index\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mmodel_output\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmodel_snare\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpredict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mscaledTestingFeatures\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'KNeighborsClassifier' is not defined"
]
}
],
"prompt_number": 3
},
{
"cell_type": "markdown",
...
...
notebooks/lab1a.ipynb
View file @
1140c091
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment