当前位置: 首页>>代码示例>>Java>>正文


Java Evaluation.f1方法代码示例

本文整理汇总了Java中org.deeplearning4j.eval.Evaluation.f1方法的典型用法代码示例。如果您正苦于以下问题:Java Evaluation.f1方法的具体用法?Java Evaluation.f1怎么用?Java Evaluation.f1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.deeplearning4j.eval.Evaluation的用法示例。


在下文中一共展示了Evaluation.f1方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testMLPMultiLayerBackprop

import org.deeplearning4j.eval.Evaluation; //导入方法依赖的package包/类
@Test
public void testMLPMultiLayerBackprop() {
    MultiLayerNetwork model = getDenseMLNConfig(true, false);
    model.fit(iter);

    MultiLayerNetwork model2 = getDenseMLNConfig(true, false);
    model2.fit(iter);
    iter.reset();

    DataSet test = iter.next();

    assertEquals(model.params(), model2.params());

    Evaluation eval = new Evaluation();
    INDArray output = model.output(test.getFeatureMatrix());
    eval.eval(test.getLabels(), output);
    double f1Score = eval.f1();

    Evaluation eval2 = new Evaluation();
    INDArray output2 = model2.output(test.getFeatureMatrix());
    eval2.eval(test.getLabels(), output2);
    double f1Score2 = eval2.f1();

    assertEquals(f1Score, f1Score2, 1e-4);

}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:27,代码来源:DenseTest.java

示例2: f1Score

import org.deeplearning4j.eval.Evaluation; //导入方法依赖的package包/类
/**{@inheritDoc}
 */
@Override
public double f1Score(INDArray examples, INDArray labels) {
    INDArray out = activate(examples, false);
    Evaluation eval = new Evaluation();
    eval.evalTimeSeries(labels, out, maskArray);
    return eval.f1();
}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:10,代码来源:RnnLossLayer.java

示例3: f1Score

import org.deeplearning4j.eval.Evaluation; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public double f1Score(INDArray examples, INDArray labels) {
    INDArray out = activate(examples, false);
    Evaluation eval = new Evaluation();
    eval.evalTimeSeries(labels, out, maskArray);
    return eval.f1();
}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:11,代码来源:CnnLossLayer.java

示例4: testCNNMLNPretrain

import org.deeplearning4j.eval.Evaluation; //导入方法依赖的package包/类
@Test
public void testCNNMLNPretrain() throws Exception {
    // Note CNN does not do pretrain
    int numSamples = 10;
    int batchSize = 10;
    DataSetIterator mnistIter = new MnistDataSetIterator(batchSize, numSamples, true);

    MultiLayerNetwork model = getCNNMLNConfig(false, true);
    model.fit(mnistIter);

    mnistIter.reset();

    MultiLayerNetwork model2 = getCNNMLNConfig(false, true);
    model2.fit(mnistIter);
    mnistIter.reset();

    DataSet test = mnistIter.next();

    Evaluation eval = new Evaluation();
    INDArray output = model.output(test.getFeatureMatrix());
    eval.eval(test.getLabels(), output);
    double f1Score = eval.f1();

    Evaluation eval2 = new Evaluation();
    INDArray output2 = model2.output(test.getFeatureMatrix());
    eval2.eval(test.getLabels(), output2);
    double f1Score2 = eval2.f1();

    assertEquals(f1Score, f1Score2, 1e-4);


}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:33,代码来源:ConvolutionLayerTest.java

示例5: testCNNMLNBackprop

import org.deeplearning4j.eval.Evaluation; //导入方法依赖的package包/类
@Test
public void testCNNMLNBackprop() throws Exception {
    int numSamples = 10;
    int batchSize = 10;
    DataSetIterator mnistIter = new MnistDataSetIterator(batchSize, numSamples, true);

    MultiLayerNetwork model = getCNNMLNConfig(true, false);
    model.fit(mnistIter);

    MultiLayerNetwork model2 = getCNNMLNConfig(true, false);
    model2.fit(mnistIter);

    DataSet test = mnistIter.next();

    Evaluation eval = new Evaluation();
    INDArray output = model.output(test.getFeatureMatrix());
    eval.eval(test.getLabels(), output);
    double f1Score = eval.f1();

    Evaluation eval2 = new Evaluation();
    INDArray output2 = model2.output(test.getFeatureMatrix());
    eval2.eval(test.getLabels(), output2);
    double f1Score2 = eval2.f1();

    assertEquals(f1Score, f1Score2, 1e-4);

}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:28,代码来源:ConvolutionLayerTest.java

示例6: testMLPMultiLayerPretrain

import org.deeplearning4j.eval.Evaluation; //导入方法依赖的package包/类
@Test
public void testMLPMultiLayerPretrain() {
    // Note CNN does not do pretrain
    MultiLayerNetwork model = getDenseMLNConfig(false, true);
    model.fit(iter);

    MultiLayerNetwork model2 = getDenseMLNConfig(false, true);
    model2.fit(iter);
    iter.reset();

    DataSet test = iter.next();

    assertEquals(model.params(), model2.params());

    Evaluation eval = new Evaluation();
    INDArray output = model.output(test.getFeatureMatrix());
    eval.eval(test.getLabels(), output);
    double f1Score = eval.f1();

    Evaluation eval2 = new Evaluation();
    INDArray output2 = model2.output(test.getFeatureMatrix());
    eval2.eval(test.getLabels(), output2);
    double f1Score2 = eval2.f1();

    assertEquals(f1Score, f1Score2, 1e-4);

}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:28,代码来源:DenseTest.java

示例7: f1Score

import org.deeplearning4j.eval.Evaluation; //导入方法依赖的package包/类
/**
 * Returns the f1 score for the given examples.
 * Think of this to be like a percentage right.
 * The higher the number the more it got right.
 * This is on a scale from 0 to 1.
 *
 * @param examples te the examples to classify (one example in each row)
 * @param labels   the true labels
 * @return the scores for each ndarray
 */
@Override
public double f1Score(INDArray examples, INDArray labels) {
    Evaluation eval = new Evaluation();
    eval.eval(labels, labelProbabilities(examples));
    return eval.f1();
}
 
开发者ID:deeplearning4j,项目名称:deeplearning4j,代码行数:17,代码来源:LossLayer.java


注:本文中的org.deeplearning4j.eval.Evaluation.f1方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。