transbioZI / RMTL

Regularized Multi-task Learning in R
https://CRAN.R-project.org/package=RMTL
19 stars 12 forks source link

the error in seq.default(cv_idx, task_sample_size, by = cv_fold) #2

Closed GazeLei closed 5 years ago

GazeLei commented 5 years ago

I used this package for the multi-task learning of regression problem. The dataset is (160row, 31 column), and the X is (160row, 28column), Y is (160row, 3 column).

The model and the parameter are that:

cvfitr1 <- cvMTL(X, Y, type="Regression", Regularization="L21",

  • Lam1_seq=10^seq(1,-4, -1), Lam2=0, opts=list(init=0, tol=10^-6, maxIter=1500),
  • nfolds= 10, stratify=F, parallel=F)

The error is that: Error in seq.default(cv_idx, task_sample_size, by = cv_fold) : wrong sign in 'by' argument.

Another model and parameter:

model <- MTL(X, Y, type = "Regression",Regularization="L21",

  • Lam1=0.1, Lam2=0.1, opts=list(init=0, tol=10^-6, maxIter=500)) Error is that: Error in Y[[x]] : 下标出界(the subscript out of size)
hank9cao commented 5 years ago

Hi Lei: I think what you want to try is multi-response prediction, because your Y has 3 columns. So you have to transfer your data into multi-task learning form as the input. Say your data is x=160x28, y=160x3 X=list(); X[[1]]=x;X[[2]]=x;X[[3]]=x; Y=list();Y[[1]]=y[,1];Y[[2]]=y[,2];Y[[3]]=y[,3];

Regards, Hank