classify_api module#
- class edgeimpulse_api.api.classify_api.ClassifyApi(api_client=None)[source]#
Bases:
object
- classify_sample(
- project_id: StrictInt[StrictInt],
- sample_id: StrictInt[StrictInt],
- include_debug_info: StrictBool | None[StrictBool | None] = None,
- **kwargs,
Classify sample (deprecated)
This API is deprecated, use classifySampleV2 instead (/v1/api/{projectId}/classify/v2/{sampleId}). Classify a complete file against the current impulse. This will move the sliding window (dependent on the sliding window length and the sliding window increase parameters in the impulse) over the complete file, and classify for every window that is extracted.
- Parameters:
project_id (int) – Project ID (required)
sample_id (int) – Sample ID (required)
include_debug_info (bool) – Whether to return the debug information from FOMO classification.
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- classify_sample_by_learn_block(
- project_id: StrictInt[StrictInt],
- sample_id: StrictInt[StrictInt],
- block_id: StrictInt[StrictInt],
- **kwargs,
Classify sample by learn block
This API is deprecated, use classifySampleByLearnBlockV2 (/v1/api/{projectId}/classify/anomaly-gmm/v2/{blockId}/{sampleId}) instead. Classify a complete file against the specified learn block. This will move the sliding window (dependent on the sliding window length and the sliding window increase parameters in the impulse) over the complete file, and classify for every window that is extracted.
- Parameters:
project_id (int) – Project ID (required)
sample_id (int) – Sample ID (required)
block_id (int) – Block ID (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- classify_sample_by_learn_block_v2(
- project_id: StrictInt[StrictInt],
- sample_id: StrictInt[StrictInt],
- block_id: StrictInt[StrictInt],
- variant: KerasModelVariantEnum | None[KerasModelVariantEnum | None] = None,
- **kwargs,
Classify sample by learn block
Classify a complete file against the specified learn block. This will move the sliding window (dependent on the sliding window length and the sliding window increase parameters in the impulse) over the complete file, and classify for every window that is extracted. Depending on the size of your file, whether your sample is resampled, and whether the result is cached you’ll get either the result or a job back. If you receive a job, then wait for the completion of the job, and then call this function again to receive the results. The unoptimized (float32) model is used by default, and classification with an optimized (int8) model can be slower.
- Parameters:
project_id (int) – Project ID (required)
sample_id (int) – Sample ID (required)
block_id (int) – Block ID (required)
variant (KerasModelVariantEnum) – Keras model variant
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- classify_sample_v2(
- project_id: StrictInt[StrictInt],
- sample_id: StrictInt[StrictInt],
- include_debug_info: StrictBool | None[StrictBool | None] = None,
- variant: KerasModelVariantEnum | None[KerasModelVariantEnum | None] = None,
- **kwargs,
Classify sample
Classify a complete file against the current impulse. This will move the sliding window (dependent on the sliding window length and the sliding window increase parameters in the impulse) over the complete file, and classify for every window that is extracted. Depending on the size of your file, whether your sample is resampled, and whether the result is cached you’ll get either the result or a job back. If you receive a job, then wait for the completion of the job, and then call this function again to receive the results. The unoptimized (float32) model is used by default, and classification with an optimized (int8) model can be slower.
- Parameters:
project_id (int) – Project ID (required)
sample_id (int) – Sample ID (required)
include_debug_info (bool) – Whether to return the debug information from FOMO classification.
variant (KerasModelVariantEnum) – Keras model variant
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- get_classify_job_result(
- project_id: StrictInt[StrictInt],
- feature_explorer_only: StrictBool | None[StrictBool | None] = None,
- variant: KerasModelVariantEnum | None[KerasModelVariantEnum | None] = None,
- **kwargs,
Classify job result
Get classify job result, containing the result for the complete testing dataset.
- Parameters:
project_id (int) – Project ID (required)
feature_explorer_only (bool) – Whether to get only the classification results relevant to the feature explorer.
variant (KerasModelVariantEnum) – Keras model variant
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- get_classify_job_result_page(
- project_id: StrictInt[StrictInt],
- limit: StrictInt | None[StrictInt | None] = None,
- offset: StrictInt | None[StrictInt | None] = None,
- variant: KerasModelVariantEnum | None[KerasModelVariantEnum | None] = None,
- **kwargs,
Single page of a classify job result
Get classify job result, containing the predictions for a given page.
- Parameters:
project_id (int) – Project ID (required)
limit (int) – Maximum number of results
offset (int) – Offset in results, can be used in conjunction with LimitResultsParameter to implement paging.
variant (KerasModelVariantEnum) – Keras model variant
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- get_classify_metrics_all_variants(
- project_id: StrictInt[StrictInt],
- **kwargs,
Get metrics for all available model variants
Get metrics, calculated during a classify all job, for all available model variants. This is experimental and may change in the future.
- Parameters:
project_id (int) – Project ID (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- get_sample_window_from_cache(
- project_id: StrictInt[StrictInt],
- sample_id: StrictInt[StrictInt],
- window_index: StrictInt[StrictInt],
- **kwargs,
Get a window of raw sample features from cache, after a live classification job has completed.
Get raw sample features for a particular window. This is only available after a live classification job has completed and raw features have been cached.
- Parameters:
project_id (int) – Project ID (required)
sample_id (int) – Sample ID (required)
window_index (int) – Sample window index (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type: