Producing a custom activation function

40 Views Asked by At

I have two matrices of equal dimensions with values [0,1]. Basically two gray scale images which are predictions from a neural network. One matrix is the prediction output of a particular object given image $X$ and the second matrix is the prediction output of a different object (produced by a different network) given the same image $X$.

Now, each of the matrices has false positives that are actually true positives on the other matrix. For instance, matrix A, for location $(a,b)$ might give me a probability of $0.7$ that it is of class A and this might be a false positive. And in matrix B for that same location, the value might be probability of 0.4 for it being class B. Now, if that pixel was actually meant to be class B, just doing the $max(A,B)$ won't work.

So, I'd like to create some sort of activation function that will take these two matrices and produce another probability matrix as an output that combines the results. How do I go about does this? I'm not sure where to start.

1

There are 1 best solutions below

3
On BEST ANSWER

Each model needs to output not only their prediction, but for each class what their prediction is (of course summing to $1$).

Then, given two such models you can first average their predictions for each class and then choose the max.

E.g. model P produces probabilities:

A    B
0.7  0.3

and model Q produces probabilities:

A    B
0.1  0.9

Then their combined prediction is:

A    B
0.4  0.6

And B would be chosen.