Warning: 9 classes were never predicted by the model and were excluded from average precision

I’d like your help…
So here’s my problem: at the beginning I had a CSV file with 3 columns as :
date, averageNumberPersonSick person, cityName.

My goal is to estimate the number of sick people in city x compared to the data of all the surrounding cities.
So I transform the data to have an integer instead of the name of the city as a string.
So for example the city “Paris” becomes 9, “Bordeaux” 8 etc …
and I want to estimate for “Bordeaux” only for example …

and i converted it into :
averageNumberPersonSick , cityName
because the following error appeared:
java.lang.NumberFormatException: For input string: “2007-05-04”
But that doesn’t solve my problem … because the result doesn’t seem relevant to me and false :

How can I (re)start to have a basis for work?

That’s my model conf :

    MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
                .seed(12345)
                .optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT)
                .weightInit(WeightInit.XAVIER)
                .updater(new Nesterovs(0.005))
                .gradientNormalization(GradientNormalization.ClipElementWiseAbsoluteValue)
                .gradientNormalizationThreshold(0.5)
                .list()
                .setInputType(InputType.feedForward(numInputs)) // new input way

                .layer(0, new DenseLayer.Builder()
//                        .nIn(numInputs)
                        .nOut(outputNum)
                        .weightInit(WeightInit.XAVIER)
                        .activation(Activation.RELU)
                        .build())

                .layer(1, new OutputLayer.Builder(LossFunctions.LossFunction.NEGATIVELOGLIKELIHOOD)
                        .weightInit(WeightInit.XAVIER)
                        .activation(Activation.SOFTMAX)
//                        .nIn(numInputs) // revoir les couches hidden
                        .nOut(outputNum)
                        .build())

                .build();

and that’s when i train & evaluate the model :

MultiLayerNetwork model = new MultiLayerNetwork(conf);
        model.init();
        model.setListeners(new ScoreIterationListener(500));

        for(int i=0; i<300; i++ ) {
            model.fit(trainIter);
        }

        //evaluate the model on the test set
        System.out.println("Evaluation du model ... ");
        Evaluation eval = new Evaluation(10);
        while (testIter.hasNext()) {
            DataSet t = testIter.next();
            INDArray features = t.getFeatures();
            INDArray labels = t.getLabels();
            INDArray predicted = model.output(features, false);

            eval.eval(labels, predicted);
        }
        System.out.println(eval.stats());

Thank u

PS : I’m just starting to use DL4J

Let’s that this with explaining what you are seeing:

Warning: 9 classes were never predicted by the model and were excluded from average precision
This tells you that your model didn’t ever predict 9 classes out of your 10 classes. This can happen due to several reasons, but usually it is just because your model isn’t tuned properly or because you have data issues.

But this is just a symptom of another bigger problem here:

Given the data you are using, this isn’t going to work - ever. Assume a person that only knows the date of a measurement, the value of the measurement, and a place id. Do you think that person could ever work it out without knowing anything else about the world? That is the kind of problem you have designed here.

And then you have stated that your problem in this way: Given the number of infected people, what is the city?

I think you have to take a few steps back and learn a bit more about machine learning in general. You have to be able to state the problem in a way that the ML algorithm you’ve chosen can actually solve.

At the moment you are effectively offloading all the thinking on us and this will not help you learn.

Yes, I’m just starting my machine learning courses and I’m a beginner.

But our teacher doesn’t give us the choice of which library to use and since I’ve never used Python libraries, I don’t even have an intuition of what might or might not be good to do about the code.

Then considering the different problems I’ve seen in the literature, it’s often given as input a date, a value and a label.

But my problem is not to identify the city according to the number of victims.
It is defined as follows:
Can we get an idea of the average number of victims each day in the city of Bordeaux for the next month?

It’s with this exercise that I’m practicing for the moment and I have to start with one subject or another?.

Finally, I didn’t want to give the impression that I’m offloading the reflection. I want to learn again and I know it will take time.

Maybe you could help me in this? Otherwise I’ll look for more and come back for more specific problems.

Thanks again @treo

I don’t quite follow you, DL4J isn’t a python framework.

You can have problems like that, but you would approach them in a different way from what you’ve done.

If the data that you have is all that is available, then an RNN based solution may work.

But honestly, as you are a student, start with the simple things first, and don’t try jumping into the deep end that is neural networks. For the problem you are trying to solve, I’d suggest you start out with simple statistics, and use some simple regression just so you can get an idea of what you are doing and how to state the problem in a way that your chosen ml algorithm can solve.