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
@@ -1,20 +1,20 @@
1
- module NexosisApi
2
- # Constants for dataset column role
3
- module ColumnRole
4
- # No specific role, additional data which could be identified as target in a session
5
- NONE = :none
6
-
7
- # The timestamp column to use as the basis for a time-series session request
8
- TIMESTAMP = :timestamp
9
-
10
- # The target column for which to make predictions
11
- TARGET = :target
12
-
13
- # A feature to be included in analysis
14
- FEATURE = :feature
15
-
16
- # This column will be used to uniquely identify rows during
17
- # update and delete operations, but will not be used as a feature.
18
- KEY = :key
19
- end
1
+ module NexosisApi
2
+ # Constants for dataset column role
3
+ module ColumnRole
4
+ # No specific role, additional data which could be identified as target in a session
5
+ NONE = :none
6
+
7
+ # The timestamp column to use as the basis for a time-series session request
8
+ TIMESTAMP = :timestamp
9
+
10
+ # The target column for which to make predictions
11
+ TARGET = :target
12
+
13
+ # A feature to be included in analysis
14
+ FEATURE = :feature
15
+
16
+ # This column will be used to uniquely identify rows during
17
+ # update and delete operations, but will not be used as a feature.
18
+ KEY = :key
19
+ end
20
20
  end
@@ -1,19 +1,23 @@
1
- module NexosisApi
2
- # Constants for column data type
3
- module ColumnType
4
- # contains string data
5
- STRING = :string
6
-
7
- # contains numeric data
8
- NUMERIC = :numeric
9
-
10
- # contains boolean logical data (i.e. 1 and 0, true and false, etc.)
11
- LOGICAL = :logical
12
-
13
- # contains ISO-8601 compatible date
14
- DATE = :date
15
-
16
- # Indicates a number which is not countable, or is not 'ordinal scaled' but 'ratio' or 'interval' scaled - i.e. a device measurement
17
- NUMERICMEASURE = :numericmeasure
18
- end
19
- end
1
+ module NexosisApi
2
+ # Constants for column data type
3
+ module ColumnType
4
+ # contains string data
5
+ STRING = :string
6
+
7
+ # contains numeric data
8
+ NUMERIC = :numeric
9
+
10
+ # contains boolean logical data (i.e. 1 and 0, true and false, etc.)
11
+ LOGICAL = :logical
12
+
13
+ # contains ISO-8601 compatible date
14
+ DATE = :date
15
+
16
+ # Indicates a number which is not countable, or is not 'ordinal scaled' but 'ratio' or 'interval' scaled - i.e. a device measurement
17
+ NUMERICMEASURE = :numericmeasure
18
+
19
+ # free-form text field.
20
+ # @note differs from string primarily in how the data will be prepared for analysis. Nominal values belong in string. Text to be analyzed as speech, writing, etc. belongs in text field.
21
+ TEXT = :text
22
+ end
23
+ end
@@ -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 = 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,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,79 +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 dataset name provided
48
- # @return [String]
49
- # @deprecated use datasource_name instead
50
- attr_accessor :dataSetName
51
-
52
- # echo back the name of the data source uploaded
53
- # @return [String]
54
- # @since 1.3.0
55
- attr_accessor :datasource_name
56
-
57
- # The S3 parameters used to import a dataset
58
- # @return [Hash]
59
- # For an S3 response the keys of this hash should be 'bucket', 'path', and 'region'
60
- attr_accessor :parameters
61
-
62
- # The date of the import request
63
- # @return [DateTime]
64
- attr_accessor :requested_date
65
-
66
- # Additional details. Normally empty.
67
- # @return [Array]
68
- attr_accessor :messages
69
-
70
- # The column descriptors for the data in this session
71
- # will reflect either the metadata sent in, defaults form dataset, or inferred values
72
- # @return[Array of NexosisApi::Column]
73
- attr_accessor :column_metadata
74
-
75
- # associated hypermedia
76
- # @return [Array of NexosisApi::Link]
77
- attr_accessor :links
78
- end
79
- 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