To solve this problem in a more general way, first look at what are the variables and what are the fixed parameters.
Basically you are given the input weights vector w = [1.5, -1, 1, 2]
and the transfer function g(x) = (sign(x)+1)/2
, and you want to find the input vector in so that: g(
w *
in') = +1
(as product of a row and a column vector), therefore:
g( sum_over_i( w_i*in_i ) ) = 1 # product of vectors
g( w0*in0 + w1*in1 + w2*in2 + w3*in3 ) = 1 # roll out the sum
g( -1.5 - in1 + in2 + 2*in3 ) = 1 # replace the values of w and in
0.5*(sign(-1.5 - in1 + in2 + 2*in3)+1) = 1 # definition of g(x)
sign(-1.5 - in1 + in2 + 2*in3) = 1 # simplify
-1.5 - in1 + in2 + 2*in3 >= 0 # by def: [sign(x)=1 iff x>=0]
Normally you would solve this equation by computing derivatives, but since the inputs in can only take the values 0
or 1
, we can simply enumerate all cases (there are 2^n
or 8
cases):
in1 in2 in3 -1.5-in1+in2+2*in3
-----------------------------------
0 0 0 -1.5
0 0 1 0.5 *
0 1 0 -0.5
0 1 1 1.5 *
1 0 0 -2.5
1 0 1 -0.5
1 1 0 -1.5
1 1 1 0.5 *
Hence we get get the values of in for which the above expression is positive.