Skip to main content

Overview

The Client$log() is designed for training, validation or production environment where batches of data are processed. These environments may be either a R Studio Notebook or a R server that is batch processing lots of backend data. Import and initialize Arize R client from the Arize Client$new() to call Client$log() with a R data.frame() containing inference data.

Initializing Client Examples

ORGANIZATION_KEY <- 'ORGANIZATION_KEY'
API_KEY <- 'API_KEY'
arize_client <- Client$new(
    organization_key = ORGANIZATION_KEY, 
    api_key = API_KEY)

Parameters & Returns

schema <- create_schema(
  prediction_id_column_name = "prediction_id",
  prediction_label_column_name = "prediction_label",
  prediction_score_column_name = "prediction_score",
  actual_label_column_name = "actual_label",
  actual_score_column_name = "actual_score",
  feature_column_names = features,
  timestamp_column_name = "prediction_ts"
)


# send training data
arize_client$log(
  .data_frame = df_train,
  .schema = schema
  .model_id = model_id,
  .model_version = model_version,
  .model_type = model_types$SCORE_CATEGORICAL,
  .environment = environments$TRAINING,
)
ParameterData TypeDescriptionRequired
.data_framedata.framedata.frame to logRequired
.schemaarize::create_schemathe schema
(see ?arize::create_schema)
Required
.model_idcharactercharacter, id for the modelRequired
.model_typeinteger1 for binary,
2 for numeric,
3 for categorical,
4 for score-categorical
Required
.environmentenvironment1 for production,
2 for validation,
3 for training
Required
.model_versioncharactercharacter, the model versionOptional
.batch_idcharactercharacter, the batch idOptional
.synclogicallogical, whether to syncOptional
.validatelogicallogical, whether to run validation checksOptional
.pathcharactercharacter, path to use for serializationOptional

Schema Attributes

AttributeData TypeDescriptionRequired
prediction_id_column_namecharacterColumn name for prediction_idRequired
feature_column_namesList[character]List of column names for featuresOptional
prediction_label_column_namecharacterColumn name for prediction labelOptional
prediction_score_column_namecharacterColumn name for prediction scoresOptional
actual_label_column_namecharacterColumn name for actual labelOptional
actual_score_column_namestrColumn name for numeric sequences. Used for NDCG calculations in ranking modelsOptional
timestamp_column_namecharacterColumn name for timestampsOptional

Examples

Check out the Example Tutorial

Example 1: Logging Features, Predictions, & Actuals

model_id <- "click_through_rate_categorical_vignette_R"  # This is the model name that will show up in Arize
model_version <- "v1.0"  # Version of model - can be any string

schema <- create_schema(
  prediction_id_column_name = "id",
  feature_column_names = features,
  prediction_label_column_name = "predictions",
  prediction_score_column_name = "CTR_predicted",
  actual_label_column_name = "actuals",
  actual_score_column_name = "CTR",
  timestamp_column_name = "model_date"
)

arize_client$log(
  .data_frame = df_train,
  .model_id = model_id,
  .model_version = model_version,
  .model_type = model_types$SCORE_CATEGORICAL,
  .environment = environments$TRAINING,
  .schema = schema
)