Skip to contents

Compiles the model. The method prepares a neural network for estimation by setting the optimizer, loss function, and other parameters as needed.

DLMatchingModel

The method calls the tf.keras.compile method of the tf.keras.Model class.

NSMatchingModel

Neural symbolic models are fit using a custom training loop so there is no need to calls tf.keras.compile method of the tf.keras.Model class. The method sets the optimizer for the model. The loss (for hybrid neural-symbolic and deep learning models) is set to binary cross-entropy ( tf.keras.losses.BinaryCrossentropy)

RefutationModel

Neural symbolic models are fit using a custom training loop so there is no need to calls tf.keras.compile method of the tf.keras.Model class. The method sets the optimizer for the model. The loss (for hybrid neural-symbolic and deep learning models) is set to binary cross-entropy ( tf.keras.losses.BinaryCrossentropy)

Usage

compile(object, ...)

# S4 method for class 'neer_match.matching_model.DLMatchingModel'
compile(object, ...)

# S4 method for class 'neer_match.matching_model.NSMatchingModel'
compile(object, optimizer = tensorflow::tf$keras$optimizers$Adam())

# S4 method for class 'neer_match.reasoning.RefutationModel'
compile(object, optimizer = tensorflow::tf$keras$optimizers$Adam())

Arguments

object

A matching model object.

...

Additional arguments passed to tf.keras.compile.

optimizer

A tf.keras.optimizers optimizer object.

Value

Called for side effects.

Examples

smap <- SimilarityMap(
  instructions = list(
    `movie ~film` = list("jaro_winkler", "damerau_levenshtein"),
    `studio` = list("jaccard", "levenshtein"),
    `reviews~score` = list("euclidean")
  )
)
model <- DLMatchingModel(smap)
compile(model, optimizer = tensorflow::tf$keras$optimizers$Adam())