whylogs.api.writer.whylabs#

Module Contents#

Classes#

Attributes#

whylogs.api.writer.whylabs.logger#
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, whylabs_client: Optional[whylogs.api.writer.whylabs_client.WhyLabsClient] = None)#

Bases: whylogs.api.writer.whylabs_base.WhyLabsWriterBase

Parameters
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) 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.

Zipped profiles are not supported Reference profiles are not supported

Parameters

transaction_id (Optional[str]) –

Return type

str

commit_transaction() None#

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

Return type

None

abort_transaction() None#

Prevent the profiles uploaded in the current transaction from being ingested. You still need to call commit_transaction(), but it will throw a NotFoundException to indicate the transaction was unsuccessful.

Return type

None

write(file: whylogs.api.writer.writer.Writable, dest: Optional[str] = None, **kwargs: Any) Tuple[bool, Union[str, List[Tuple[bool, str]]]]#
Parameters
Return type

Tuple[bool, Union[str, List[Tuple[bool, str]]]]

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

writer (WhyLabsWriter) –