我使用deeplearning4j构建了一个lr,并且只有三个训练数据。
但是我得到了错误:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
double [][] train = new double[][]{{1.2,2.2,3.2},{2.2,3.2,4.2},{4.5,5.2,4.1}};
int [] label = {1,1,0};
INDArray trainSet = Nd4j.create(train);
net.fit(trainSet,label);
And the layer is:
OutputLayer outputLayer = new OutputLayer.Builder(LossFunction.XENT)
.nIn(dim)
.nOut(1)
.weightInit(WeightInit.XAVIER)
.activation(Activation.SIGMOID)
.build();
MultiLayerConfiguration logistic = new NeuralNetConfiguration.Builder()
.seed(123)
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT)
.list()
.layer(0,outputLayer)
.build();
我的图层代码有问题吗?我想进行二进制分类,标签是否为0和1