我有一个 INDArray 的数据,它是 x 的返回值,如下所示:
private static INDArray createDataSet(String path)throws Exception {
List<String> lines = IOUtils.readLines(new FileInputStream(path), StandardCharsets.UTF_8);
double[] position = new double[lines.size()];
double[] year = new double[lines.size()];
double[] month = new double[lines.size()];
double[] day = new double[lines.size()];
double[] close = new double[lines.size()];
int linecount = 0;
Iterator<String> it = lines.iterator();
while(it.hasNext()) {
String line = it.next();
String[] parts = line.split(",");
position[linecount] = linecount;
year[linecount] = Double.valueOf(parts[0]);
month[linecount] = Double.valueOf(parts[1]);
day[linecount] = Double.valueOf(parts[2]);
close[linecount] = Double.valueOf(parts[5]);
linecount++;
}//endloop
double[][] arr2D = new double[][] {position, year, month, day, close};
INDArray x = Nd4j.createFromArray(arr2D);
return x;
}
我正在尝试复制 csvplotter 示例并使用单个输入/输出网络执行线性回归。
我如何将数组行(0)作为特征和数组行(4)作为标签加载?
更多信息:
System.out.println(ds.rank());
long[] l = ds.shape();
System.out.println(l[0] + " , " + l[1] + " - " + l.length);
System.out.println(ds.length());
结果是:
2,
5, 1260 -2
6300
为了清楚起见,这是我的问题:
for (int i = 0; i < nEpochs; i++) {
net.fit(d);
}
根据我尝试添加数据的方式导致各种错误