nexosis_api 2.0.1 → 2.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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nexosis_api.rb +11 -11
  3. data/lib/nexosis_api/algorithm.rb +22 -22
  4. data/lib/nexosis_api/algorithm_contestant.rb +43 -43
  5. data/lib/nexosis_api/anomaly_scores.rb +19 -0
  6. data/lib/nexosis_api/calendar_jointarget.rb +35 -35
  7. data/lib/nexosis_api/classifier_result.rb +25 -25
  8. data/lib/nexosis_api/classifier_scores.rb +26 -0
  9. data/lib/nexosis_api/client.rb +120 -118
  10. data/lib/nexosis_api/client/contest.rb +66 -66
  11. data/lib/nexosis_api/client/datasets.rb +155 -155
  12. data/lib/nexosis_api/client/imports.rb +141 -141
  13. data/lib/nexosis_api/client/models.rb +121 -108
  14. data/lib/nexosis_api/client/sessions.rb +308 -213
  15. data/lib/nexosis_api/client/views.rb +105 -105
  16. data/lib/nexosis_api/column.rb +50 -50
  17. data/lib/nexosis_api/column_options.rb +38 -38
  18. data/lib/nexosis_api/column_role.rb +19 -19
  19. data/lib/nexosis_api/column_type.rb +23 -23
  20. data/lib/nexosis_api/dataset_data.rb +22 -22
  21. data/lib/nexosis_api/dataset_jointarget.rb +18 -18
  22. data/lib/nexosis_api/dataset_model.rb +26 -26
  23. data/lib/nexosis_api/dataset_summary.rb +33 -33
  24. data/lib/nexosis_api/http_exception.rb +28 -28
  25. data/lib/nexosis_api/impact_metric.rb +22 -22
  26. data/lib/nexosis_api/imports_response.rb +74 -74
  27. data/lib/nexosis_api/join.rb +63 -63
  28. data/lib/nexosis_api/link.rb +18 -18
  29. data/lib/nexosis_api/message.rb +19 -19
  30. data/lib/nexosis_api/metric.rb +16 -16
  31. data/lib/nexosis_api/model_summary.rb +66 -66
  32. data/lib/nexosis_api/paged_array.rb +35 -35
  33. data/lib/nexosis_api/predict_response.rb +35 -35
  34. data/lib/nexosis_api/session.rb +122 -118
  35. data/lib/nexosis_api/session_contest.rb +30 -30
  36. data/lib/nexosis_api/session_response.rb +29 -33
  37. data/lib/nexosis_api/session_result.rb +27 -27
  38. data/lib/nexosis_api/session_selection_metrics.rb +20 -20
  39. data/lib/nexosis_api/time_interval.rb +15 -15
  40. data/lib/nexosis_api/view_data.rb +14 -14
  41. data/lib/nexosis_api/view_definition.rb +64 -64
  42. data/nexosisapi.gemspec +20 -20
  43. metadata +5 -3
@@ -1,22 +1,22 @@
1
- module NexosisApi
2
- # class to hold the parsed results of a dataset
3
- class DatasetData
4
- def initialize(data_hash)
5
- data_hash.each do |k, v|
6
- if (k == 'data')
7
- @data = v
8
- elsif (k == 'links')
9
- @links = v.reject(&:nil?).map { |l| NexosisApi::Link.new(l) }
10
- end
11
- end
12
- end
13
-
14
- # Helpful links to more information about this dataset
15
- # @return [Array of NexosisApi::Link]
16
- attr_accessor :links
17
-
18
- # The hash of data values from the dataset
19
- # @return [Array of Hash] where each hash contains the dataset data
20
- attr_accessor :data
21
- end
22
- end
1
+ module NexosisApi
2
+ # class to hold the parsed results of a dataset
3
+ class DatasetData
4
+ def initialize(data_hash)
5
+ data_hash.each do |k, v|
6
+ if (k == 'data')
7
+ @data = NexosisApi::PagedArray.new(data_hash, v)
8
+ elsif (k == 'links')
9
+ @links = v.reject(&:nil?).map { |l| NexosisApi::Link.new(l) }
10
+ end
11
+ end
12
+ end
13
+
14
+ # Helpful links to more information about this dataset
15
+ # @return [Array of NexosisApi::Link]
16
+ attr_accessor :links
17
+
18
+ # The hash of data values from the dataset
19
+ # @return [NexosisApi::PagedArray of Hash] where each hash contains the dataset data
20
+ attr_accessor :data
21
+ end
22
+ end
@@ -1,19 +1,19 @@
1
- module NexosisApi
2
- # Specifies the name of a dataset to use as the join datasource
3
- # @see http://docs.nexosis.com/guides/views
4
- # @since 1.2.3
5
- class DatasetJoinTarget
6
- def initialize(ds_join_hash)
7
- @dataset_name = ds_join_hash['name'] unless ds_join_hash.nil?
8
- end
9
-
10
- # The name of the dataset that will be participating in the join
11
- # @return [String] name of the dataset provided for this join
12
- attr_accessor :dataset_name
13
-
14
- # provides a custom hash to match api requests
15
- def to_hash
16
- { 'dataSet' => { 'name' => dataset_name } }
17
- end
18
- end
1
+ module NexosisApi
2
+ # Specifies the name of a dataset to use as the join datasource
3
+ # @see http://docs.nexosis.com/guides/views
4
+ # @since 1.2.3
5
+ class DatasetJoinTarget
6
+ def initialize(ds_join_hash)
7
+ @dataset_name = ds_join_hash['name'] unless ds_join_hash.nil?
8
+ end
9
+
10
+ # The name of the dataset that will be participating in the join
11
+ # @return [String] name of the dataset provided for this join
12
+ attr_accessor :dataset_name
13
+
14
+ # provides a custom hash to match api requests
15
+ def to_hash
16
+ { 'dataSet' => { 'name' => dataset_name } }
17
+ end
18
+ end
19
19
  end
@@ -1,26 +1,26 @@
1
- module NexosisApi
2
- # Class to parse the model results calculated for a dataset
3
- class DatasetModel
4
- def initialize(data_hash)
5
- data_hash.each do |k, v|
6
- if k == 'championContest'
7
- instance_variable_set("@#{k}", NexosisApi::AlgorithmSelection.new(v))
8
- else
9
- instance_variable_set("@#{k}", v) unless v.nil?
10
- end
11
- end
12
- end
13
-
14
- # The name of the dataset used in the evaluation
15
- # @return [String]
16
- attr_accessor :datasetName
17
-
18
- # The column targeted for prediction
19
- # @return [String]
20
- attr_accessor :targetColumn
21
-
22
- # The details of the winning algorithm
23
- # @return [NexosisApi::AlgorithmSelection]
24
- attr_accessor :championContest
25
- end
26
- end
1
+ module NexosisApi
2
+ # Class to parse the model results calculated for a dataset
3
+ class DatasetModel
4
+ def initialize(data_hash)
5
+ data_hash.each do |k, v|
6
+ if k == 'championContest'
7
+ instance_variable_set("@#{k}", NexosisApi::AlgorithmSelection.new(v))
8
+ else
9
+ instance_variable_set("@#{k}", v) unless v.nil?
10
+ end
11
+ end
12
+ end
13
+
14
+ # The name of the dataset used in the evaluation
15
+ # @return [String]
16
+ attr_accessor :datasetName
17
+
18
+ # The column targeted for prediction
19
+ # @return [String]
20
+ attr_accessor :targetColumn
21
+
22
+ # The details of the winning algorithm
23
+ # @return [NexosisApi::AlgorithmSelection]
24
+ attr_accessor :championContest
25
+ end
26
+ end
@@ -1,33 +1,33 @@
1
- module NexosisApi
2
- # class to hold the parsed results of a dataset
3
- class DatasetSummary
4
- def initialize(data_hash)
5
- data_hash.each do |k, v|
6
- if (k == 'dataSetName')
7
- @dataset_name = v unless v.nil?
8
- elsif (k == 'columns')
9
- @column_metadata = v.reject { |_key, value| value.nil? }
10
- .map do |col_key, col_val|
11
- NexosisApi::Column.new(col_key, col_val)
12
- end
13
- end
14
- end
15
- end
16
-
17
- # The name of the dataset uploaded and saved
18
- # @return [String]
19
- attr_accessor :dataset_name
20
-
21
- # Descriptive information about the columns
22
- # @return [Array of NexosisApi::Column]
23
- attr_accessor :column_metadata
24
-
25
- # Helper method which tells you whether or not this dataset has a column with timestamp role.
26
- # @note Often helpful for implmenters as non-timeseries datasets
27
- # cannot be sent to forecast or impact sessions
28
- # @since 1.3.0
29
- def timeseries?
30
- !@column_metadata.select { |dc| dc.role == NexosisApi::ColumnRole::TIMESTAMP }.empty?
31
- end
32
- end
33
- end
1
+ module NexosisApi
2
+ # class to hold the parsed results of a dataset
3
+ class DatasetSummary
4
+ def initialize(data_hash)
5
+ data_hash.each do |k, v|
6
+ if (k == 'dataSetName')
7
+ @dataset_name = v unless v.nil?
8
+ elsif (k == 'columns')
9
+ @column_metadata = v.reject { |_key, value| value.nil? }
10
+ .map do |col_key, col_val|
11
+ NexosisApi::Column.new(col_key, col_val)
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ # The name of the dataset uploaded and saved
18
+ # @return [String]
19
+ attr_accessor :dataset_name
20
+
21
+ # Descriptive information about the columns
22
+ # @return [Array of NexosisApi::Column]
23
+ attr_accessor :column_metadata
24
+
25
+ # Helper method which tells you whether or not this dataset has a column with timestamp role.
26
+ # @note Often helpful for implmenters as non-timeseries datasets
27
+ # cannot be sent to forecast or impact sessions
28
+ # @since 1.3.0
29
+ def timeseries?
30
+ !@column_metadata.select { |dc| dc.role == NexosisApi::ColumnRole::TIMESTAMP }.empty?
31
+ end
32
+ end
33
+ end
@@ -1,29 +1,29 @@
1
- module NexosisApi
2
- # encapsulate errors from the Nexosis API
3
- class HttpException < StandardError
4
- attr_reader :message,:action,:response,:request
5
- def initialize(message = "", action = nil, http_obj)
6
- base_message = message
7
- full_message = nil
8
- if(http_obj.is_a?(Hash))
9
- base_message.prepend(http_obj['message'].concat(': ')) unless http_obj['message'].nil?
10
- @action = action
11
- elsif(http_obj.instance_of?(HTTParty::Response))
12
- full_message = http_obj.parsed_response['message']
13
- full_message = full_message.concat(' || Details: ').concat(http_obj.parsed_response['errorDetails'].to_s) unless http_obj.parsed_response['errorDetails'].nil?
14
- @type = http_obj.parsed_response['errorType']
15
- @response = http_obj.response
16
- @request = http_obj.request
17
- @code = http_obj.code
18
- end
19
- full_message ||= base_message
20
- @message = full_message
21
- end
22
-
23
- attr_reader :code
24
- attr_reader :response
25
- attr_reader :request
26
- attr_reader :message
27
- attr_reader :type
28
- end
1
+ module NexosisApi
2
+ # encapsulate errors from the Nexosis API
3
+ class HttpException < StandardError
4
+ attr_reader :message,:action,:response,:request
5
+ def initialize(message = "", action = nil, http_obj)
6
+ base_message = message
7
+ full_message = nil
8
+ if(http_obj.is_a?(Hash))
9
+ base_message.prepend(http_obj['message'].concat(': ')) unless http_obj['message'].nil?
10
+ @action = action
11
+ elsif(http_obj.instance_of?(HTTParty::Response))
12
+ full_message = http_obj.parsed_response['message']
13
+ full_message = full_message.concat(' || Details: ').concat(http_obj.parsed_response['errorDetails'].to_s) unless http_obj.parsed_response['errorDetails'].nil?
14
+ @type = http_obj.parsed_response['errorType']
15
+ @response = http_obj.response
16
+ @request = http_obj.request
17
+ @code = http_obj.code
18
+ end
19
+ full_message ||= base_message
20
+ @message = full_message
21
+ end
22
+
23
+ attr_reader :code
24
+ attr_reader :response
25
+ attr_reader :request
26
+ attr_reader :message
27
+ attr_reader :type
28
+ end
29
29
  end
@@ -1,22 +1,22 @@
1
- module NexosisApi
2
- # Class to parse the metric results of an impact analysis
3
- class ImpactMetric
4
- def initialize(metric_hash)
5
- metric_hash.each do |k, v|
6
- instance_variable_set("@#{k}", v) unless v.nil?
7
- end
8
- end
9
-
10
- # Statistical value used to determine the significance of the impact.
11
- # @return [Float]
12
- attr_accessor :pValue
13
-
14
- # Total absolute effect of the event on the dataset.
15
- # @return [Float]
16
- attr_accessor :absoluteEffect
17
-
18
- # Percentage impact of the event on the dataset.
19
- # @return [Float]
20
- attr_accessor :relativeEffect
21
- end
22
- end
1
+ module NexosisApi
2
+ # Class to parse the metric results of an impact analysis
3
+ class ImpactMetric
4
+ def initialize(metric_hash)
5
+ metric_hash.each do |k, v|
6
+ instance_variable_set("@#{k}", v) unless v.nil?
7
+ end
8
+ end
9
+
10
+ # Statistical value used to determine the significance of the impact.
11
+ # @return [Float]
12
+ attr_accessor :pValue
13
+
14
+ # Total absolute effect of the event on the dataset.
15
+ # @return [Float]
16
+ attr_accessor :absoluteEffect
17
+
18
+ # Percentage impact of the event on the dataset.
19
+ # @return [Float]
20
+ attr_accessor :relativeEffect
21
+ end
22
+ end
@@ -1,74 +1,74 @@
1
- module NexosisApi
2
- # class to parse results from an imports call
3
- class ImportsResponse
4
- def initialize(response_hash)
5
- response_hash.each do |k, v|
6
- if(k == 'importId')
7
- @import_id = v
8
- elsif(k == 'requestedDate')
9
- @requested_date = v
10
- elsif(k == 'columns')
11
- columns = []
12
- next if v.nil?
13
- v.keys.each do |col_key|
14
- columns << NexosisApi::Column.new(col_key, v[col_key])
15
- end
16
- @column_metadata = columns
17
- elsif(k == 'links')
18
- links = []
19
- v.each { |l| links << NexosisApi::Link.new(l) }
20
- instance_variable_set("@#{k}", links) unless v.nil?
21
- elsif k == 'dataSetName'
22
- @datasource_name = v
23
- else
24
- instance_variable_set("@#{k}", v) unless v.nil?
25
- end
26
- end
27
- end
28
-
29
- # The unique identifier for this import request
30
- # @return [String]
31
- attr_accessor :import_id
32
-
33
- # Where the import was requested from - S3, Azure, or Url
34
- # @return [String]
35
- attr_accessor :type, :s3
36
-
37
- # The current status of the import request
38
- # @return [String]
39
- # @note The import will be performed in a FIFO queue. Check back on status before attempting to start a session using the dataset.
40
- attr_accessor :status
41
-
42
- # Date and status of each status this session has entered
43
- # @return [Hash]
44
- # @since 1.3.0
45
- attr_accessor :statusHistory
46
-
47
- # echo back the name of the data source uploaded
48
- # @return [String]
49
- # @since 1.3.0
50
- attr_accessor :datasource_name
51
-
52
- # The S3 parameters used to import a dataset
53
- # @return [Hash]
54
- # For an S3 response the keys of this hash should be 'bucket', 'path', and 'region'
55
- attr_accessor :parameters
56
-
57
- # The date of the import request
58
- # @return [DateTime]
59
- attr_accessor :requested_date
60
-
61
- # Additional details. Normally empty.
62
- # @return [Array]
63
- attr_accessor :messages
64
-
65
- # The column descriptors for the data in this session
66
- # will reflect either the metadata sent in, defaults form dataset, or inferred values
67
- # @return[Array of NexosisApi::Column]
68
- attr_accessor :column_metadata
69
-
70
- # associated hypermedia
71
- # @return [Array of NexosisApi::Link]
72
- attr_accessor :links
73
- end
74
- end
1
+ module NexosisApi
2
+ # class to parse results from an imports call
3
+ class ImportsResponse
4
+ def initialize(response_hash)
5
+ response_hash.each do |k, v|
6
+ if(k == 'importId')
7
+ @import_id = v
8
+ elsif(k == 'requestedDate')
9
+ @requested_date = v
10
+ elsif(k == 'columns')
11
+ columns = []
12
+ next if v.nil?
13
+ v.keys.each do |col_key|
14
+ columns << NexosisApi::Column.new(col_key, v[col_key])
15
+ end
16
+ @column_metadata = columns
17
+ elsif(k == 'links')
18
+ links = []
19
+ v.each { |l| links << NexosisApi::Link.new(l) }
20
+ instance_variable_set("@#{k}", links) unless v.nil?
21
+ elsif k == 'dataSetName'
22
+ @datasource_name = v
23
+ else
24
+ instance_variable_set("@#{k}", v) unless v.nil?
25
+ end
26
+ end
27
+ end
28
+
29
+ # The unique identifier for this import request
30
+ # @return [String]
31
+ attr_accessor :import_id
32
+
33
+ # Where the import was requested from - S3, Azure, or Url
34
+ # @return [String]
35
+ attr_accessor :type, :s3
36
+
37
+ # The current status of the import request
38
+ # @return [String]
39
+ # @note The import will be performed in a FIFO queue. Check back on status before attempting to start a session using the dataset.
40
+ attr_accessor :status
41
+
42
+ # Date and status of each status this session has entered
43
+ # @return [Hash]
44
+ # @since 1.3.0
45
+ attr_accessor :statusHistory
46
+
47
+ # echo back the name of the data source uploaded
48
+ # @return [String]
49
+ # @since 1.3.0
50
+ attr_accessor :datasource_name
51
+
52
+ # The S3 parameters used to import a dataset
53
+ # @return [Hash]
54
+ # For an S3 response the keys of this hash should be 'bucket', 'path', and 'region'
55
+ attr_accessor :parameters
56
+
57
+ # The date of the import request
58
+ # @return [DateTime]
59
+ attr_accessor :requested_date
60
+
61
+ # Additional details. Normally empty.
62
+ # @return [Array]
63
+ attr_accessor :messages
64
+
65
+ # The column descriptors for the data in this session
66
+ # will reflect either the metadata sent in, defaults form dataset, or inferred values
67
+ # @return[Array of NexosisApi::Column]
68
+ attr_accessor :column_metadata
69
+
70
+ # associated hypermedia
71
+ # @return [Array of NexosisApi::Link]
72
+ attr_accessor :links
73
+ end
74
+ end