Class: Glowfish::API

Inherits:
Object
  • Object
show all
Defined in:
lib/glowfish.rb

Constant Summary collapse

@@url =
"https://api.glowfi.sh/"
@@v =
"v1"

Instance Method Summary collapse

Constructor Details

#initialize(sid = nil, token = nil) ⇒ API

Returns a new instance of API.



12
13
14
15
# File 'lib/glowfish.rb', line 12

def initialize(sid = nil, token = nil)
	@sid = sid
	@token = token
end

Instance Method Details

#cluster(data_set = {}, params = {}) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/glowfish.rb', line 33

def cluster(data_set = {}, params = {})
	data = Hash.new("data")
	data = {"data_set" => data_set}
	data.merge!(params)

	return _request("cluster", data)
end

#feature_select(data_set = {}, response = nil, params = {}) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/glowfish.rb', line 41

def feature_select(data_set = {}, response = nil, params = {})
	data = Hash.new("data")
	data = {"data_set" => data_set, "response" => response}
	data.merge!(params)

	return _request("feature_select", data)
end

#filter_predict(userids = [], productids = [], ratings = [], params = {}) ⇒ Object



57
58
59
60
61
62
63
# File 'lib/glowfish.rb', line 57

def filter_predict(userids = [], productids = [], ratings = [], params = {})
	data = Hash.new("data")
	data = {"userid" => userids, "productid" => productids, "ratings" => ratings}
	data.merge!(params)

	return _request("filter_predict", data)
end

#filter_train(userids = [], productids = [], ratings = [], params = {}) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/glowfish.rb', line 49

def filter_train(userids = [], productids = [], ratings = [], params = {})
	data = Hash.new("data")
	data = {"userid" => userids, "productid" => productids, "ratings" => ratings}
	data.merge!(params)

	return _request("filter_train", data)
end

#predict(data_set = {}, response = nil, params = {}) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/glowfish.rb', line 25

def predict(data_set = {}, response = nil, params = {})
	data = Hash.new("data")
	data = {"data_set" => data_set, "response" => response}
	data.merge!(params)

	return _request("predict", data)
end

#train(data_set = {}, response = {}, params = {}) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/glowfish.rb', line 17

def train(data_set = {}, response = {}, params = {})
	data = Hash.new("data")
	data = {"data_set" => data_set, "response" => response}
	data.merge!(params)

	return _request("train", data)
end