Skip to content

Commit b421ac1

Browse files
authored
Merge pull request #47 from gopherds/refactor
update example imports, update Dockerfile
2 parents 4b358a1 + 9e6046c commit b421ac1

8 files changed

+241
-182
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
1414

1515
# install gophernotes
1616
RUN go get golang.org/x/tools/cmd/goimports
17-
RUN go get github.com/gophergala2016/gophernotes
17+
RUN go get github.com/gopherds/gophernotes
1818
RUN mkdir -p ~/.ipython/kernels/gophernotes
19-
RUN cp -r $GOPATH/src/github.com/gophergala2016/gophernotes/kernel/* ~/.ipython/kernels/gophernotes
19+
RUN cp -r $GOPATH/src/github.com/gopherds/gophernotes/kernel/* ~/.ipython/kernels/gophernotes
2020

2121
EXPOSE 8888
2222
CMD ["jupyter", "notebook"]

examples/Feed-Forward-Recurrent-NN.ipynb

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,10 @@
88
},
99
"outputs": [],
1010
"source": [
11-
":import \"github.com/goml/gobrain\""
12-
]
13-
},
14-
{
15-
"cell_type": "code",
16-
"execution_count": 2,
17-
"metadata": {
18-
"collapsed": true
19-
},
20-
"outputs": [],
21-
"source": [
22-
":import \"math/rand\""
11+
"import (\n",
12+
" \"math/rand\"\n",
13+
" \"github.com/goml/gobrain\"\n",
14+
")"
2315
]
2416
},
2517
{
@@ -68,7 +60,7 @@
6860
},
6961
{
7062
"cell_type": "code",
71-
"execution_count": 3,
63+
"execution_count": 2,
7264
"metadata": {
7365
"collapsed": true
7466
},
@@ -80,7 +72,7 @@
8072
},
8173
{
8274
"cell_type": "code",
83-
"execution_count": 4,
75+
"execution_count": 3,
8476
"metadata": {
8577
"collapsed": false
8678
},
@@ -104,7 +96,7 @@
10496
"}\n"
10597
]
10698
},
107-
"execution_count": 4,
99+
"execution_count": 3,
108100
"metadata": {},
109101
"output_type": "execute_result"
110102
}
@@ -124,7 +116,7 @@
124116
},
125117
{
126118
"cell_type": "code",
127-
"execution_count": 5,
119+
"execution_count": 4,
128120
"metadata": {
129121
"collapsed": true
130122
},
@@ -138,7 +130,7 @@
138130
},
139131
{
140132
"cell_type": "code",
141-
"execution_count": 6,
133+
"execution_count": 5,
142134
"metadata": {
143135
"collapsed": false
144136
},
@@ -153,7 +145,7 @@
153145
"[1 1] -> [0.09740879532462095] : [0]\n"
154146
]
155147
},
156-
"execution_count": 6,
148+
"execution_count": 5,
157149
"metadata": {},
158150
"output_type": "execute_result"
159151
}
@@ -211,7 +203,7 @@
211203
},
212204
{
213205
"cell_type": "code",
214-
"execution_count": 7,
206+
"execution_count": 6,
215207
"metadata": {
216208
"collapsed": false
217209
},
@@ -226,7 +218,7 @@
226218
"[1 1] -> [0.09740879532462095] : [0]\n"
227219
]
228220
},
229-
"execution_count": 7,
221+
"execution_count": 6,
230222
"metadata": {},
231223
"output_type": "execute_result"
232224
}

examples/Pattern-Recognition.ipynb

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,12 @@
1515
},
1616
"outputs": [],
1717
"source": [
18-
":import \"fmt\""
19-
]
20-
},
21-
{
22-
"cell_type": "code",
23-
"execution_count": 2,
24-
"metadata": {
25-
"collapsed": false
26-
},
27-
"outputs": [],
28-
"source": [
29-
":import \"github.com/sjwhitworth/golearn/base\""
30-
]
31-
},
32-
{
33-
"cell_type": "code",
34-
"execution_count": 3,
35-
"metadata": {
36-
"collapsed": true
37-
},
38-
"outputs": [],
39-
"source": [
40-
":import \"github.com/sjwhitworth/golearn/evaluation\""
41-
]
42-
},
43-
{
44-
"cell_type": "code",
45-
"execution_count": 4,
46-
"metadata": {
47-
"collapsed": true
48-
},
49-
"outputs": [],
50-
"source": [
51-
":import \"github.com/sjwhitworth/golearn/knn\""
18+
"import (\n",
19+
" \"fmt\"\n",
20+
" \"github.com/sjwhitworth/golearn/base\"\n",
21+
" \"github.com/sjwhitworth/golearn/evaluation\"\n",
22+
" \"github.com/sjwhitworth/golearn/knn\"\n",
23+
")"
5224
]
5325
},
5426
{
@@ -125,7 +97,7 @@
12597
},
12698
{
12799
"cell_type": "code",
128-
"execution_count": 5,
100+
"execution_count": 2,
129101
"metadata": {
130102
"collapsed": false
131103
},
@@ -224,13 +196,13 @@
224196
"Reference Class\tTrue Positives\tFalse Positives\tTrue Negatives\tPrecision\tRecall\tF1 Score\n",
225197
"---------------\t--------------\t---------------\t--------------\t---------\t------\t--------\n",
226198
"Iris-setosa\t30\t\t0\t\t58\t\t1.0000\t\t1.0000\t1.0000\n",
227-
"Iris-virginica\t27\t\t1\t\t58\t\t0.9643\t\t0.9310\t0.9474\n",
228-
"Iris-versicolor\t28\t\t2\t\t57\t\t0.9333\t\t0.9655\t0.9492\n",
229-
"Overall accuracy: 0.9659\n",
199+
"Iris-virginica\t28\t\t1\t\t58\t\t0.9655\t\t0.9655\t0.9655\n",
200+
"Iris-versicolor\t28\t\t1\t\t58\t\t0.9655\t\t0.9655\t0.9655\n",
201+
"Overall accuracy: 0.9773\n",
230202
"\n"
231203
]
232204
},
233-
"execution_count": 5,
205+
"execution_count": 2,
234206
"metadata": {},
235207
"output_type": "execute_result"
236208
}
@@ -239,7 +211,7 @@
239211
"// Load in a dataset, with headers. Header attributes will be stored.\n",
240212
"// Think of instances as a Data Frame structure in R or Pandas.\n",
241213
"// You can also create instances from scratch.\n",
242-
"rawData, err := base.ParseCSVToInstances(\"datasets/iris.csv\", false)\n",
214+
"rawData, err := base.ParseCSVToInstances(\"iris.csv\", false)\n",
243215
"\n",
244216
"//Initialises a new KNN classifier\n",
245217
"cls := knn.NewKnnClassifier(\"euclidean\", 2)\n",

examples/Simple-Example.ipynb

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"outputs": [],
1717
"source": [
18-
":import \"fmt\""
18+
"import \"fmt\""
1919
]
2020
},
2121
{
@@ -93,7 +93,7 @@
9393
{
9494
"data": {
9595
"text/plain": [
96-
"(\u001b[32mchan string\u001b[0m)(\u001b[34m\u001b[1m0xc820018120\u001b[0m)\n"
96+
"(\u001b[32mchan string\u001b[0m)(\u001b[34m\u001b[1m0xc4200180c0\u001b[0m)\n"
9797
]
9898
},
9999
"execution_count": 4,
@@ -137,15 +137,6 @@
137137
"source": [
138138
"msg := <- messages"
139139
]
140-
},
141-
{
142-
"cell_type": "code",
143-
"execution_count": null,
144-
"metadata": {
145-
"collapsed": true
146-
},
147-
"outputs": [],
148-
"source": []
149140
}
150141
],
151142
"metadata": {

examples/Stateful-Goroutines.ipynb

Lines changed: 18 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,12 @@
2424
},
2525
"outputs": [],
2626
"source": [
27-
":import \"fmt\""
28-
]
29-
},
30-
{
31-
"cell_type": "code",
32-
"execution_count": 2,
33-
"metadata": {
34-
"collapsed": true
35-
},
36-
"outputs": [],
37-
"source": [
38-
":import \"math/rand\""
39-
]
40-
},
41-
{
42-
"cell_type": "code",
43-
"execution_count": 3,
44-
"metadata": {
45-
"collapsed": true
46-
},
47-
"outputs": [],
48-
"source": [
49-
":import \"sync/atomic\""
50-
]
51-
},
52-
{
53-
"cell_type": "code",
54-
"execution_count": 4,
55-
"metadata": {
56-
"collapsed": true
57-
},
58-
"outputs": [],
59-
"source": [
60-
":import \"time\""
27+
"import (\n",
28+
" \"fmt\"\n",
29+
" \"math/rand\"\n",
30+
" \"sync/atomic\"\n",
31+
" \"time\"\n",
32+
")"
6133
]
6234
},
6335
{
@@ -76,7 +48,7 @@
7648
},
7749
{
7850
"cell_type": "code",
79-
"execution_count": 5,
51+
"execution_count": 2,
8052
"metadata": {
8153
"collapsed": true
8254
},
@@ -90,7 +62,7 @@
9062
},
9163
{
9264
"cell_type": "code",
93-
"execution_count": 6,
65+
"execution_count": 3,
9466
"metadata": {
9567
"collapsed": true
9668
},
@@ -119,7 +91,7 @@
11991
},
12092
{
12193
"cell_type": "code",
122-
"execution_count": 7,
94+
"execution_count": 4,
12395
"metadata": {
12496
"collapsed": true
12597
},
@@ -137,18 +109,18 @@
137109
},
138110
{
139111
"cell_type": "code",
140-
"execution_count": 8,
112+
"execution_count": 5,
141113
"metadata": {
142114
"collapsed": false
143115
},
144116
"outputs": [
145117
{
146118
"data": {
147119
"text/plain": [
148-
"(chan *main.\u001b[32mwriteOp\u001b[0m)(\u001b[34m\u001b[1m0xc820018180\u001b[0m)\n"
120+
"(chan *main.\u001b[32mwriteOp\u001b[0m)(\u001b[34m\u001b[1m0xc420018120\u001b[0m)\n"
149121
]
150122
},
151-
"execution_count": 8,
123+
"execution_count": 5,
152124
"metadata": {},
153125
"output_type": "execute_result"
154126
}
@@ -174,7 +146,7 @@
174146
},
175147
{
176148
"cell_type": "code",
177-
"execution_count": 9,
149+
"execution_count": 6,
178150
"metadata": {
179151
"collapsed": true
180152
},
@@ -203,7 +175,7 @@
203175
},
204176
{
205177
"cell_type": "code",
206-
"execution_count": 10,
178+
"execution_count": 7,
207179
"metadata": {
208180
"collapsed": true
209181
},
@@ -232,7 +204,7 @@
232204
},
233205
{
234206
"cell_type": "code",
235-
"execution_count": 11,
207+
"execution_count": 8,
236208
"metadata": {
237209
"collapsed": true
238210
},
@@ -271,18 +243,18 @@
271243
},
272244
{
273245
"cell_type": "code",
274-
"execution_count": 12,
246+
"execution_count": 9,
275247
"metadata": {
276248
"collapsed": false
277249
},
278250
"outputs": [
279251
{
280252
"data": {
281253
"text/plain": [
282-
"\u001b[34m\u001b[1m892297\u001b[0m\n"
254+
"\u001b[34m\u001b[1m918893\u001b[0m\n"
283255
]
284256
},
285-
"execution_count": 12,
257+
"execution_count": 9,
286258
"metadata": {},
287259
"output_type": "execute_result"
288260
}

0 commit comments

Comments
 (0)