nexosis_api 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nexosis_api/algorithm.rb +22 -22
  3. data/lib/nexosis_api/algorithm_contestant.rb +43 -43
  4. data/lib/nexosis_api/calendar_jointarget.rb +35 -35
  5. data/lib/nexosis_api/classifier_result.rb +25 -25
  6. data/lib/nexosis_api/client/contest.rb +66 -66
  7. data/lib/nexosis_api/client/datasets.rb +155 -155
  8. data/lib/nexosis_api/client/imports.rb +141 -141
  9. data/lib/nexosis_api/client/models.rb +108 -108
  10. data/lib/nexosis_api/client/sessions.rb +213 -213
  11. data/lib/nexosis_api/client/views.rb +105 -105
  12. data/lib/nexosis_api/client.rb +118 -118
  13. data/lib/nexosis_api/column.rb +50 -50
  14. data/lib/nexosis_api/column_options.rb +38 -38
  15. data/lib/nexosis_api/column_role.rb +19 -19
  16. data/lib/nexosis_api/column_type.rb +23 -19
  17. data/lib/nexosis_api/dataset_data.rb +22 -22
  18. data/lib/nexosis_api/dataset_jointarget.rb +18 -18
  19. data/lib/nexosis_api/dataset_model.rb +26 -26
  20. data/lib/nexosis_api/dataset_summary.rb +33 -33
  21. data/lib/nexosis_api/http_exception.rb +28 -28
  22. data/lib/nexosis_api/impact_metric.rb +22 -22
  23. data/lib/nexosis_api/imports_response.rb +74 -79
  24. data/lib/nexosis_api/join.rb +63 -63
  25. data/lib/nexosis_api/link.rb +18 -18
  26. data/lib/nexosis_api/message.rb +19 -19
  27. data/lib/nexosis_api/metric.rb +16 -16
  28. data/lib/nexosis_api/model_summary.rb +66 -66
  29. data/lib/nexosis_api/paged_array.rb +35 -35
  30. data/lib/nexosis_api/predict_response.rb +35 -35
  31. data/lib/nexosis_api/session.rb +118 -118
  32. data/lib/nexosis_api/session_contest.rb +30 -30
  33. data/lib/nexosis_api/session_response.rb +33 -33
  34. data/lib/nexosis_api/session_result.rb +27 -27
  35. data/lib/nexosis_api/session_selection_metrics.rb +20 -20
  36. data/lib/nexosis_api/time_interval.rb +15 -15
  37. data/lib/nexosis_api/view_data.rb +14 -14
  38. data/lib/nexosis_api/view_definition.rb +64 -64
  39. data/lib/nexosis_api.rb +11 -11
  40. data/nexosisapi.gemspec +20 -20
  41. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98e972055cf506f2a4e54483c50f57605ade5992
4
- data.tar.gz: f9da5b974d540d66e589c8f09a5df16a10ff9d81
3
+ metadata.gz: 05b7aebc636b47c645dc8ca1d8440dde6c26f523
4
+ data.tar.gz: 29acd4e727fe0e346fa7fcf4d55ad51a45c3de41
5
5
  SHA512:
6
- metadata.gz: 9f763f8f98fd480d8d84e2b77ace7d8097f426ff003fc1e5bb01ad114306792ab589ef147e297e7a1684ef1ebec5e602f45c5daf5c3f9a1204ab6f78b07452bc
7
- data.tar.gz: ea5d25a7bc0502c59ac958c26af5d170e80a0ee6fa5389e395a61fed7e1e2b1cbccd6c209c44fb0b70420233156167c0b37f7497f4e272450d0f25f869d5dbd2
6
+ metadata.gz: 3dfd4f118c8a030fb867d370b3262f995d3e2ef516d8e887dc3d9e4d6a964780e40dba3e08bd399dc04613e82ca923b12f078f57dd2775bb89246f6b8f26732c
7
+ data.tar.gz: e81a1e499369c1a61e603ed0ce35da9f846718d91646cecd4bd95e0eaf3d6c346f5f558703128c92f9a8f805130db1987893302cd776e132b07595b978011290
@@ -1,22 +1,22 @@
1
- module NexosisApi
2
- # Class to parse an individual algorithm
3
- class Algorithm
4
- def initialize(algo_hash)
5
- algo_hash.each do |k, v|
6
- instance_variable_set("@#{k}", v) unless v.nil?
7
- end
8
- end
9
-
10
- # A unique identififer for the algorithm
11
- # @return [String]
12
- attr_accessor :key
13
-
14
- # A friendly name for the algorithm
15
- # @return [String]
16
- attr_accessor :name
17
-
18
- # Descriptive explanation of the algorithm implementation
19
- # @return [String]
20
- attr_accessor :description
21
- end
22
- end
1
+ module NexosisApi
2
+ # Class to parse an individual algorithm
3
+ class Algorithm
4
+ def initialize(algo_hash)
5
+ algo_hash.each do |k, v|
6
+ instance_variable_set("@#{k}", v) unless v.nil?
7
+ end
8
+ end
9
+
10
+ # A unique identififer for the algorithm
11
+ # @return [String]
12
+ attr_accessor :key
13
+
14
+ # A friendly name for the algorithm
15
+ # @return [String]
16
+ attr_accessor :name
17
+
18
+ # Descriptive explanation of the algorithm implementation
19
+ # @return [String]
20
+ attr_accessor :description
21
+ end
22
+ end
@@ -1,43 +1,43 @@
1
- module NexosisApi
2
- # Class to parse results of an algorithm run
3
- # @since 2.0.0
4
- class AlgorithmContestant
5
- def initialize(contestant_hash)
6
- contestant_hash.each do |k, v|
7
- if k.to_s == 'links'
8
- instance_variable_set("@#{k}", v.map { |l| NexosisApi::Link.new(l) unless l.nil? })
9
- elsif k.to_s == 'dataSourceProperties'
10
- @datasource_properties = v
11
- elsif k.to_s == 'algorithm'
12
- instance_variable_set("@#{k}", NexosisApi::Algorithm.new(v)) unless v.nil?
13
- else
14
- instance_variable_set("@#{k}", v)
15
- end
16
- end
17
- end
18
-
19
- # Unique identifier for this contestant
20
- attr_reader :id
21
-
22
- # Identifier of algorithm run
23
- # @return [NexosisApi::Algorithm]
24
- attr_accessor :algorithm
25
-
26
- # Name and value for metrics calculated for this algorithm
27
- # @return [Hash]
28
- attr_accessor :metrics
29
-
30
- # Relevant hypermedia as {NexosisApi::Link}
31
- # @return [Array]
32
- attr_accessor :links
33
-
34
- # Operations performed on datasource prior to run
35
- # @return [Array]
36
- attr_reader :datasource_properties
37
-
38
- # The test dataset used to score the algo
39
- # @return [Array of Hash] columnname: value hash of each observation row in test set
40
- # @note - may be nil when reviewing contestant lists
41
- attr_reader :data
42
- end
43
- end
1
+ module NexosisApi
2
+ # Class to parse results of an algorithm run
3
+ # @since 2.0.0
4
+ class AlgorithmContestant
5
+ def initialize(contestant_hash)
6
+ contestant_hash.each do |k, v|
7
+ if k.to_s == 'links'
8
+ instance_variable_set("@#{k}", v.map { |l| NexosisApi::Link.new(l) unless l.nil? })
9
+ elsif k.to_s == 'dataSourceProperties'
10
+ @datasource_properties = v
11
+ elsif k.to_s == 'algorithm'
12
+ instance_variable_set("@#{k}", NexosisApi::Algorithm.new(v)) unless v.nil?
13
+ else
14
+ instance_variable_set("@#{k}", v)
15
+ end
16
+ end
17
+ end
18
+
19
+ # Unique identifier for this contestant
20
+ attr_reader :id
21
+
22
+ # Identifier of algorithm run
23
+ # @return [NexosisApi::Algorithm]
24
+ attr_accessor :algorithm
25
+
26
+ # Name and value for metrics calculated for this algorithm
27
+ # @return [Hash]
28
+ attr_accessor :metrics
29
+
30
+ # Relevant hypermedia as {NexosisApi::Link}
31
+ # @return [Array]
32
+ attr_accessor :links
33
+
34
+ # Operations performed on datasource prior to run
35
+ # @return [Array]
36
+ attr_reader :datasource_properties
37
+
38
+ # The test dataset used to score the algo
39
+ # @return [Array of Hash] columnname: value hash of each observation row in test set
40
+ # @note - may be nil when reviewing contestant lists
41
+ attr_reader :data
42
+ end
43
+ end
@@ -1,35 +1,35 @@
1
- module NexosisApi
2
- # Specifies the details of a calendar data source to join to
3
- # @see http://docs.nexosis.com/guides/calendars
4
- # @since 1.2.3
5
- class CalendarJoinTarget
6
- def initialize(cal_join_hash)
7
- @url = cal_join_hash['url'] unless cal_join_hash.nil?
8
- @name = cal_join_hash['name'] unless cal_join_hash.nil?
9
- @timezone = cal_join_hash['timeZone'] unless cal_join_hash.nil?
10
- end
11
-
12
- # The location of a public iCal to download as the datasource
13
- # @return [String]
14
- attr_accessor :url
15
-
16
- # The name of a well-known Nexosis calendar.
17
- # @return [String]
18
- # @see http://docs.nexosis.com/guides/datasources
19
- attr_accessor :name
20
-
21
- # tz-db string name of the timezone of the calendar
22
- # @return [String]
23
- # @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
24
- attr_accessor :timezone
25
-
26
- # custom hash to match with api requests
27
- def to_hash
28
- hash = { 'calendar' => {} }
29
- hash['calendar'].store 'url', url unless url.nil?
30
- hash['calendar'].store 'name', name unless name.nil?
31
- hash['calendar'].store 'timeZone', name unless timezone.nil?
32
- hash
33
- end
34
- end
35
- end
1
+ module NexosisApi
2
+ # Specifies the details of a calendar data source to join to
3
+ # @see http://docs.nexosis.com/guides/calendars
4
+ # @since 1.2.3
5
+ class CalendarJoinTarget
6
+ def initialize(cal_join_hash)
7
+ @url = cal_join_hash['url'] unless cal_join_hash.nil?
8
+ @name = cal_join_hash['name'] unless cal_join_hash.nil?
9
+ @timezone = cal_join_hash['timeZone'] unless cal_join_hash.nil?
10
+ end
11
+
12
+ # The location of a public iCal to download as the datasource
13
+ # @return [String]
14
+ attr_accessor :url
15
+
16
+ # The name of a well-known Nexosis calendar.
17
+ # @return [String]
18
+ # @see http://docs.nexosis.com/guides/datasources
19
+ attr_accessor :name
20
+
21
+ # tz-db string name of the timezone of the calendar
22
+ # @return [String]
23
+ # @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
24
+ attr_accessor :timezone
25
+
26
+ # custom hash to match with api requests
27
+ def to_hash
28
+ hash = { 'calendar' => {} }
29
+ hash['calendar'].store 'url', url unless url.nil?
30
+ hash['calendar'].store 'name', name unless name.nil?
31
+ hash['calendar'].store 'timeZone', name unless timezone.nil?
32
+ hash
33
+ end
34
+ end
35
+ end
@@ -1,25 +1,25 @@
1
- require 'nexosis_api/session'
2
- module NexosisApi
3
- # class to hold parsed results of confusion matrix request
4
- # @since 1.4.1
5
- class ClassifierResult < Session
6
- def initialize(classify_result)
7
- classify_result.each do |k, v|
8
- if (k.to_s == 'confusionMatrix')
9
- @confusion_matrix = v
10
- elsif (k.to_s == 'classes')
11
- @classes = v
12
- end
13
- end
14
- super(classify_result)
15
- end
16
-
17
- # array of arrays to form confusion matrix results
18
- # @return [Array of Array of Int] - the class counts for expected to predicted
19
- attr_accessor :confusion_matrix
20
-
21
- # Class labels in index order of matrix arrays
22
- # @return [Array]
23
- attr_accessor :classes
24
- end
25
- end
1
+ require 'nexosis_api/session'
2
+ module NexosisApi
3
+ # class to hold parsed results of confusion matrix request
4
+ # @since 1.4.1
5
+ class ClassifierResult < Session
6
+ def initialize(classify_result)
7
+ classify_result.each do |k, v|
8
+ if (k.to_s == 'confusionMatrix')
9
+ @confusion_matrix = v
10
+ elsif (k.to_s == 'classes')
11
+ @classes = v
12
+ end
13
+ end
14
+ super(classify_result)
15
+ end
16
+
17
+ # array of arrays to form confusion matrix results
18
+ # @return [Array of Array of Int] - the class counts for expected to predicted
19
+ attr_accessor :confusion_matrix
20
+
21
+ # Class labels in index order of matrix arrays
22
+ # @return [Array]
23
+ attr_accessor :classes
24
+ end
25
+ end
@@ -1,66 +1,66 @@
1
- module NexosisApi
2
- class Client
3
- # Session Contest-based API operations
4
- #
5
- # @see http://docs.nexosis.com/
6
- # @since 2.0.0
7
- module Contest
8
-
9
- # @return [NexosisApi::SessionContest]
10
- def get_session_contest(session_id)
11
- raise ArgumentError, 'session_id was not provided and is not optional ' if session_id.to_s.empty?
12
- contest_url = "/sessions/#{session_id}/contest"
13
- response = self.class.get(contest_url, headers: @headers)
14
- raise HttpException.new("There was a problem getting session contest #{response.code}.",
15
- "getting contest for #{session_id}",
16
- response) unless response.success?
17
- NexosisApi::SessionContest.new(response.parsed_response)
18
- end
19
-
20
- # @return [NexosisApi::AlgorithmContestant]
21
- def get_contest_champion(session_id)
22
- raise ArgumentError, 'session_id was not provided and is not optional ' if session_id.to_s.empty?
23
- champion_url = "/sessions/#{session_id}/contest/champion"
24
- response = self.class.get(champion_url, headers: @headers)
25
- raise HttpException.new("There was a problem getting session champion #{response.code}.",
26
- "getting champion for #{session_id}",
27
- response) unless response.success?
28
- NexosisApi::AlgorithmContestant.new(response.parsed_response)
29
- end
30
-
31
- # @return [Array of NexosisApi::AlgorithmContestant]
32
- def get_contestants(session_id)
33
- raise ArgumentError, 'session_id was not provided and is not optional ' if session_id.to_s.empty?
34
- contestants_url = "/sessions/#{session_id}/contest/contestants"
35
- response = self.class.get(contestants_url, headers: @headers)
36
- raise HttpException.new("There was a problem getting session contestants #{response.code}.",
37
- "getting contestants for #{session_id}",
38
- response) unless response.success?
39
- response.parsed_response['items'].map { |c| NexosisApi::AlgorithmContestant.new(c) }
40
- end
41
-
42
- # @return [NexosisApi::AlgorithmContestant]
43
- def get_contestant_results(session_id, contestant_id)
44
- raise ArgumentError, 'session_id was not provided and is not optional ' if session_id.to_s.empty?
45
- raise ArgumentError, 'contestant_id was not provided and is not optional ' if contestant_id.to_s.empty?
46
- contestant_url = "/sessions/#{session_id}/contest/contestants/#{contestant_id}"
47
- response = self.class.get(contestant_url, headers: @headers)
48
- raise HttpException.new("There was a problem getting session contestant result #{response.code}.",
49
- "getting contestant result for #{session_id}:#{contestant_id}",
50
- response) unless response.success?
51
- NexosisApi::AlgorithmContestant.new(response.parsed_response)
52
- end
53
-
54
- # @return [NexosisApi::SessionSelectionMetrics]
55
- def get_selection_metrics(session_id)
56
- raise ArgumentError, 'session_id was not provided and is not optional ' if session_id.to_s.empty?
57
- selection_url = "/sessions/#{session_id}/contest/selection"
58
- response = self.class.get(selection_url, headers: @headers)
59
- raise HttpException.new("There was a problem getting session selection metrics #{response.code}.",
60
- "getting selection metrics for #{session_id}",
61
- response) unless response.success?
62
- NexosisApi::SessionSelectionMetrics.new(response.parsed_response)
63
- end
64
- end
65
- end
66
- end
1
+ module NexosisApi
2
+ class Client
3
+ # Session Contest-based API operations
4
+ #
5
+ # @see http://docs.nexosis.com/
6
+ # @since 2.0.0
7
+ module Contest
8
+
9
+ # @return [NexosisApi::SessionContest]
10
+ def get_session_contest(session_id)
11
+ raise ArgumentError, 'session_id was not provided and is not optional ' if session_id.to_s.empty?
12
+ contest_url = "/sessions/#{session_id}/contest"
13
+ response = self.class.get(contest_url, headers: @headers)
14
+ raise HttpException.new("There was a problem getting session contest #{response.code}.",
15
+ "getting contest for #{session_id}",
16
+ response) unless response.success?
17
+ NexosisApi::SessionContest.new(response.parsed_response)
18
+ end
19
+
20
+ # @return [NexosisApi::AlgorithmContestant]
21
+ def get_contest_champion(session_id)
22
+ raise ArgumentError, 'session_id was not provided and is not optional ' if session_id.to_s.empty?
23
+ champion_url = "/sessions/#{session_id}/contest/champion"
24
+ response = self.class.get(champion_url, headers: @headers)
25
+ raise HttpException.new("There was a problem getting session champion #{response.code}.",
26
+ "getting champion for #{session_id}",
27
+ response) unless response.success?
28
+ NexosisApi::AlgorithmContestant.new(response.parsed_response)
29
+ end
30
+
31
+ # @return [Array of NexosisApi::AlgorithmContestant]
32
+ def get_contestants(session_id)
33
+ raise ArgumentError, 'session_id was not provided and is not optional ' if session_id.to_s.empty?
34
+ contestants_url = "/sessions/#{session_id}/contest/contestants"
35
+ response = self.class.get(contestants_url, headers: @headers)
36
+ raise HttpException.new("There was a problem getting session contestants #{response.code}.",
37
+ "getting contestants for #{session_id}",
38
+ response) unless response.success?
39
+ response.parsed_response['items'].map { |c| NexosisApi::AlgorithmContestant.new(c) }
40
+ end
41
+
42
+ # @return [NexosisApi::AlgorithmContestant]
43
+ def get_contestant_results(session_id, contestant_id)
44
+ raise ArgumentError, 'session_id was not provided and is not optional ' if session_id.to_s.empty?
45
+ raise ArgumentError, 'contestant_id was not provided and is not optional ' if contestant_id.to_s.empty?
46
+ contestant_url = "/sessions/#{session_id}/contest/contestants/#{contestant_id}"
47
+ response = self.class.get(contestant_url, headers: @headers)
48
+ raise HttpException.new("There was a problem getting session contestant result #{response.code}.",
49
+ "getting contestant result for #{session_id}:#{contestant_id}",
50
+ response) unless response.success?
51
+ NexosisApi::AlgorithmContestant.new(response.parsed_response)
52
+ end
53
+
54
+ # @return [NexosisApi::SessionSelectionMetrics]
55
+ def get_selection_metrics(session_id)
56
+ raise ArgumentError, 'session_id was not provided and is not optional ' if session_id.to_s.empty?
57
+ selection_url = "/sessions/#{session_id}/contest/selection"
58
+ response = self.class.get(selection_url, headers: @headers)
59
+ raise HttpException.new("There was a problem getting session selection metrics #{response.code}.",
60
+ "getting selection metrics for #{session_id}",
61
+ response) unless response.success?
62
+ NexosisApi::SessionSelectionMetrics.new(response.parsed_response)
63
+ end
64
+ end
65
+ end
66
+ end