R/customMetrics.R
weighted_categorical_crossentropy.Rd
ported from this implementation:
weighted_categorical_crossentropy(y_true, y_pred, weights)
y_true | True labels (Tensor) |
---|---|
y_pred | Predictions (Tensor of the same shape as |
weights | weights for each class |
function value
https://gist.github.com/wassname/ce364fddfc8a025bfab4348cf5de852d
Tustison NJ
library( ANTsRNet ) library( keras ) model <- createUnetModel2D( c( 64, 64, 1 ), numberOfOutputs = 2 )#> Error in py_discover_config(required_module, use_environment): Python specified in RETICULATE_PYTHON (/Users/ntustison/anaconda3/envs/antsx/bin/python3) does not existmodel %>% compile( loss = weighted_categorical_crossentropy( weights = c( 1, 1 ) ), optimizer = optimizer_adam( lr = 0.0001 ), metrics = "accuracy" )#> Error in compile(., loss = weighted_categorical_crossentropy(weights = c(1, 1)), optimizer = optimizer_adam(lr = 1e-04), metrics = "accuracy"): object 'model' not found