Log a human-readable version of your dataset. Galileo will join these samples with the model's outputs and present them in the Console.
import dataquality as dq
dq.init(task_type="text_classification", # Change this based on your task type
# 🔭🌕 Log the class labels in the order they are outputted by the model
labels_list = ["positive review", "negative review", "very positive review", "very negative review"]
# 🔭🌕 Log your pandas/huggingface/tf datasets to Galileo
Add our logging layers to your Keras model's definition. This works with the functional or sequential syntax for defining models in Keras.
from dataquality.integrations.keras import DataQualityLoggingLayer
model = keras.Sequential(
DataQualityLoggingLayer("ids"), # 🌕🔭
DataQualityLoggingLayer("embs"), # 🌕🔭
DataQualityLoggingLayer("probs"), # 🌕🔭
Make sure to compile your model to run eagerly if it's not the default; add ids to your model's inputs; and add the Galileo callback to auto-log the epochs and splits.
from dataquality.integrations.keras import add_ids_to_numpy_arr, DataQualityCallback
x_train = add_ids_to_numpy_arr(x_train, train_ids) # 🌕🔭 ids from dataset logging
model.fit(x_train, y_train, ...,
callbacks=[ DataQualityCallback() ]) # 🌕🔭
dq.finish() # 🔭🌕 This will wait until the run is processed by Galileo