Module amber_client

Classes

class AmberV2Client (profile: LicenseProfile = None, verify: bool = True)

Main client which interfaces with the Amber cloud. Amber account credentials are discovered within a .Amber.license file located in the home directory, or optionally overridden using environment variables.

Environment: AMBER_V2_VERIFY: specifies the ssl verification required or not

Subclasses

Static methods

def from_dict(profile_dict: dict = None, verify: bool = True)
def from_environment()

Environment

AMBER_V2_LICENSE_KEY: sets license key

AMBER_V2_SECRET_KEY: sets secret key

AMBER_V2_SERVER: sets url

AMBER_V2_OAUTH_SERVER: sets url for oauth

AMBER_V2_VERIFY: boolean for ssl cert verify

Raises

ApiException
if error supplying authentication credentials
def from_license_file(license_id: str = 'default', license_file: str = '~/.Amber.license', verify: bool = True)

Args

license_id
(type: str) license identifier label found within .Amber.license file
license_file
(type: str) path to .Amber.license file

Environment

AMBER_V2_LICENSE_FILE: sets license_file path

AMBER_V2_LICENSE_ID: sets license_id

Raises

ApiException
if error supplying authentication credentials

Methods

def copy_model(self, model_id: str, label: str = None) ‑> PostModelResponse

Copy a model and return the new model information.

Args

model_id
(type: str) (required)
label
(type: str) label for new model (uses previous label if unspecified)

Returns

PostModelResponse

def delete_model(self, model_id: str)

Permanently delete the specified model.

Args

model_id
(type: str) (required)
def enable_learning(self, model_id: str, **kwargs) ‑> PostLearningResponse

Update model configuration and re-enable learning

Args

model_id
(type: str) (required)
training
(type: TrainingConfig) updates to apply

Returns

PostLearningResponse

def get_config(self, model_id: str) ‑> PostConfigResponse

Get the configuration of the specified model.

Args

model_id
(type: str) (required)

Returns

PostConfigResponse

def get_diagnostic(self, model_id: str, dir: str) ‑> str

Get the current summation of the specified model

Args

model_id
(type: str) (required)
dir
(type: str) (required) path to save the diagnostic tar file

Returns

str

def get_model(self, model_id: str) ‑> PostModelResponse

Return metadata for the specified model.

Args

model_id
(type: str) (required)

Returns

PostModelResponse

def get_models(self) ‑> GetModelsResponse

Return id and label for all models belonging to the user.

Returns

GetModelsResponse

def get_nano_status(self, model_id: str) ‑> GetNanoStatusResponse

Get the current nano status of the specified model.

Args

model_id
(type: str) (required)

Returns

GetNanoStatusResponse

def get_pretrain(self, model_id: str) ‑> GetPretrainResponse

Get the pretraining status of the specified model.

Args

model_id
(type: str) (required)

Returns

GetPretrainResponse

def get_root_cause(self, model_id: str, **kwargs) ‑> GetRootCauseResponse

Return a measure of the significance of each feature in the creation of a cluster. The values range from 0 to 1 where a relatively high value represents a feature that was influential in creating the new cluster. No conclusions can be drawn from values close to zero. This measure can be computed for existing clusters or for individual vectors directly.

Args

model_id
(type: str) (required)
clusters
(type: str or array-like) Clusters to analyze (list of comma-separated integers).
vectors
(type: str or array-like) Vectors to analyze, as a flat list of comma-separated floats. Number of values must be a multiple of the configured number of features.

Returns

GetRootCauseResponse

def get_status(self, model_id: str) ‑> GetStatusResponse

Get the current state and learning progress of the specified model.

Args

model_id
(type: str) (required)

Returns

GetStatusResponse

def get_version(self) ‑> GetVersionResponse

Return version information for the API.

Returns

GetVersionResponse

Example

amber = AmberClientV2()
version = amber.get_version()
print(version.to_dict())
def migrate_model(self, v1_model_id: str)

migrate a v1 sensor to a v2 model

Args

v1_model_id
(type: str) version 1 sensor id (required)

Returns

PostModelResponse

def post_config(self, model_id: str, body: PostConfigRequest) ‑> PostConfigResponse

Configure the specified model. Wipes all progress and puts the model in the Buffering state.

Args

model_id
(type: str) (required)
body
(type: PostConfigRequest) configuration to apply

Returns

PostConfigResponse

def post_data(self, model_id: str, data, save_image: bool = True) ‑> PostDataResponse

Send data to the specified model, and get back the resulting analytics and model status.

Args

model_id
(type: str) (required)
data
(type: str or array-like) (required) data vector or vectors as a flattened list of comma-separated values
save_image
(type: boolean) whether or not to save the model (only applies to on prem)

Returns

PostDataResponse

def post_model(self, metadata: PostModelRequest) ‑> PostModelResponse

Create a new model and return its unique identifier.

Args

metadata
(type: PostModelRequest) (required) initial metadata for new model

Returns

PostModelResponse

def post_outage(self, model_id: str)

Resets the streaming window generated by streamingWindow. This endpoint should be called after a data outage before resuming streaming.

Args

model_id
(type: str) (required)
def post_pretrain(self, model_id: str, data, chunk_size: int = 400000, block: bool = True, **kwargs) ‑> PostPretrainResponse

pretrain model with an existing dataset

Args

model_id
(type: str) (required)
data
(type: str or array like) data to process
chunk_size
(type: int) number of portions to send the data over
block
(type: boolean) wait until pretraining finishes before returning

Returns

PostPretrainResponse

def put_data(self, model_id: str, body: PutDataRequest) ‑> PutDataResponse

update fusion vector and get back results

Args

model_id
(type: str) (required)
body
(type: PutDataRequest) (required) updates to the fusion vector

Returns

PutDataResponse

def update_label(self, model_id: str, label: str) ‑> PostModelResponse

Update metadata for the specified model.

Args

model_id
(type: str) (required)
label
(type: str) (required) updates to apply

Returns

PostModelResponse

class ApiException (status=None, reason=None, http_resp=None)

Common base class for all non-exit exceptions.

Ancestors

  • boonamber.v2.rest.ApiException
  • builtins.Exception
  • builtins.BaseException
class LicenseProfile (license_key: str = None, secret_key: str = None, server: str = None, oauth_server: str = None)