Skip to content

Error in makePlots() : Problem in salience map computation #9

@adeldaoud

Description

@adeldaoud

@cjerzak I am running the following code and the model seems to complete just fine but then at the end the process throughts an error at me and the ImageConfoundingAnalysis_clear never materializes. Any thoughts?

# Causal inference with image confounding ----

## data definitions

obsW <- sim_data$X  # Observed confounder
obsY <- sim_data$Y  # Observed outcome
X <- NULL
nSGD_selected <- 300L  # Number of stochastic gradient descent iterations

# Perform causal inference with image confounding
imageModelClass <- "VisionTransformer"
optimizeImageRep <- TRUE
print(sprintf("Image confounding analysis & optimizeImageRep: %s & imageModelClass: %s", optimizeImageRep, imageModelClass))

# Perform causal inference with image confounding for clear image
ImageConfoundingAnalysis_clear <- causalimages::AnalyzeImageConfounding(
  # input data 
  obsW = obsW,
  obsY = obsY,
  X = NULL, # X[, apply(X, 2, sd) > 0],
  imageKeysOfUnits = KeysOfObservations,
  file = TFRecordName_im,
  
  # modeling parameters 
  batchSize = 16L,
  nBoot = 5L,
  optimizeImageRep = TRUE,
  imageModelClass = imageModelClass,
  nDepth_ImageRep = 4L,
  nWidth_ImageRep = as.integer(2^8),
  learningRateMax = 0.001, nSGD = nSGD_selected,
  dropoutRate = 0.1,
  plotBands = c(1,2,3),
  plotResults = TRUE, figuresTag = "SimConfoundingIm",
  figuresPath = "./"
)
try(dev.off(), TRUE)

Returning output in TransformerBackbone()
Returning ImageRepArm_SpatialArm outputs...
Returning ImageRepArm_batch outputs...
In GetTreatProb_batch() - dense model
Starting GetDense_OneObs()
Returning output and state in GetDense_OneObs()...[1] "Error in h(simpleError(msg, call)) : \n error in evaluating the argument 'x' in selecting a method for function 'brick': incorrect number of dimensions\n"
attr(,"class")
[1] "try-error"
attr(,"condition")
<simpleError in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'brick': incorrect number of dimensions>
Show Traceback
Rerun with Debug
Error in makePlots() : Problem in salience map computation!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions