abess-team / abess

Fast Best-Subset Selection Library
https://abess.readthedocs.io/
Other
474 stars 41 forks source link

Error in x_y_matching.glm(para, data) : Rows of x must be the same as rows of y! #538

Closed mytarmail closed 4 months ago

mytarmail commented 4 months ago

Describe the bug

I try to make Multi-Response Linear Regression but i get error

abess::abess(x = xx, y = yy, family = "multinomial") .

Error in x_y_matching.glm(para, data) : 
  Rows of x must be the same as rows of y!
In addition: Warning message:
In y_matrix.glm(para, data) :
  The number of the category of y is relative large compare to nvars.
              The numerical result might be unstable.

Code for Reproduction

Paste your code for reproducing the bug:

yy <- structure(c(1.12169, 1.12225, 1.12156, 1.12339, 1.12264, 1.12341, 
                  1.12165, 1.12235, 1.12109, 1.12258, 1.12186, 1.12427, 1.12193, 
                  1.12338, 1.12257, 1.12307, 1.12231, 1.12366, 1.12267, 1.1243, 
                  1.12375, 1.12435, 1.12369, 1.1242, 1.12351, 1.12402, 1.1234, 
                  1.12423, 1.12269, 1.12364, 1.12245, 1.12315, 1.12235, 1.12293, 
                  1.12174, 1.12283, 1.12223, 1.12282, 1.12222, 1.12341, 1.12234, 
                  1.12398, 1.12298, 1.12433, 1.12367, 1.12428, 1.12328, 1.12448, 
                  1.12373, 1.12485, 1.12379, 1.12225, 1.12156, 1.12339, 1.12264, 
                  1.12341, 1.12165, 1.12235, 1.12109, 1.12258, 1.12186, 1.12427, 
                  1.12193, 1.12338, 1.12257, 1.12307, 1.12231, 1.12366, 1.12267, 
                  1.1243, 1.12375, 1.12435, 1.12369, 1.1242, 1.12351, 1.12402, 
                  1.1234, 1.12423, 1.12269, 1.12364, 1.12245, 1.12315, 1.12235, 
                  1.12293, 1.12174, 1.12283, 1.12223, 1.12282, 1.12222, 1.12341, 
                  1.12234, 1.12398, 1.12298, 1.12433, 1.12367, 1.12428, 1.12328, 
                  1.12448, 1.12373, 1.12485, 1.12379, 1.12442, 1, -1, 1, -1, 1, 
                  -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 
                  -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 
                  -1, 1, -1, 1, -1, 1, -1, 1, -1, 1), dim = c(51L, 3L), dimnames = list(
                    NULL, c("y 4", "y 5", "y 6")))

xx <- structure(c(1.12056, 1.12355, 1.12287, 1.1243, 1.12169, 1.12225, 
                  1.12156, 1.12339, 1.12264, 1.12341, 1.12165, 1.12235, 1.12109, 
                  1.12258, 1.12186, 1.12427, 1.12193, 1.12338, 1.12257, 1.12307, 
                  1.12231, 1.12366, 1.12267, 1.1243, 1.12375, 1.12435, 1.12369, 
                  1.1242, 1.12351, 1.12402, 1.1234, 1.12423, 1.12269, 1.12364, 
                  1.12245, 1.12315, 1.12235, 1.12293, 1.12174, 1.12283, 1.12223, 
                  1.12282, 1.12222, 1.12341, 1.12234, 1.12398, 1.12298, 1.12433, 
                  1.12367, 1.12428, 1.12328, 1.12355, 1.12287, 1.1243, 1.12169, 
                  1.12225, 1.12156, 1.12339, 1.12264, 1.12341, 1.12165, 1.12235, 
                  1.12109, 1.12258, 1.12186, 1.12427, 1.12193, 1.12338, 1.12257, 
                  1.12307, 1.12231, 1.12366, 1.12267, 1.1243, 1.12375, 1.12435, 
                  1.12369, 1.1242, 1.12351, 1.12402, 1.1234, 1.12423, 1.12269, 
                  1.12364, 1.12245, 1.12315, 1.12235, 1.12293, 1.12174, 1.12283, 
                  1.12223, 1.12282, 1.12222, 1.12341, 1.12234, 1.12398, 1.12298, 
                  1.12433, 1.12367, 1.12428, 1.12328, 1.12448, 1.12287, 1.1243, 
                  1.12169, 1.12225, 1.12156, 1.12339, 1.12264, 1.12341, 1.12165, 
                  1.12235, 1.12109, 1.12258, 1.12186, 1.12427, 1.12193, 1.12338, 
                  1.12257, 1.12307, 1.12231, 1.12366, 1.12267, 1.1243, 1.12375, 
                  1.12435, 1.12369, 1.1242, 1.12351, 1.12402, 1.1234, 1.12423, 
                  1.12269, 1.12364, 1.12245, 1.12315, 1.12235, 1.12293, 1.12174, 
                  1.12283, 1.12223, 1.12282, 1.12222, 1.12341, 1.12234, 1.12398, 
                  1.12298, 1.12433, 1.12367, 1.12428, 1.12328, 1.12448, 1.12373, 
                  1.1243, 1.12169, 1.12225, 1.12156, 1.12339, 1.12264, 1.12341, 
                  1.12165, 1.12235, 1.12109, 1.12258, 1.12186, 1.12427, 1.12193, 
                  1.12338, 1.12257, 1.12307, 1.12231, 1.12366, 1.12267, 1.1243, 
                  1.12375, 1.12435, 1.12369, 1.1242, 1.12351, 1.12402, 1.1234, 
                  1.12423, 1.12269, 1.12364, 1.12245, 1.12315, 1.12235, 1.12293, 
                  1.12174, 1.12283, 1.12223, 1.12282, 1.12222, 1.12341, 1.12234, 
                  1.12398, 1.12298, 1.12433, 1.12367, 1.12428, 1.12328, 1.12448, 
                  1.12373, 1.12485, 1.12169, 1.12225, 1.12156, 1.12339, 1.12264, 
                  1.12341, 1.12165, 1.12235, 1.12109, 1.12258, 1.12186, 1.12427, 
                  1.12193, 1.12338, 1.12257, 1.12307, 1.12231, 1.12366, 1.12267, 
                  1.1243, 1.12375, 1.12435, 1.12369, 1.1242, 1.12351, 1.12402, 
                  1.1234, 1.12423, 1.12269, 1.12364, 1.12245, 1.12315, 1.12235, 
                  1.12293, 1.12174, 1.12283, 1.12223, 1.12282, 1.12222, 1.12341, 
                  1.12234, 1.12398, 1.12298, 1.12433, 1.12367, 1.12428, 1.12328, 
                  1.12448, 1.12373, 1.12485, 1.12379, -1, 1, -1, 1, -1, 1, -1, 
                  1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 
                  1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 
                  1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 
                  1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 
                  1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 
                  1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 
                  1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 
                  1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 
                  1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 
                  1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 
                  1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 
                  1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 
                  1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 
                  1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 10, 80, 4, 32, 
                  75, 3, 11, 49, 4, 12, 29, 8, 13, 20, 7, 52, 5, 7, 2, 2, 4, 9, 
                  6, 24, 8, 8, 12, 10, 18, 11, 6, 43, 26, 74, 151, 52, 64, 39, 
                  135, 69, 61, 81, 15, 11, 19, 33, 16, 11, 5, 8, 16, 80, 4, 32, 
                  75, 3, 11, 49, 4, 12, 29, 8, 13, 20, 7, 52, 5, 7, 2, 2, 4, 9, 
                  6, 24, 8, 8, 12, 10, 18, 11, 6, 43, 26, 74, 151, 52, 64, 39, 
                  135, 69, 61, 81, 15, 11, 19, 33, 16, 11, 5, 8, 16, 14, 4, 32, 
                  75, 3, 11, 49, 4, 12, 29, 8, 13, 20, 7, 52, 5, 7, 2, 2, 4, 9, 
                  6, 24, 8, 8, 12, 10, 18, 11, 6, 43, 26, 74, 151, 52, 64, 39, 
                  135, 69, 61, 81, 15, 11, 19, 33, 16, 11, 5, 8, 16, 14, 28, 32, 
                  75, 3, 11, 49, 4, 12, 29, 8, 13, 20, 7, 52, 5, 7, 2, 2, 4, 9, 
                  6, 24, 8, 8, 12, 10, 18, 11, 6, 43, 26, 74, 151, 52, 64, 39, 
                  135, 69, 61, 81, 15, 11, 19, 33, 16, 11, 5, 8, 16, 14, 28, 10, 
                  75, 3, 11, 49, 4, 12, 29, 8, 13, 20, 7, 52, 5, 7, 2, 2, 4, 9, 
                  6, 24, 8, 8, 12, 10, 18, 11, 6, 43, 26, 74, 151, 52, 64, 39, 
                  135, 69, 61, 81, 15, 11, 19, 33, 16, 11, 5, 8, 16, 14, 28, 10, 
                  27), dim = c(51L, 15L), dimnames = list(NULL, c("x 1", "x 2", 
                                                                  "x 3", "x 4", "x 5", "x 6", "x 7", "x 8", "x 9", "x 10", "x 11", 
                                                                  "x 12", "x 13", "x 14", "x 15")))

abess::abess(x = xx, y = yy, family = "multinomial")

Desktop (please complete the following information):

 sessionInfo()

R version 4.3.3 (2024-02-29 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

time zone: Europe/Kiev
tzcode source: internal

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

loaded via a namespace (and not attached):
[1] MASS_7.3-60.0.1   compiler_4.3.3    Matrix_1.6-5      tools_4.3.3      
[5] abess_0.4.8       rstudioapi_0.16.0 Rcpp_1.0.12       grid_4.3.3       
[9] lattice_0.22-5  
mytarmail commented 4 months ago

Please delete this question as incorrect