apache / mxnet

Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more
https://mxnet.apache.org
Apache License 2.0
20.78k stars 6.79k forks source link

Error in output.shape[[output.names]] #9967

Open AndreGuerra123 opened 6 years ago

AndreGuerra123 commented 6 years ago

Note: Providing complete information in the most concise form is the best way to get help. This issue template serves as the checklist for essential information to most of the technical issues and bug reports. For non-technical issues and feature requests, feel free to present the information in what you believe is the best form.

For Q & A and discussion, please start a discussion thread at https://discuss.mxnet.io

Description

Failed to get some dimension properties from a multidimensional array in R, right in the beginning of the feedforward.create function.

Environment info (Required)

What to do:
1. Download the diagnosis script from https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py
2. Run the script using `python diagnose.py` and paste its output here.

C:\Users\admin\Desktop>python diagnose.py
----------Python Info----------
Version      : 3.6.3
Compiler     : MSC v.1900 64 bit (AMD64)
Build        : ('v3.6.3:2c5fed8', 'Oct  3 2017 18:11:49')
Arch         : ('64bit', 'WindowsPE')
------------Pip Info-----------
Version      : 9.0.1
Directory    : C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\site-pa
ckages\pip
----------MXNet Info-----------
No MXNet installed.
----------System Info----------
Platform     : Windows-7-6.1.7601-SP1
system       : Windows
node         : ceamphd82
release      : 7
version      : 6.1.7601
----------Hardware Info----------
machine      : AMD64
processor    : Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
Traceback (most recent call last):
  File "diagnose.py", line 177, in <module>
    check_hardware()
  File "diagnose.py", line 143, in check_hardware
    subprocess.call(['wmic', 'cpu', 'get', 'name'])
  File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\subprocess.py"
, line 267, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\subprocess.py"
, line 709, in __init__
    restore_signals, start_new_session)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\subprocess.py"
, line 997, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

Package used (Python/R/Scala/Julia): (I'm using R) For R user, please provide R sessionInfo(): R version 3.4.1 (2017-06-30) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale: [1] LC_COLLATE=English_United Kingdom.1252 [2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

attached base packages: [1] stats graphics grDevices utils datasets [6] methods base

other attached packages: [1] mxnet_0.10.1 RMySQL_0.10.13 DBI_0.7

loaded via a namespace (and not attached): [1] Rcpp_0.12.12 pillar_1.1.0
[3] compiler_3.4.1 RColorBrewer_1.1-2 [5] influenceR_0.1.0 plyr_1.8.4
[7] bindr_0.1 viridis_0.4.0
[9] tools_3.4.1 digest_0.6.12
[11] jsonlite_1.5 viridisLite_0.2.0 [13] tibble_1.4.1 gtable_0.2.0
[15] rgexf_0.15.3 pkgconfig_2.0.1
[17] rlang_0.1.2 igraph_1.1.2
[19] rstudioapi_0.7 yaml_2.1.14
[21] bindrcpp_0.2 gridExtra_2.3
[23] downloader_0.4 DiagrammeR_0.9.2
[25] dplyr_0.7.3 stringr_1.2.0
[27] htmlwidgets_0.9 hms_0.3
[29] grid_3.4.1 glue_1.1.1
[31] R6_2.2.2 Rook_1.1-1
[33] XML_3.98-1.9 readr_1.1.1
[35] purrr_0.2.3 tidyr_0.7.2
[37] ggplot2_2.2.1 magrittr_1.5
[39] codetools_0.2-15 scales_0.5.0
[41] htmltools_0.3.6 assertthat_0.2.0
[43] colorspace_1.3-2 brew_1.0-6
[45] stringi_1.1.5 visNetwork_2.0.1
[47] lazyeval_0.2.0 munsell_0.4.3

Error Message:

Error in output.shape[[output.names]] <- dim((X$value())$label) : attempt to select less than one element in OneIndex

Minimum reproducible example

(If you are using your own code, please provide a short script that reproduces the error. Otherwise, please provide link to the existing example.)

Steps to reproduce

x is Large array (492 426 3 * 126) - width, height,channel, samples/ y is factor vector of size 126;

  1. mo <- mx.symbol.Variable('data');
  2. m1 <- mx.symbol.FullyConnected(data = mo, num.hidden = 20, no.bias = FALSE, name ='damn')
  3. Model <- mx.model.FeedForward.create(m1,X=x,y=YDataset$Classification, ctx = cpu, num.round = 30, array.batch.size = 100, learning.rate = 0.05, momentum = 0.9, wd=0.0001, eval.metric = mx.metric.accuracy) <- Error only happens here.

What have you tried to solve it?

  1. I have no idea what to do when your x data has no labels. Is this necessary?
  2. I cannot attach the data since its bigger than 10MB xD. Here it is: https://drive.google.com/file/d/1uM8AotCKGUGMsrAZNYwJYWuVUv7K0JWT/view?usp=sharing
jeremiedb commented 6 years ago

mx.model.FeedForward.create is a function intended for training of the model, it is therefore expected to have a label passed as the y argument.

Your model should have a loss function for in order to train; for example, mx.symbol.LinearRegressionOutput. Please take a look at this MNIST tutorial for example: http://mxnet.incubator.apache.org/tutorials/r/mnistCompetition.html.

You need to be aware of the the data dimensions through the model: if 126 samples in X, Y should also be of length 126. Check the model arhcitecture used: a FC on images (which should normally be of equal WH dimensions) is likely not what is needed (check for convolution layers). And if performing a 2 class classification, then needs a final FC with num_hidden = 2 followed by a softmaxoutput or rather a FC of size 1 followed by a LogisticLinearOutput.

AndreGuerra123 commented 6 years ago

The number of observations is the same. (Edited above) What do you mean as a label passed as the y argument? I have a vector of the type factor with the labels "I","II","III", etc... Could you please look into the dataset I shared?

vandanavk commented 5 years ago

@mxnet-label-bot add [R]