# Multiple outputs - classification and regression

**URL:** https://community.konduit.ai/t/multiple-outputs-classification-and-regression/923
**Category:** DL4J
**Created:** [October 12, 2020, 2:22pm UTC](https://community.konduit.ai/t/multiple-outputs-classification-and-regression/923 "2020-10-12T14:22:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![lavajaw](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/lavajaw/32/118_2.png) [@lavajaw](https://community.konduit.ai/u/lavajaw)
#### Post date: [October 12, 2020, 2:22pm UTC](https://community.konduit.ai/t/multiple-outputs-classification-and-regression/923/1 "2020-10-12T14:22:30Z")

</div>

I have model with 2 outputs. One output is for classification problem - gender classification and other output is for age regression. I cant run RegressionEvaluation and Evaluation in same time.

EvaluativeListener(@NonNull MultiDataSetIterator iterator, int frequency, @NonNull InvocationType type,  
IEvaluation… evaluations)  
This listener receive array of IEvaluation, but if you add regression and classification evaluation it will break in runtime when it start evaluations…

ImageRecordReader imageRecordReaderAge = new ImageRecordReader(height, width, channels, labelMakerAge);  
imageRecordReaderAge.initialize(dataAge, getImageTransform(isTraining));  
ImageRecordReader imageRecordReaderGender = new ImageRecordReader(height, width, channels, labelMakerGender);  
imageRecordReaderGender.initialize(dataGender, getImageTransform(isTraining));

```
    MultiDataSetIterator iterator = new RecordReaderMultiDataSetIterator.Builder(batchSize)
            .addReader("inputAge", imageRecordReaderAge)
            .addReader("inputGender", imageRecordReaderGender)
            .addInput("inputAge", 0, 0)
            .addInput("inputGender", 0, 0)
            .addOutput("inputAge", 1, 1) 
            .addOutput("inputGender", 1, 1)  
    iterator.setPreProcessor(dataNormalization);

    RegressionEvaluation regressionEvaluation = new RegressionEvaluation();
    //Evaluation evaluation = new Evaluation(labels);
    return new EvaluativeListener(dataSetIterator, frequency, type, regressionEvaluation);

```

Also EarlyStoppingConfiguration receive only one scoreCalculator and it must be DataSetLossCalculator.

Is posible to monitor both evaluations in same time?

---

<div class="post-metadata">

### Author: ![lavajaw](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/lavajaw/32/118_2.png) [@lavajaw](https://community.konduit.ai/u/lavajaw)
#### Post date: [October 15, 2020, 1:36pm UTC](https://community.konduit.ai/t/multiple-outputs-classification-and-regression/923/2 "2020-10-15T13:36:34Z")

</div>

Any solution for this?

---

<div class="post-metadata">

### Author: ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)
#### Post date: [October 15, 2020, 10:24pm UTC](https://community.konduit.ai/t/multiple-outputs-classification-and-regression/923/3 "2020-10-15T22:24:28Z")

</div>

> [@lavajaw](#):
>
> so EarlyStoppingConfiguration receive only one scoreCalculator and it must be D

@lavajaw those evaluations were built with 1 output in mind. I would suggest setting up 2 separate objects and accumulate them for each one. Use a listener as a hook for setting up the pre processing.  
Those evaluate objects can be updated with the .eval(…) methods:

> <https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/regression/RegressionEvaluation.java#L231>

You will just have to do the tracking yourself.

---

<div class="post-metadata">

### Author: ![lavajaw](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/lavajaw/32/118_2.png) [@lavajaw](https://community.konduit.ai/u/lavajaw)
#### Post date: [October 15, 2020, 10:30pm UTC](https://community.konduit.ai/t/multiple-outputs-classification-and-regression/923/4 "2020-10-15T22:30:45Z")

</div>

@agibsonccc I will do, thanks.
