Module amber_client

Classes

class AmberV2Client (**kwargs)

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

Args

kwargs: Direct specification: server: full URL for amber server oauth_server: full URL for oauth server license_key: Amber license_key secret_key: Amber secret key timeout: Timeout value for all requests

License File: license_file: path to license file (defaults to ~/.Amber.license) (AMBER_LICENSE_FILE) profile_name: profile name withing .Amber.license (defaults to "default") (AMBER_PROFILE_NAME aka AMBER_LICENSE_ID)

Profile Dictionary: profile: profile dictionary Environment variables: AMBER_LICENSE_KEY: license key

<code>AMBER\_SECRET\_KEY</code>: secret key

<code>AMBER\_SERVER</code>: amber server address

<code>AMBER\_OAUTH\_SERVER</code>: amber oauth server address, defaults to AMBER_SERVER if unset

<code>AMBER\_SSL\_CERT</code>: path to ssl client cert file (.pem)

<code>AMBER\_SSL\_VERIFY</code>: Either a boolean, in which case it controls whether we verify the server’s TLS certificate, or a string, in which case it must be a path to a CA bundle to use

<code>AMBER\_LICENSE\_FILE</code>: file containing amber credentials

<code>AMBER\_PROFILE\_NAME</code>: named entry within the AMBER_LICENSE_FILE

<code>AMBER\_LICENSE\_ID</code>: alias for AMBER_PROFILE_NAME

Subclasses

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