agnesdeng / misle

Multiple imputation through statistical learning
5 stars 0 forks source link

Cannot run misle example #3

Open bjw34032 opened 2 years ago

bjw34032 commented 2 years ago

Hi. I have successfully installed the misle package using your instructions, but trying to run the example code produces the following output (with trace). The virtualenv is running Python3.6 on ubuntu 18.04.

Is there possibly something wrong with the shape call on line 11?

Thanks, Brandon

> withNA_df <- createNA(adult, p = 0.3)
> MIDAE = Midae$new(
+   withNA_df,
+   iteration = 20,
+   input_drop = 0.2,
+   hidden_drop = 0.3,
+   n_h = 4L
+ )
Loaded Tensorflow version 1.14.0
 Error in py_call_impl(callable, dots$args, dots$keywords) : 
ValueError: Tried to convert 'shape' to a tensor and failed. Error: Cannot convert a partially known TensorShape to a Tensor: (?, 8)
14. stop(structure(list(message = "ValueError: Tried to convert 'shape' to a tensor and failed. Error: Cannot convert a partially known TensorShape to a Tensor: (?, 8)", 
call = py_call_impl(callable, dots$args, dots$keywords), 
cppstack = structure(list(file = "", line = -1L, stack = c("/home/brandon/R/x86_64-pc-linux-gnu-library/4.1/reticulate/libs/reticulate.so(Rcpp::exception::exception(char const*, bool)+0x78) [0x7f004303f448]", 
"/home/brandon/R/x86_64-pc-linux-gnu-library/4.1/reticulate/libs/reticulate.so(Rcpp::stop(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x27) [0x7f004303f4b7]", ...
13. _apply_op_helper at op_def_library.py#545
12. reshape at gen_array_ops.py#7715
11. tf$reshape(tf$boolean_mask(true_split[[n]], na_split[[n]]), shape = shape(-1,  output_struc[n]))
10. py_resolve_dots(list(...))
9. tf$compat$v1$losses$softmax_cross_entropy(tf$reshape(tf$boolean_mask(true_split[[n]], 
na_split[[n]]), shape = shape(-1, output_struc[n])), tf$reshape(tf$boolean_mask(pred_split[[n]], 
na_split[[n]]), shape = shape(-1, output_struc[n])))
8. midae_optimizer(self$x, self$na_idx, self$networkOutput, self$output_split,  self$output_struc)
7. force(expr)
6. tryCatchList(expr, classes, parentenv, handlers)
5. tryCatch(force(expr), finally = {
data$`__exit__`(NULL, NULL, NULL)
})
4. with.python.builtin.object(self$vae_graph$as_default(), {
tf <- tensorflow::tf
tf$compat$v1$disable_eager_execution()
tf$compat$v1$disable_v2_behavior() ...
3. with(self$vae_graph$as_default(), {
tf <- tensorflow::tf
tf$compat$v1$disable_eager_execution()
tf$compat$v1$disable_v2_behavior() ...
2. initialize(...)
1. idae$new(withNA_df, iteration = 20, input_drop = 0.2, hidden_drop = 0.3, n_h = 4L)
> R.Version()
$platform
[1] "x86_64-pc-linux-gnu"

$arch
[1] "x86_64"

$os
[1] "linux-gnu"

$system
[1] "x86_64, linux-gnu"

$status
[1] ""

$major
[1] "4"

$minor
[1] "1.3"

$year
[1] "2022"

$month
[1] "03"

$day
[1] "10"

$`svn rev`
[1] "81868"

$language
[1] "R"

$version.string
[1] "R version 4.1.3 (2022-03-10)"

$nickname
[1] "One Push-Up"