# Combining different trained neural networks

I'm relatively new to this whole AI thing and have a question..

Let's say I have two different fully trained neural networks. The first one is trained for mathematical addition and the second one on mathematical multiplication and now I want to "merge these to a cluster" that knows about both operations.

Is there a representative name for this kind of technique? I had read somthing about bilinear cnn models that sounds similar to what I'm looking for, right?

• Given 2 numbers, say x and y, what would be the expected output of such a cluster ? – Astariul Dec 28 '18 at 5:40
• Thats not what I meant. Lets say we give "x+y" to the addition network it would probably give us a correct answer, whereas it doesn't know anything about "xy". And the same for the multiplication network which don't understand the expression "x+y". And now I want to merge them to a new one that understand both "x+y" and "xy". And I'm just looking for a representative name for this kind of technique. – 13loodH4t Dec 28 '18 at 10:22

Combining two different fully trained neural networks is not only feasible, it is commonly done. Let's look at the example given as two concepts involving integers, $$C_a$$ and $$C_m$$.

$$C_a: \mathcal{Y} = f_a (\mathcal{X}) = x_0 + x_1$$

$$C_m: \mathcal{Y} = f_m (\mathcal{X}) = x_0 \, x_1$$

Now let's define a palette of operations, including these two binary operations, that can be used to construct, a concept $$C_e$$, an expression comprised of an arbitrary hierarchy of addition, multiplication, constants, and substitution.

$$C_e: \mathcal{Y} = f_e (\mathcal{X}) \; \text{, where}$$

$$f_e \in \{f_a, f_b\} \; \land \; i \in \{0, 1\} \; \land \; ( \, x_i \in \mathbb{I} \; \lor \; x_i \in \mathcal{Y} \, ) \; \text{.}$$

Now, one artificial network can be trained to approximate f_a within a concept class $$\mathbb{C}$$ of which $$C_a$$ and $$C_m$$ are members, using labeled examples of correct integer additions and another artificial network can be trained to approximate f_b within that same concept class, using labeled examples of correct integer multiplications.

An expression involving both can be trained to approximate arbitrary product of sums or sum of products under specific conditions. Whether that is what is meant by, "Merge these to a cluster," is unclear because the requirements of what is meant by, "know[ing] about both operations," is also unclear.

Normally, one wouldn't train a network to perform operations that are already known. Training is normally used to model operations that are not known.

(Bilinear Convolutional Neural Networks (B-CNNs), introduced in Bilinear CNNs for Fine-grained Visual Recognition, 2017, Tsung-Yu Lin, Aruni RoyChowdhury, Subhransu Maji, is an approach to using two CNNs in conjunction to provide two fine and course visual recognition in the same way the human visual system can have a dual awareness of detail and panorama. B-CNNs probably don't apply to the scenario given in the question.)