我和DeepLearning4J玩了一下,我想知道如何让分类器返回分数而不是标签。假设我使用linear classifier tutorial中的代码,我想让ANN返回给定训练示例的概率标记为0或1.当前配置如下所示:
MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
.seed(123)
.iterations(1)
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT)
.learningRate(0.01)
.updater(Updater.NESTEROVS)
.momentum(0.9)
.list()
.layer(0, new DenseLayer.Builder()
.nIn(2)
.nOut(20)
.weightInit(WeightInit.XAVIER)
.activation(Activation.RELU)
.build())
.layer(1, new OutputLayer.Builder(LossFunction.NEGATIVELOGLIKELIHOOD)
.nIn(20)
.nOut(2)
.weightInit(WeightInit.XAVIER)
.activation(Activation.SOFTMAX)
.build())
.pretrain(false)
.backprop(true)
.build();
答案 0 :(得分:2)