big_ml 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. data/.gitignore +19 -0
  2. data/.rspec +2 -0
  3. data/.rvmrc +1 -0
  4. data/.rvmrc.example +1 -0
  5. data/.travis.yml +4 -0
  6. data/CHANGELOG.md +8 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE +22 -0
  9. data/README.md +49 -0
  10. data/Rakefile +6 -0
  11. data/TODO.md +6 -0
  12. data/big_ml.gemspec +23 -0
  13. data/lib/big_ml/authenticable.rb +10 -0
  14. data/lib/big_ml/base.rb +51 -0
  15. data/lib/big_ml/client.rb +29 -0
  16. data/lib/big_ml/config.rb +30 -0
  17. data/lib/big_ml/dataset.rb +19 -0
  18. data/lib/big_ml/model.rb +21 -0
  19. data/lib/big_ml/prediction.rb +19 -0
  20. data/lib/big_ml/request.rb +29 -0
  21. data/lib/big_ml/source.rb +18 -0
  22. data/lib/big_ml/version.rb +3 -0
  23. data/lib/big_ml.rb +13 -0
  24. data/spec/fixtures/iris.csv +151 -0
  25. data/spec/integration/dataset_spec.rb +51 -0
  26. data/spec/integration/model_spec.rb +53 -0
  27. data/spec/integration/prediction_spec.rb +55 -0
  28. data/spec/integration/source_spec.rb +55 -0
  29. data/spec/spec_helper.rb +22 -0
  30. data/spec/units/client_spec.rb +50 -0
  31. data/spec/units/source_spec.rb +20 -0
  32. data/spec/vcr_cassettes/BigML_Dataset/no_dataset/_all/must_be_empty.yml +136 -0
  33. data/spec/vcr_cassettes/BigML_Dataset/one_dataset/must_be_able_to_be_find_using_the_reference.yml +293 -0
  34. data/spec/vcr_cassettes/BigML_Dataset/one_dataset/must_be_able_to_remove_the_dataset.yml +318 -0
  35. data/spec/vcr_cassettes/BigML_Dataset/one_dataset/must_be_able_to_update_the_name.yml +360 -0
  36. data/spec/vcr_cassettes/BigML_Dataset/one_dataset/must_have_only_one_item.yml +265 -0
  37. data/spec/vcr_cassettes/BigML_Dataset/one_dataset/must_have_the_same_file_name.yml +265 -0
  38. data/spec/vcr_cassettes/BigML_Dataset/one_dataset/was_created_successfully.yml +149 -0
  39. data/spec/vcr_cassettes/BigML_Model/no_model/_all/must_be_empty.yml +166 -0
  40. data/spec/vcr_cassettes/BigML_Model/one_model/must_be_able_to_be_find_using_the_reference.yml +446 -0
  41. data/spec/vcr_cassettes/BigML_Model/one_model/must_be_able_to_remove_the_model.yml +426 -0
  42. data/spec/vcr_cassettes/BigML_Model/one_model/must_be_able_to_update_the_name.yml +558 -0
  43. data/spec/vcr_cassettes/BigML_Model/one_model/must_have_only_one_item.yml +258 -0
  44. data/spec/vcr_cassettes/BigML_Model/one_model/must_have_the_same_file_name.yml +375 -0
  45. data/spec/vcr_cassettes/BigML_Model/one_model/must_have_the_same_size.yml +375 -0
  46. data/spec/vcr_cassettes/BigML_Model/one_model/was_created_successfully.yml +298 -0
  47. data/spec/vcr_cassettes/BigML_Prediction/no_prediction/_all/must_be_empty.yml +305 -0
  48. data/spec/vcr_cassettes/BigML_Prediction/one_prediction/must_be_able_to_be_find_using_the_reference.yml +502 -0
  49. data/spec/vcr_cassettes/BigML_Prediction/one_prediction/must_be_able_to_remove_the_prediction.yml +547 -0
  50. data/spec/vcr_cassettes/BigML_Prediction/one_prediction/must_be_able_to_update_the_name.yml +546 -0
  51. data/spec/vcr_cassettes/BigML_Prediction/one_prediction/must_have_only_one_item.yml +503 -0
  52. data/spec/vcr_cassettes/BigML_Prediction/one_prediction/must_have_the_same_name.yml +420 -0
  53. data/spec/vcr_cassettes/BigML_Prediction/one_prediction/was_created_successfully.yml +297 -0
  54. data/spec/vcr_cassettes/BigML_Source/no_source/_all/must_be_empty.yml +136 -0
  55. data/spec/vcr_cassettes/BigML_Source/one_source/must_be_able_to_be_find_using_the_reference.yml +191 -0
  56. data/spec/vcr_cassettes/BigML_Source/one_source/must_be_able_to_remove_the_source.yml +195 -0
  57. data/spec/vcr_cassettes/BigML_Source/one_source/must_be_able_to_update_the_name.yml +279 -0
  58. data/spec/vcr_cassettes/BigML_Source/one_source/must_have_only_one_item.yml +192 -0
  59. data/spec/vcr_cassettes/BigML_Source/one_source/must_have_the_same_file_name.yml +192 -0
  60. data/spec/vcr_cassettes/BigML_Source/one_source/was_created_successfully.yml +105 -0
  61. metadata +224 -0
@@ -0,0 +1,420 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://bigml.io/andromeda/source?username=<USERNAME>&api_key=<API_KEY>
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ connection:
11
+ - close
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ content-type:
18
+ - application/json; charset=utf-8
19
+ date:
20
+ - Wed, 20 Jun 2012 04:09:15 GMT
21
+ server:
22
+ - nginx/1.0.12
23
+ transfer-encoding:
24
+ - chunked
25
+ connection:
26
+ - Close
27
+ body:
28
+ encoding: US-ASCII
29
+ string: ! '{"meta": {"limit": 20, "next": null, "offset": 0, "previous": null,
30
+ "total_count": 1}, "objects": [{"category": 0, "code": 200, "content_type":
31
+ "application/octet-stream", "created": "2012-06-20T04:12:15.053000", "credits":
32
+ 0.0, "description": "", "fields": {"000000": {"column_number": 0, "name":
33
+ "sepal length", "optype": "numeric"}, "000001": {"column_number": 1, "name":
34
+ "sepal width", "optype": "numeric"}, "000002": {"column_number": 2, "name":
35
+ "petal length", "optype": "numeric"}, "000003": {"column_number": 3, "name":
36
+ "petal width", "optype": "numeric"}, "000004": {"column_number": 4, "name":
37
+ "species", "optype": "categorical"}}, "file_name": "iris.csv", "md5": "d1175c032e1042bec7f974c91e4a65ae",
38
+ "name": "iris.csv", "number_of_datasets": 1, "number_of_models": 0, "number_of_predictions":
39
+ 0, "private": true, "resource": "source/4fe14d9f1552687d4300014b", "size":
40
+ 4608, "source_parser": {"header": true, "locale": "en_US", "missing_tokens":
41
+ ["", "N/A", "n/a", "NULL", "null", "-", "#DIV/0", "#REF!", "#NAME?", "NIL",
42
+ "nil", "NA", "na", "#VALUE!", "#NULL!", "NaN", "#N/A", "#NUM!", "?"], "quote":
43
+ "\"", "separator": ","}, "status": {"code": 5, "elapsed": 66, "message": "The
44
+ source has been created"}, "tags": [], "type": 0, "updated": "2012-06-20T04:12:16.612000"}]}'
45
+ http_version: '1.1'
46
+ recorded_at: Wed, 20 Jun 2012 04:13:06 GMT
47
+ - request:
48
+ method: delete
49
+ uri: https://bigml.io/andromeda/source/4fe14d9f1552687d4300014b?username=<USERNAME>&api_key=<API_KEY>
50
+ body:
51
+ encoding: US-ASCII
52
+ string: ''
53
+ headers:
54
+ connection:
55
+ - close
56
+ response:
57
+ status:
58
+ code: 204
59
+ message: NO CONTENT
60
+ headers:
61
+ content-length:
62
+ - '0'
63
+ content-type:
64
+ - text/html; charset=utf-8
65
+ date:
66
+ - Wed, 20 Jun 2012 04:11:37 GMT
67
+ server:
68
+ - nginx/1.0.12
69
+ connection:
70
+ - Close
71
+ body:
72
+ encoding: US-ASCII
73
+ string: ''
74
+ http_version: '1.1'
75
+ recorded_at: Wed, 20 Jun 2012 04:13:08 GMT
76
+ - request:
77
+ method: get
78
+ uri: https://bigml.io/andromeda/dataset?username=<USERNAME>&api_key=<API_KEY>
79
+ body:
80
+ encoding: US-ASCII
81
+ string: ''
82
+ headers:
83
+ connection:
84
+ - close
85
+ response:
86
+ status:
87
+ code: 200
88
+ message: OK
89
+ headers:
90
+ content-type:
91
+ - application/json; charset=utf-8
92
+ date:
93
+ - Wed, 20 Jun 2012 04:09:19 GMT
94
+ server:
95
+ - nginx/1.0.12
96
+ content-length:
97
+ - '605'
98
+ connection:
99
+ - Close
100
+ body:
101
+ encoding: US-ASCII
102
+ string: ! '{"meta": {"limit": 20, "next": null, "offset": 0, "previous": null,
103
+ "total_count": 1}, "objects": [{"category": 0, "code": 200, "columns": 0,
104
+ "created": "2012-06-20T04:12:16.604000", "credits": 0.0087890625, "description":
105
+ "", "locale": "en-US", "name": "iris'' dataset", "number_of_models": 0, "number_of_predictions":
106
+ 0, "private": true, "resource": "dataset/4fe14da01552687d47000127", "rows":
107
+ 0, "size": 4608, "source": "source/4fe14d9f1552687d4300014b", "source_status":
108
+ false, "status": {"code": -1, "message": "Bad request to create a dataset"},
109
+ "tags": [], "updated": "2012-06-20T04:12:17.459000"}]}'
110
+ http_version: '1.1'
111
+ recorded_at: Wed, 20 Jun 2012 04:13:09 GMT
112
+ - request:
113
+ method: delete
114
+ uri: https://bigml.io/andromeda/dataset/4fe14da01552687d47000127?username=<USERNAME>&api_key=<API_KEY>
115
+ body:
116
+ encoding: US-ASCII
117
+ string: ''
118
+ headers:
119
+ connection:
120
+ - close
121
+ response:
122
+ status:
123
+ code: 204
124
+ message: NO CONTENT
125
+ headers:
126
+ content-length:
127
+ - '0'
128
+ content-type:
129
+ - text/html; charset=utf-8
130
+ date:
131
+ - Wed, 20 Jun 2012 04:11:41 GMT
132
+ server:
133
+ - nginx/1.0.12
134
+ connection:
135
+ - Close
136
+ body:
137
+ encoding: US-ASCII
138
+ string: ''
139
+ http_version: '1.1'
140
+ recorded_at: Wed, 20 Jun 2012 04:13:12 GMT
141
+ - request:
142
+ method: get
143
+ uri: https://bigml.io/andromeda/model?username=<USERNAME>&api_key=<API_KEY>
144
+ body:
145
+ encoding: US-ASCII
146
+ string: ''
147
+ headers:
148
+ connection:
149
+ - close
150
+ response:
151
+ status:
152
+ code: 200
153
+ message: OK
154
+ headers:
155
+ content-type:
156
+ - application/json; charset=utf-8
157
+ date:
158
+ - Wed, 20 Jun 2012 04:09:22 GMT
159
+ server:
160
+ - nginx/1.0.12
161
+ content-length:
162
+ - '101'
163
+ connection:
164
+ - Close
165
+ body:
166
+ encoding: US-ASCII
167
+ string: ! '{"meta": {"limit": 20, "next": null, "offset": 0, "previous": null,
168
+ "total_count": 0}, "objects": []}'
169
+ http_version: '1.1'
170
+ recorded_at: Wed, 20 Jun 2012 04:13:13 GMT
171
+ - request:
172
+ method: get
173
+ uri: https://bigml.io/andromeda/prediction?username=<USERNAME>&api_key=<API_KEY>
174
+ body:
175
+ encoding: US-ASCII
176
+ string: ''
177
+ headers:
178
+ connection:
179
+ - close
180
+ response:
181
+ status:
182
+ code: 200
183
+ message: OK
184
+ headers:
185
+ content-type:
186
+ - application/json; charset=utf-8
187
+ date:
188
+ - Wed, 20 Jun 2012 04:11:45 GMT
189
+ server:
190
+ - nginx/1.0.12
191
+ content-length:
192
+ - '101'
193
+ connection:
194
+ - Close
195
+ body:
196
+ encoding: US-ASCII
197
+ string: ! '{"meta": {"limit": 20, "next": null, "offset": 0, "previous": null,
198
+ "total_count": 0}, "objects": []}'
199
+ http_version: '1.1'
200
+ recorded_at: Wed, 20 Jun 2012 04:13:16 GMT
201
+ - request:
202
+ method: post
203
+ uri: https://bigml.io/andromeda/source
204
+ body:
205
+ encoding: US-ASCII
206
+ string: ''
207
+ headers:
208
+ content-type:
209
+ - multipart/form-data; boundary=-----------RubyMultipartPost
210
+ content-length:
211
+ - '5147'
212
+ connection:
213
+ - close
214
+ response:
215
+ status:
216
+ code: 201
217
+ message: CREATED
218
+ headers:
219
+ content-type:
220
+ - application/json; charset=utf-8
221
+ date:
222
+ - Wed, 20 Jun 2012 04:09:27 GMT
223
+ location:
224
+ - http://bigml.io/andromeda/source/4fe14dd2035d074a1c000116
225
+ server:
226
+ - nginx/1.0.12
227
+ content-length:
228
+ - '567'
229
+ connection:
230
+ - Close
231
+ body:
232
+ encoding: US-ASCII
233
+ string: ! '{"category": 0, "code": 201, "content_type": "application/octet-stream",
234
+ "created": "2012-06-20T04:13:06.811958", "credits": 0.0, "description": "",
235
+ "file_name": "iris.csv", "md5": "d1175c032e1042bec7f974c91e4a65ae", "name":
236
+ "iris.csv", "number_of_datasets": 0, "number_of_models": 0, "number_of_predictions":
237
+ 0, "private": true, "resource": "source/4fe14dd2035d074a1c000116", "size":
238
+ 4608, "source_parser": {}, "status": {"code": 1, "message": "The request has
239
+ been queued and will be processed soon"}, "tags": [], "type": 0, "updated":
240
+ "2012-06-20T04:13:06.811991"}'
241
+ http_version: '1.1'
242
+ recorded_at: Wed, 20 Jun 2012 04:13:18 GMT
243
+ - request:
244
+ method: post
245
+ uri: https://bigml.io/andromeda/dataset?username=<USERNAME>&api_key=<API_KEY>
246
+ body:
247
+ encoding: UTF-8
248
+ string: ! '{"source":"source/4fe14dd2035d074a1c000116"}'
249
+ headers:
250
+ content-type:
251
+ - application/json
252
+ connection:
253
+ - close
254
+ response:
255
+ status:
256
+ code: 201
257
+ message: CREATED
258
+ headers:
259
+ content-type:
260
+ - application/json; charset=utf-8
261
+ date:
262
+ - Wed, 20 Jun 2012 04:11:50 GMT
263
+ location:
264
+ - http://bigml.io/andromeda/dataset/4fe14df11552687d4300014e
265
+ server:
266
+ - nginx/1.0.12
267
+ content-length:
268
+ - '920'
269
+ connection:
270
+ - Close
271
+ body:
272
+ encoding: US-ASCII
273
+ string: ! '{"category": 0, "code": 201, "columns": 5, "created": "2012-06-20T04:13:37.353350",
274
+ "credits": 0.0087890625, "description": "", "fields": {"000000": {"column_number":
275
+ 0, "name": "sepal length", "optype": "numeric"}, "000001": {"column_number":
276
+ 1, "name": "sepal width", "optype": "numeric"}, "000002": {"column_number":
277
+ 2, "name": "petal length", "optype": "numeric"}, "000003": {"column_number":
278
+ 3, "name": "petal width", "optype": "numeric"}, "000004": {"column_number":
279
+ 4, "name": "species", "optype": "categorical"}}, "locale": "en_US", "name":
280
+ "iris'' dataset", "number_of_models": 0, "number_of_predictions": 0, "private":
281
+ true, "resource": "dataset/4fe14df11552687d4300014e", "rows": 0, "size": 4608,
282
+ "source": "source/4fe14dd2035d074a1c000116", "source_status": true, "status":
283
+ {"code": 1, "message": "The dataset is being processed and will be created
284
+ soon"}, "tags": [], "updated": "2012-06-20T04:13:37.353382"}'
285
+ http_version: '1.1'
286
+ recorded_at: Wed, 20 Jun 2012 04:13:20 GMT
287
+ - request:
288
+ method: post
289
+ uri: https://bigml.io/andromeda/model?username=<USERNAME>&api_key=<API_KEY>
290
+ body:
291
+ encoding: UTF-8
292
+ string: ! '{"dataset":"dataset/4fe14df11552687d4300014e"}'
293
+ headers:
294
+ content-type:
295
+ - application/json
296
+ connection:
297
+ - close
298
+ response:
299
+ status:
300
+ code: 201
301
+ message: CREATED
302
+ headers:
303
+ content-type:
304
+ - application/json; charset=utf-8
305
+ date:
306
+ - Wed, 20 Jun 2012 04:09:31 GMT
307
+ location:
308
+ - http://bigml.io/andromeda/model/4fe14df31552687d48000120
309
+ server:
310
+ - nginx/1.0.12
311
+ content-length:
312
+ - '690'
313
+ connection:
314
+ - Close
315
+ body:
316
+ encoding: US-ASCII
317
+ string: ! '{"category": 0, "code": 201, "columns": 5, "created": "2012-06-20T04:13:39.327677",
318
+ "credits": 0.03515625, "dataset": "dataset/4fe14df11552687d4300014e", "dataset_status":
319
+ true, "description": "", "holdout": 0.0, "input_fields": [], "locale": "en_US",
320
+ "max_columns": 5, "max_rows": 150, "name": "iris'' dataset model", "number_of_predictions":
321
+ 0, "objective_fields": [], "private": true, "range": [1, 150], "resource":
322
+ "model/4fe14df31552687d48000120", "rows": 150, "size": 4608, "source": "source/4fe14dd2035d074a1c000116",
323
+ "source_status": true, "status": {"code": 1, "message": "The model is being
324
+ processed and will be created soon"}, "tags": [], "updated": "2012-06-20T04:13:39.327695"}'
325
+ http_version: '1.1'
326
+ recorded_at: Wed, 20 Jun 2012 04:13:22 GMT
327
+ - request:
328
+ method: post
329
+ uri: https://bigml.io/andromeda/prediction?username=<USERNAME>&api_key=<API_KEY>
330
+ body:
331
+ encoding: UTF-8
332
+ string: ! '{"model":"model/4fe14df31552687d48000120","input_data":{"000001":3}}'
333
+ headers:
334
+ content-type:
335
+ - application/json
336
+ connection:
337
+ - close
338
+ response:
339
+ status:
340
+ code: 201
341
+ message: CREATED
342
+ headers:
343
+ content-type:
344
+ - application/json; charset=utf-8
345
+ date:
346
+ - Wed, 20 Jun 2012 04:11:59 GMT
347
+ location:
348
+ - http://bigml.io/andromeda/prediction/4fe14ddd035d074a1b00012e
349
+ server:
350
+ - nginx/1.0.12
351
+ content-length:
352
+ - '1222'
353
+ connection:
354
+ - Close
355
+ body:
356
+ encoding: US-ASCII
357
+ string: ! '{"category": 0, "code": 201, "created": "2012-06-20T04:13:17.097105",
358
+ "credits": 0.01, "dataset": "dataset/4fe14df11552687d4300014e", "dataset_status":
359
+ true, "description": "", "fields": {"000001": {"column_number": 1, "datatype":
360
+ "double", "name": "sepal width", "optype": "numeric", "preferred": true},
361
+ "000002": {"column_number": 2, "datatype": "double", "name": "petal length",
362
+ "optype": "numeric", "preferred": true}, "000004": {"column_number": 4, "datatype":
363
+ "string", "name": "species", "optype": "categorical", "preferred": true}},
364
+ "input_data": {"000001": 3}, "locale": "en_US", "model": "model/4fe14df31552687d48000120",
365
+ "model_status": true, "name": "Prediction for species", "objective_fields":
366
+ ["000004"], "prediction": {"000004": "Iris-virginica"}, "prediction_path":
367
+ {"bad_fields": [], "next_predicates": [{"field": "000002", "operator": ">",
368
+ "value": 2.45}, {"field": "000002", "operator": "<=", "value": 2.45}], "path":
369
+ [], "unknown_fields": []}, "private": true, "resource": "prediction/4fe14ddd035d074a1b00012e",
370
+ "source": "source/4fe14dd2035d074a1c000116", "source_status": true, "status":
371
+ {"code": 5, "message": "The prediction has been created"}, "tags": [], "updated":
372
+ "2012-06-20T04:13:17.097129"}'
373
+ http_version: '1.1'
374
+ recorded_at: Wed, 20 Jun 2012 04:13:30 GMT
375
+ - request:
376
+ method: get
377
+ uri: https://bigml.io/andromeda/prediction?username=<USERNAME>&api_key=<API_KEY>
378
+ body:
379
+ encoding: US-ASCII
380
+ string: ''
381
+ headers:
382
+ connection:
383
+ - close
384
+ response:
385
+ status:
386
+ code: 200
387
+ message: OK
388
+ headers:
389
+ content-type:
390
+ - application/json; charset=utf-8
391
+ date:
392
+ - Wed, 20 Jun 2012 04:09:41 GMT
393
+ server:
394
+ - nginx/1.0.12
395
+ content-length:
396
+ - '1323'
397
+ connection:
398
+ - Close
399
+ body:
400
+ encoding: US-ASCII
401
+ string: ! '{"meta": {"limit": 20, "next": null, "offset": 0, "previous": null,
402
+ "total_count": 1}, "objects": [{"category": 0, "code": 200, "created": "2012-06-20T04:13:17.097000",
403
+ "credits": 0.01, "dataset": "dataset/4fe14df11552687d4300014e", "dataset_status":
404
+ true, "description": "", "fields": {"000001": {"column_number": 1, "datatype":
405
+ "double", "name": "sepal width", "optype": "numeric", "preferred": true},
406
+ "000002": {"column_number": 2, "datatype": "double", "name": "petal length",
407
+ "optype": "numeric", "preferred": true}, "000004": {"column_number": 4, "datatype":
408
+ "string", "name": "species", "optype": "categorical", "preferred": true}},
409
+ "input_data": {"000001": 3}, "locale": "en_US", "model": "model/4fe14df31552687d48000120",
410
+ "model_status": true, "name": "Prediction for species", "objective_fields":
411
+ ["000004"], "prediction": {"000004": "Iris-virginica"}, "prediction_path":
412
+ {"bad_fields": [], "next_predicates": [{"field": "000002", "operator": ">",
413
+ "value": 2.45}, {"field": "000002", "operator": "<=", "value": 2.45}], "path":
414
+ [], "unknown_fields": []}, "private": true, "resource": "prediction/4fe14ddd035d074a1b00012e",
415
+ "source": "source/4fe14dd2035d074a1c000116", "source_status": true, "status":
416
+ {"code": 5, "message": "The prediction has been created"}, "tags": [], "updated":
417
+ "2012-06-20T04:13:17.097000"}]}'
418
+ http_version: '1.1'
419
+ recorded_at: Wed, 20 Jun 2012 04:13:31 GMT
420
+ recorded_with: VCR 2.2.2