i’m find solution

from keras import backend as K

def binaryActivationFromTanh(x, threshold) :

    # convert [-inf,+inf] to [-1, 1]
    # you can skip this step if your threshold is actually within [-inf, +inf]

    activated_x = K.tanh(x)

    binary_activated_x = activated_x > threshold

    # cast the boolean array to float or int as necessary
    # you shall also cast it to Keras default
    # binary_activated_x = K.cast_to_floatx(binary_activated_x)

    return binary_activated_x

x = Input(shape=(1000,))
y = Dense(3, activation=binaryActivationFromTanh)(x)

for my example i’m have
y = [
[5,9,3],
[6,11,7],
[5,2,6]
…
]
how create

def binaryActivationFromTanh(x, threshold) :
binary_activated_x = ???
a0 =  [6,5]
a1 = [9,11,2]
a2 = [3,7,6]
binary_activated_x [0][0] =>  some_func(a0)
binary_activated_x [0][1]  =>  some_func(a1)
binary_activated_x [0][2]  => some_func(a2)
return binary_activated_x

in my example
act =‘relu’
model = Sequential()

model.add(BatchNormalization())
model.add(Dense(34*2, activation=act, input_dim=34))


model.add(Dropout(0.2))
model.add(Dense(34*100, activation=act))   #160 000 


model.add(Dropout(0.2))
model.add(Dense(51, activation=btcActAbg))     # ERROR NOW
model.compile( optimizer='adam',loss='mse',metrics=['acc'])


изображение1016×521 42.4 KB