Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
线性基函数在R_R - Fatal编程技术网

线性基函数在R

线性基函数在R,r,R,我正在尝试实现线性模型 y(x,w) = w0 + w1 * x1 + ... + wD * xD. 在R 到目前为止,我已经尝试过: linearbf <- function(x, w) { dims <- dim(x) M <- t(x) M <- rbind(matrix(1,1,dims[1]), M) pred_y <- t(w)*M pred_y2 <- t(pred_y) invisible(pred_y2)

我正在尝试实现线性模型

y(x,w) = w0 + w1 * x1 + ... + wD * xD.
在R

到目前为止,我已经尝试过:

linearbf <- function(x, w) {
  dims <- dim(x)    
  M <- t(x)
  M <- rbind(matrix(1,1,dims[1]), M)
  pred_y <- t(w)*M
  pred_y2 <- t(pred_y)
  invisible(pred_y2)
  }

linearf您是否打算通过
t(w)*M
得到一个叉积?如果是这种情况,请使用
t(w)%*%M
I然后得到另一个错误:“t(w)%*%M中的错误:不一致参数”请提供一个小样本输入和预期输出。