whylogs.app.logger
Class and functions for whylogs logging
#
Logger ObjectsClass for logging whylogs statistics.
Arguments:
session_id
: The session ID value. Should be set by the Session bojectdataset_name
: The name of the dataset. Gets included in the DatasetProfile metadata and can be used in generated filenames.dataset_timestamp
: Optional. The timestamp that the logger representssession_timestamp
: Optional. The time the session was createdtags
: Optional. Dictionary of key, value for aggregating data upstreammetadata
: Optional. Dictionary of key, value. Useful for debugging (associated with every single dataset profile)writers
: List of Writer objects used to write out the data :param with_rotation_time. Whether to rotate with time, takes values of overall rotation interval, "s" for seconds "m" for minutes "h" for hours "d" for days :param interval. Additinal time rotation multipler.verbose
: enable debug logging or notcache_size
: set how many dataprofiles to cachesegments
: define either a list of egment keys or a list of segments tags: [ {"key":<featurename>,"value": <featurevalue>},... ]profile_full_dataset
: when segmenting dataset, an option to keep the full unsegmented profile of the dataset.constraints
: static assertions to be applied to streams and summaries.
#
profileReturns:
the last backing dataset profile :rtype: DatasetProfile
#
segmented_profilesReturns:
the last backing dataset profile :rtype: Dict[str, DatasetProfile]
#
flushSynchronously perform all remaining write tasks
#
full_profile_checkreturns a bool to determine if unsegmented dataset should be profiled.
#
closeFlush and close out the logger, outputs the last profile
Returns:
the result dataset profile. None if the logger is closed
#
logLogs a collection of features or a single feature (must specify one or the other).
Arguments:
features
: a map of key value feature for model inputfeature_name
: a dictionary of key->value for multiple features. Each entry represent a single columnar featurefeature_name
: name of a single feature. Cannot be specified if 'features' is specifiedvalue
: value of as single feature. Cannot be specified if 'features' is specified
#
log_imageAPI to track an image, either in PIL format or as an input path
Arguments:
feature_name
: name of the featuremetadata_attributes
: metadata attributes to extract for the imagesfeature_transforms
: a list of callables to transform the input into metrics :type image: Union[str, PIL.image]
#
log_local_datasetLog a local folder dataset It will log data from the files, along with structure file data like metadata, and magic numbers. If the folder has single layer for children folders, this will pick up folder names as a segmented feature
Arguments:
root_dir
str - directory where dataset is located.folder_feature_name
str, optional - Name for the subfolder features, i.e. class, store etc.v
None, optional - image transform that you would like to use with the image log
Raises:
NotImplementedError
- Description
#
log_annotationLog structured annotation data ie. JSON like structures
Arguments:
annotation_data
Dict or List - Description
Returns:
TYPE
- Description
#
log_csvLog a CSV file. This supports the same parameters as :funcpandas.red_csv<pandas.read_csv>
function.
Arguments:
filepath_or_buffer
: the path to the CSV or a CSV buffer :type filepath_or_buffer: FilePathOrBufferkwargs
: from pandas:read_csvsegments
: define either a list of segment keys or a list of segments tags:[ {"key":<featurename>,"value": <featurevalue>},... ]
profile_full_dataset
: when segmenting dataset, an option to keep the full unsegmented profile of the dataset.
#
log_dataframeGenerate and log a whylogs DatasetProfile from a pandas dataframe
Arguments:
profile_full_dataset
: when segmenting dataset, an option to keep the full unsegmented profile of the dataset.segments
: specify the tag key value pairs for segmentsdf
: the Pandas dataframe to log
#
is_activeReturn the boolean state of the logger