Skip to contents

DLMatchingModel

Extracts model predictions. The method calls the tf.keras.predict method of the. It automatically constructs a data generator from the left and right datasets iterating over all the elements of their Cartesian product.

NSMatchingModel

Extracts model predictions. It automatically constructs a data generator from the left and right datasets iterating over all the elements of their Cartesian product. The predictions are calculated using a custom loop over the batches of the generator.

RefutationModel

Extracts model predictions. It automatically constructs a data generator from the left and right datasets iterating over all the elements of their Cartesian product. The predictions are calculated using a custom loop over the batches of the generator.

Usage

# S3 method for class 'neer_match.matching_model.DLMatchingModel'
predict(object, left, right, ...)

# S3 method for class 'neer_match.matching_model.NSMatchingModel'
predict(object, left, right, batch_size = 32L, ...)

# S3 method for class 'neer_match.reasoning.RefutationModel'
predict(object, left, right, batch_size = 32L, ...)

Arguments

object

A matching model object.

left

A data frame with the left records.

right

A data frame with the right records.

...

Additional arguments passed to the tf.keras.predict method.

batch_size

The batch size (integer).

Value

The model predictions.

Examples

smap <- SimilarityMap(
  instructions = list(
    `score` = list("gaussian", "euclidean"),
    `platform` = list("osa", "indel")
  )
)
model <- DLMatchingModel(smap)
compile(model, loss = tensorflow::tf$keras$losses$BinaryCrossentropy())
matching_data <- fuzzy_games_example_data()
fit(
  model,
  matching_data$left, matching_data$right, matching_data$matches,
  epochs = 1L,
  verbose = 0L
)
#> <keras.src.callbacks.history.History object at 0x7fab73b00160>
predict(model, matching_data$left[1:2, ], matching_data$right[1:2, ])
#> [1] 0.4968898 0.4963212 0.4963212 0.4968898