yhat 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/README.md +21 -0
- data/lib/yhat.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d47e840e8854bef124120d254f3aa8669148502a
|
4
|
+
data.tar.gz: 9b1dd25e7c67b995cc9e5f7ff11c690acd52f2e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec54f006fda72ca5a054c2078fa90dde893fc9a5607203b6d4c5ed73d91533bbb87c221a19129d057f8d57ae19721ddc369f2e4e11bc364cf0276030447a5e6f
|
7
|
+
data.tar.gz: ad23210545a3b03d911e596e0bae166993e6752abbf28fc45d6c1f46488432513419b545a94917e6a1ba48cd6f9423f3c7f1ab4130672840bbe905925891b54f
|
data/README.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
1
|
# yhat-ruby
|
2
2
|
A ruby wrapper for the Yhat API.
|
3
3
|
|
4
|
+
### Making a prediction
|
5
|
+
|
6
|
+
$ irb
|
7
|
+
> require 'yhat'
|
8
|
+
> require 'pp'
|
9
|
+
> yh = Yhat.new("greg", "testing123", "http://yhat.enterprise-01.us-west-1.elb.amazonaws.com/")
|
10
|
+
> pp(yh.predict("PydataBeerRec", { "beer" => "Coors Light" }.to_json))
|
11
|
+
{"yhat_id"=>"b6d9ba8f-81bd-4d6c-bcca-17315faa4299",
|
12
|
+
"result"=>
|
13
|
+
[["Coors Light", "Natural Light", 13.10332],
|
14
|
+
["Coors Light", "Michelob Ultra", 13.58854],
|
15
|
+
["Coors Light", "Bud Light", 18.89981],
|
16
|
+
["Coors Light", "Fat Tire Amber Ale", 35.31271],
|
17
|
+
["Coors Light", "Blue Moon Belgian White", 35.50784],
|
18
|
+
["Coors Light", "Dale's Pale Ale", 36.80674],
|
19
|
+
["Coors Light", "Guinness Draught", 41.04731],
|
20
|
+
["Coors Light", "60 Minute IPA", 47.50289],
|
21
|
+
["Coors Light", "Sierra Nevada Pale Ale", 51.62802]]}
|
22
|
+
|
23
|
+
### TODO:
|
24
|
+
- add websocket client support
|
data/lib/yhat.rb
CHANGED
@@ -32,7 +32,7 @@ class Yhat
|
|
32
32
|
http = Net::HTTP.new(uri.host, uri.port)
|
33
33
|
request = Net::HTTP::Post.new("/models/" + modelname + "/")
|
34
34
|
request.add_field('Content-Type', 'application/json')
|
35
|
-
request.body = data
|
35
|
+
request.body = data.to_json
|
36
36
|
response = http.request(request)
|
37
37
|
data = response.body
|
38
38
|
JSON.parse(data)
|