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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -0
  3. data/lib/yhat.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd2847f0420ea6318ec9fc960bca45dfa437c1f0
4
- data.tar.gz: 0dbf843daadb93fdce811851656f36a81734f199
3
+ metadata.gz: d47e840e8854bef124120d254f3aa8669148502a
4
+ data.tar.gz: 9b1dd25e7c67b995cc9e5f7ff11c690acd52f2e8
5
5
  SHA512:
6
- metadata.gz: b5b549913aaaaa784851a6638fc69cc94d5618eb3596ef32415e0caf8e0447856b4e8771717230243d62cda5a417df756ab3fec43dc0daf6ad8ab8be541d0c30
7
- data.tar.gz: 225cceee507057ec30e3c30062932a42e559f00570bf116000a587057f347e217cad093e8837b4f79e3cf42423fb8af250284b10d8dea928e7a18c4e2246a779
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yhat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Lamp