def get_batch_anomaly_score(self, batch_anomaly_score, query_string=''): """Retrieves a batch anomaly score. The batch_anomaly_score parameter should be a string containing the batch_anomaly_score id or the dict returned by create_batch_anomaly_score. As batch_anomaly_score is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the batch_anomaly_score values and state info available at the time it is called. """ check_resource_type(batch_anomaly_score, BATCH_ANOMALY_SCORE_PATH, message="A batch anomaly score id is needed.") return self.get_resource(batch_anomaly_score, query_string=query_string)
def download_batch_projection(self, batch_projection, filename=None, retries=10): """Retrieves the batch projections file. Downloads projections, that are stored in a remote CSV file. If a path is given in filename, the contents of the file are downloaded and saved locally. A file-like object is returned otherwise. """ check_resource_type(batch_projection, BATCH_PROJECTION_PATH, message="A batch projection id is needed.") return self._download_resource(batch_projection, filename, retries=retries)
def download_batch_anomaly_score(self, batch_anomaly_score, filename=None, retries=10): """Retrieves the batch anomaly score file. Downloads anomaly scores, that are stored in a remote CSV file. If a path is given in filename, the contents of the file are downloaded and saved locally. A file-like object is returned otherwise. """ check_resource_type(batch_anomaly_score, BATCH_ANOMALY_SCORE_PATH, message="A batch anomaly score id is needed.") return self._download_resource(batch_anomaly_score, filename, retries=retries)
def get_library(self, library, query_string=''): """Retrieves a library. The library parameter should be a string containing the library id or the dict returned by create_script. As library is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the library content and state info available at the time it is called. """ check_resource_type(library, LIBRARY_PATH, message="A library id is needed.") library_id = get_library_id(library) if library_id: return self._get("%s%s" % (self.url, library_id), query_string=query_string)
def get_script(self, script, query_string=''): """Retrieves a script. The script parameter should be a string containing the script id or the dict returned by create_script. As script is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the script content and state info available at the time it is called. """ check_resource_type(script, SCRIPT_PATH, message="A script id is needed.") script_id = get_script_id(script) if script_id: return self._get("%s%s" % (self.url, script_id), query_string=query_string)
def get_batch_centroid(self, batch_centroid, query_string=''): """Retrieves a batch centroid. The batch_centroid parameter should be a string containing the batch_centroid id or the dict returned by create_batch_centroid. As batch_centroid is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the batch_centroid values and state info available at the time it is called. """ check_resource_type(batch_centroid, BATCH_CENTROID_PATH, message="A batch centroid id is needed.") batch_centroid_id = get_batch_centroid_id(batch_centroid) if batch_centroid_id: return self._get("%s%s" % (self.url, batch_centroid_id), query_string=query_string)
def get_dataset(self, dataset, query_string=''): """Retrieves a dataset. The dataset parameter should be a string containing the dataset id or the dict returned by create_dataset. As dataset is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the dataset values and state info available at the time it is called. """ check_resource_type(dataset, DATASET_PATH, message="A dataset id is needed.") dataset_id = get_dataset_id(dataset) if dataset_id: return self._get("%s%s" % (self.url, dataset_id), query_string=query_string)
def get_correlation(self, correlation, query_string=''): """Retrieves a correlation. The correlation parameter should be a string containing the correlation id or the dict returned by create_correlation. As correlation is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the correlation values and state info available at the time it is called. """ check_resource_type(correlation, CORRELATION_PATH, message="A correlation id is needed.") correlation_id = get_correlation_id(correlation) if correlation_id: return self._get("%s%s" % (self.url, correlation_id), query_string=query_string)
def get_sample(self, sample, query_string=''): """Retrieves a sample. The sample parameter should be a string containing the sample id or the dict returned by create_sample. As sample is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the sample values and state info available at the time it is called. """ check_resource_type(sample, SAMPLE_PATH, message="A sample id is needed.") sample_id = get_sample_id(sample) if sample_id: return self._get("%s%s" % (self.url, sample_id), query_string=query_string)
def get_batch_topic_distribution(self, batch_topic_distribution, query_string=''): """Retrieves a batch topic distribution. The batch_topic_distribution parameter should be a string containing the batch_topic_distribution id or the dict returned by create_batch_topic_distribution. As batch_topic_distribution is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the batch_topic_distribution values and state info available at the time it is called. """ check_resource_type(batch_topic_distribution, BATCH_TOPIC_DISTRIBUTION_PATH, message="A batch topic distribution id is needed.") return self.get_resource(batch_topic_distribution, query_string=query_string)
def get_project(self, project, query_string=''): """Retrieves a project. The project parameter should be a string containing the project id or the dict returned by create_project. As every resource, is an evolving object that is processed until it reaches the FINISHED or FAULTY state. The function will return a dict that encloses the project values and state info available at the time it is called. """ check_resource_type(project, PROJECT_PATH, message="A project id is needed.") project_id = get_project_id(project) if project_id: return self._get("%s%s" % (self.url, project_id), query_string=query_string, organization=True)
def get_external_connector(self, external_connector, query_string=''): """Retrieves an external connector. The external connector parameter should be a string containing the external connector id or the dict returned by create_external_connector. As an external connector is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the connector contents and state info available at the time it is called. """ check_resource_type(external_connector, EXTERNAL_CONNECTOR_PATH, message="An external connector id is needed.") external_connector_id = get_external_connector_id(external_connector) if external_connector_id: return self._get("%s%s" % (self.url, external_connector_id), query_string=query_string)
def download_batch_topic_distribution(self, batch_topic_distribution, filename=None): """Retrieves the batch topic distribution file. Downloads topic distributions, that are stored in a remote CSV file. If a path is given in filename, the contents of the file are downloaded and saved locally. A file-like object is returned otherwise. """ check_resource_type(batch_topic_distribution, BATCH_TOPIC_DISTRIBUTION_PATH, message="A batch topic distribution id is needed.") batch_topic_distribution_id = get_batch_topic_distribution_id( \ batch_topic_distribution) if batch_topic_distribution_id: return self._download("%s%s%s" % \ (self.url, batch_topic_distribution_id, DOWNLOAD_DIR), \ filename=filename)
def get_cluster(self, cluster, query_string='', shared_username=None, shared_api_key=None): """Retrieves a cluster. The model parameter should be a string containing the cluster id or the dict returned by create_cluster. As cluster is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the cluster values and state info available at the time it is called. If this is a shared cluster, the username and sharing api key must also be provided. """ check_resource_type(cluster, CLUSTER_PATH, message="A cluster id is needed.") return self.get_resource(cluster, query_string=query_string, shared_username=shared_username, shared_api_key=shared_api_key)
def get_deepnet(self, deepnet, query_string='', shared_username=None, shared_api_key=None): """Retrieves a deepnet. The model parameter should be a string containing the deepnet id or the dict returned by create_deepnet. As a deepnet is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the deepnet values and state info available at the time it is called. If this is a shared deepnet, the username and sharing api key must also be provided. """ check_resource_type(deepnet, DEEPNET_PATH, message="A deepnet id is needed.") deepnet_id = get_deepnet_id(deepnet) if deepnet_id: return self._get("%s%s" % (self.url, deepnet_id), query_string=query_string, shared_username=shared_username, shared_api_key=shared_api_key)
def get_optiml(self, optiml, query_string='', shared_username=None, shared_api_key=None): """Retrieves an optiml. The model parameter should be a string containing the optiml id or the dict returned by create_optiml. As an optiml is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the optiml values and state info available at the time it is called. If this is a shared optiml, the username and sharing api key must also be provided. """ check_resource_type(optiml, OPTIML_PATH, message="An optiml id is needed.") optiml_id = get_optiml_id(optiml) if optiml_id: return self._get("%s%s" % (self.url, optiml_id), query_string=query_string, shared_username=shared_username, shared_api_key=shared_api_key)
def get_logistic_regression(self, logistic_regression, query_string='', shared_username=None, shared_api_key=None): """Retrieves a logistic regression. The model parameter should be a string containing the logistic regression id or the dict returned by create_logistic_regression. As a logistic regression is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the logistic regression values and state info available at the time it is called. If this is a shared logistic regression, the username and sharing api key must also be provided. """ check_resource_type(logistic_regression, LOGISTIC_REGRESSION_PATH, message="A logistic regression id is needed.") logistic_regression_id = get_logistic_regression_id( logistic_regression) if logistic_regression_id: return self._get("%s%s" % (self.url, logistic_regression_id), query_string=query_string, shared_username=shared_username, shared_api_key=shared_api_key)
def get_time_series(self, time_series, query_string='', shared_username=None, shared_api_key=None): """Retrieves a time series. The model parameter should be a string containing the time series id or the dict returned by create_time_series. As a time series is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the time series values and state info available at the time it is called. If this is a shared time series, the username and sharing api key must also be provided. """ check_resource_type(time_series, TIME_SERIES_PATH, message="A time series id is needed.") time_series_id = get_time_series_id( time_series) if time_series_id: return self._get("%s%s" % (self.url, time_series_id), query_string=query_string, shared_username=shared_username, shared_api_key=shared_api_key)
def get_topic_model(self, topic_model, query_string='', shared_username=None, shared_api_key=None): """Retrieves a Topic Model. The topic_model parameter should be a string containing the topic model ID or the dict returned by create_topic_model. As the topic model is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the topic model values and state info available at the time it is called. If this is a shared topic model, the username and sharing api key must also be provided. """ check_resource_type(topic_model, TOPIC_MODEL_PATH, message="A Topic Model id is needed.") return self.get_resource(topic_model, query_string=query_string, shared_username=shared_username, shared_api_key=shared_api_key)
def update_pca(self, pca, changes): """Updates a PCA. """ check_resource_type(pca, PCA_PATH, message="A PCA id is needed.") return self.update_resource(pca, changes)
def delete_pca(self, pca): """Deletes a PCA. """ check_resource_type(pca, PCA_PATH, message="A PCA id is needed.") return self.delete_resource(pca)