# Warning: 1 class was never predicted by the model and was excluded from average precision Classes excluded from average precision: \[1\]

**URL:** https://community.konduit.ai/t/warning-1-class-was-never-predicted-by-the-model-and-was-excluded-from-average-precision-classes-excluded-from-average-precision-1/624
**Category:** DL4J
**Created:** [June 17, 2020, 1:12pm UTC](https://community.konduit.ai/t/warning-1-class-was-never-predicted-by-the-model-and-was-excluded-from-average-precision-classes-excluded-from-average-precision-1/624 "2020-06-17T13:12:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![VyatcheslavLebedev](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/vyatcheslavlebedev/32/267_2.png) [@VyatcheslavLebedev](https://community.konduit.ai/u/VyatcheslavLebedev)
#### Post date: [June 17, 2020, 1:12pm UTC](https://community.konduit.ai/t/warning-1-class-was-never-predicted-by-the-model-and-was-excluded-from-average-precision-classes-excluded-from-average-precision-1/624/1 "2020-06-17T13:12:54Z")

</div>

I try to educate binary classifier. I have 178200 records and i checked that in this data i have a lot of 1 and 0 as a result.  
But i get

 ![Screenshot from 2020-06-17 00-30-46](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/1X/9c1d4a75047e815e7eb2e8473f59fed8c5b54293.png)

here is my code:

```java
public class Network {

    private static final int CLASSES_COUNT = 2;
    private static final int FEATURES_COUNT = 1000;

    public void train() throws IOException, InterruptedException {
        int seed = 123456;

        int numInputs = 1000;
        int numOutputs = 2;
        int numHiddenNodes = 2 * numInputs + numOutputs;
        double learningRate = 0.005;

        RecordReader recordReader = new CSVRecordReader(0, ',');
        recordReader.initialize(new FileSplit(new ClassPathResource("data.csv").getFile()));
        DataSet allData;

        System.out.println("start to read data");
        DataSetIterator iterator = new RecordReaderDataSetIterator(recordReader, 17820, FEATURES_COUNT, CLASSES_COUNT);
        allData = iterator.next();
        //System.out.println("read all data");
        allData.shuffle();

        SplitTestAndTrain testAndTrain = allData.splitTestAndTrain(0.65);
        DataSet trainingData = testAndTrain.getTrain();
        DataSet testData = testAndTrain.getTest();
        //DataSet testData = iterator.next();

        System.out.println("splitted data start to build configuration");
        MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
                .seed(seed)
                .biasInit(1)
                .l2(1e-4)
                .updater(new Nesterovs(learningRate, 0.9))
                .list()
                .layer(0, new DenseLayer.Builder().nIn(numInputs).nOut(numHiddenNodes)
                        .weightInit(WeightInit.XAVIER)
                        .activation(Activation.RELU)
                        .build())
                .layer(1, new DenseLayer.Builder().nIn(numHiddenNodes).nOut(numHiddenNodes)
                        .weightInit(WeightInit.XAVIER)
                        .activation(Activation.RELU)
                        .build())
                .layer(2, new OutputLayer.Builder(LossFunctions.LossFunction.XENT)
                        .weightInit(WeightInit.XAVIER)
                        .activation(Activation.SIGMOID)
                        .nIn(numHiddenNodes).nOut(numOutputs).build())
                .build();

        MultiLayerNetwork model = new MultiLayerNetwork(conf);
        model.init();

        System.out.println("compiled configuration");
        System.out.println("start to fit model");
        /*DataSet allData2;
        DataSetIterator iterator2 = new RecordReaderDataSetIterator(recordReader, 1700, FEATURES_COUNT, CLASSES_COUNT);
        */

        //for(int i = 0; i < 13; i++) {
        //iterator.reset();
       while (iterator.hasNext()) {
           //allData = iterator.next();
           //allData.shuffle();
           model.fit(trainingData.getFeatures(), trainingData.getLabels());
           allData = iterator.next();
       }
      //}
        //System.out.println("ended epoch number : " + i);
        //}
        System.out.println("fit ended start evaluating");

        INDArray output = model.output(testData.getFeatures());

        Evaluation eval = new Evaluation(CLASSES_COUNT);
        //Evaluation eval = new EvaluationBinary();
        eval.eval(testData.getLabels(), output);
        //testData.getLabels();
        //EvaluationBinary eval = new EvaluationBinary(testData.getLabels());

        System.out.println(eval.stats());

        //File locationToSave = new File("");
        model.save(new File("mynet.zip"));

        recordReader.close();

    }
}

```

---

<div class="post-metadata">

### Author: ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)
#### Post date: [June 18, 2020, 9:20am UTC](https://community.konduit.ai/t/warning-1-class-was-never-predicted-by-the-model-and-was-excluded-from-average-precision-classes-excluded-from-average-precision-1/624/2 "2020-06-18T09:20:20Z")

</div>

What you are seeing is just the effect of the network not training properly.

You will have to tune its hyper parameters to find something where your networks learns. You are trying to do quite a lot of different stuff in your code - and you are using huge minibatches, this isn’t always a good idea.

Take a look at [https://deeplearning4j.konduit.ai/tuning-and-training/troubleshooting-training#troubleshooting-neural-net-training](https://deeplearning4j.konduit.ai/tuning-and-training/troubleshooting-training#troubleshooting-neural-net-training) for more on tuning your network.

If you are just starting out with DL4J you might also want to take a look at this: [Quickstart with Deeplearning4J – dubs·tech](https://www.dubs.tech/guides/quickstart-with-dl4j/)

Also the examples have been reworked recently, so you might want to take another look at how things are done there: [deeplearning4j-examples/dl4j-examples at master · eclipse/deeplearning4j-examples · GitHub](https://github.com/eclipse/deeplearning4j-examples/tree/master/dl4j-examples#classification)
