whylogs.api.writer.whylabs#

Module Contents#

Classes#

Attributes#

whylogs.api.writer.whylabs.FIVE_MINUTES_IN_SECONDS#
whylogs.api.writer.whylabs.DAY_IN_SECONDS#
whylogs.api.writer.whylabs.FIVE_YEARS_IN_SECONDS#
whylogs.api.writer.whylabs.logger#
whylogs.api.writer.whylabs.WHYLOGS_PREFER_SYNC_KEY = 'WHYLOGS_PREFER_SYNC'#
whylogs.api.writer.whylabs.KNOWN_CUSTOM_PERFORMANCE_METRICS#
whylogs.api.writer.whylabs.KNOWN_CUSTOM_OUTPUT_METRICS#
class whylogs.api.writer.whylabs.WhyLabsWriter(org_id: Optional[str] = None, api_key: Optional[str] = None, dataset_id: Optional[str] = None, api_client: Optional[whylabs_client.ApiClient] = None, ssl_ca_cert: Optional[str] = None, _timeout_seconds: Optional[float] = None)#

Bases: whylogs.api.writer.Writer

Parameters
  • org_id (Optional[str]) –

  • api_key (Optional[str]) –

  • dataset_id (Optional[str]) –

  • api_client (Optional[whylabs_client.ApiClient]) –

  • ssl_ca_cert (Optional[str]) –

  • _timeout_seconds (Optional[float]) –

property key_id: str#
Return type

str

check_interval(interval_seconds: int) None#
Parameters

interval_seconds (int) –

Return type

None

option(org_id: Optional[str] = None, dataset_id: Optional[str] = None, api_key: Optional[str] = None, reference_profile_name: Optional[str] = None, configuration: Optional[whylabs_client.Configuration] = None, ssl_ca_cert: Optional[str] = None, api_client: Optional[whylabs_client.ApiClient] = None, timeout_seconds: Optional[float] = None, prefer_sync: Optional[bool] = None) WhyLabsWriter#
Parameters
  • ID (org_id the organization) –

  • Id (dataset_id the dataset) –

  • key (api_key the API) –

  • profile (reference_profile_name the name of the reference) –

  • client (configuration the additional configuration for the REST) –

  • configured (Returns a "WhyLabsWriter" with these options) –

  • -------

  • org_id (Optional[str]) –

  • dataset_id (Optional[str]) –

  • api_key (Optional[str]) –

  • reference_profile_name (Optional[str]) –

  • configuration (Optional[whylabs_client.Configuration]) –

  • ssl_ca_cert (Optional[str]) –

  • api_client (Optional[whylabs_client.ApiClient]) –

  • timeout_seconds (Optional[float]) –

  • prefer_sync (Optional[bool]) –

Return type

WhyLabsWriter

tag_output_columns(columns: List[str]) Tuple[bool, str]#

Sets the list of columns as output columns for the specified dataset.

Parameters

columns (List[str]) – The list of column names you want to tag as outputs.

Returns

Tuple with a boolean indicating success or failure: e.g. (True, “column prediction was updated to output”) and string with status message.

Return type

Tuple[bool, str]

tag_input_columns(columns: List[str]) Tuple[bool, str]#

Sets the list of columns as input columns for the specified dataset.

Parameters

columns (List[str]) – The list of column names you want to tag as inputs.

Returns

Tuple with a boolean indicating success or failure: e.g. (True, “column [output_voltage] updated to input”) and string with status message.

Return type

Tuple[bool, str]

tag_custom_performance_column(column: str, label: Optional[str] = None, default_metric: str = 'mean') Tuple[bool, str]#

Sets the column as a custom performance metric for the specified dataset and org id. The default metric will be displayed in the Performance tab in WhyLabs.

Parameters
  • column (str) – The column name in the whylogs profile you want to tag as a custom performance metric.

  • label (str) – The label that will be displayed in WhyLabs UI. If none is passed, defaults to column name.

  • default_metric (str) – The default metric that will be displayed in the Performance tab in WhyLabs. For example, “mean”, “median”, “max”, or “min”. If none is passed, defaults to “mean”.

  • Note (the resulting custom performance metric is considered an unmergeable metric.) –

Return type

Tuple[bool, str]

write_estimation_result(file: whylogs.experimental.performance_estimation.estimation_results.EstimationResult, **kwargs: Any) Tuple[bool, str]#
Parameters
Return type

Tuple[bool, str]

write_feature_weights(file: whylogs.core.feature_weights.FeatureWeights, **kwargs: Any) Tuple[bool, str]#

Put feature weights for the specified dataset.

Parameters
  • file (FeatureWeights) – FeatureWeights object representing the Feature Weights for the specified dataset

  • kwargs (Any) –

Returns

Tuple with a boolean (1-success, 0-fail) and string with the request’s status code.

Return type

Tuple[bool, str]

get_feature_weights(**kwargs: Any) Optional[whylogs.core.feature_weights.FeatureWeights]#

Get latest version for the feature weights for the specified dataset

Returns

Response of the GET request, with segmentWeights and metadata.

Return type

FeatureWeightResponse

Parameters

kwargs (Any) –

start_transaction(transaction_id: Optional[str] = None, **kwargs) str#

Initiates a transaction – any profiles subsequently written by calling write() will be uploaded to WhyLabs, but not ingested until commit_transaction() is called. Throws on failure.

Parameters

transaction_id (Optional[str]) –

Return type

str

commit_transaction(**kwargs) None#

Ingest any profiles written since the previous start_transaction(). Throws on failure.

Return type

None

write(file: whylogs.api.writer.writer.Writable, **kwargs: Any) Tuple[bool, str]#
Parameters
Return type

Tuple[bool, str]

class whylogs.api.writer.whylabs.WhyLabsTransaction(writer: WhyLabsWriter)#
Parameters

writer (WhyLabsWriter) –