0
0
TensorFlowml~12 mins

Multi-input and multi-output models in TensorFlow - Model Pipeline Trace

Choose your learning style9 modes available
Model Pipeline - Multi-input and multi-output models

This pipeline shows how a model can learn from two different inputs at the same time and give two different outputs. It’s like using two senses to understand something and then giving two answers based on that understanding.

Data Flow - 5 Stages
1Raw Data
1000 rows x 2 inputsTwo separate input features collected: Input A (10 features), Input B (5 features)1000 rows x 2 inputs (10 features and 5 features)
Input A: [0.5, 1.2, ..., 0.3], Input B: [3, 0, 1, 2, 1]
2Preprocessing
1000 rows x 2 inputsNormalize Input A and one-hot encode Input B1000 rows x 2 inputs (10 normalized features and 5 one-hot features)
Input A normalized: [0.05, 0.12, ..., 0.03], Input B one-hot: [0,1,0,0,0]
3Feature Engineering
1000 rows x 2 inputsSeparate dense layers for each input to extract features1000 rows x 2 feature vectors (each 8 features)
Feature vector A: [0.1, 0.2, ..., 0.05], Feature vector B: [0.3, 0.1, ..., 0.2]
4Concatenate Features
1000 rows x 2 feature vectorsCombine feature vectors into one vector1000 rows x 16 features
[0.1, 0.2, ..., 0.05, 0.3, 0.1, ..., 0.2]
5Model Trains
1000 rows x 16 featuresTrain model with two outputs: Output 1 (regression), Output 2 (classification)Two outputs: Output 1 shape (1000 rows x 1), Output 2 shape (1000 rows x 3 classes)
Output 1: [2.5, 3.1, ..., 1.2], Output 2: [[0.1, 0.7, 0.2], [0.8, 0.1, 0.1], ...]
Training Trace - Epoch by Epoch

Loss
1.2 |*       
1.0 | *      
0.8 |  *     
0.6 |   *    
0.4 |    *   
0.2 |     *  
0.0 +--------
      1 3 5 7 10 Epochs
EpochLoss ↓Accuracy ↑Observation
11.20.45Loss starts high; accuracy low as model begins learning
30.80.60Loss decreases; accuracy improves as model learns patterns
50.50.75Loss continues to drop; accuracy rises steadily
70.350.82Model converging; loss low and accuracy high
100.250.88Training stabilizes with good accuracy and low loss
Prediction Trace - 4 Layers
Layer 1: Input Layer
Layer 2: Separate Dense Layers
Layer 3: Concatenate Features
Layer 4: Output Layers
Model Quiz - 3 Questions
Test your understanding
Why does the model have two separate inputs?
ATo reduce the number of features
BTo learn from different types of data separately
CTo make training faster
DTo avoid using activation functions
Key Insight
Multi-input and multi-output models allow learning from different data sources simultaneously and produce multiple predictions. This helps solve complex problems where one input or output is not enough.