Categories
Misc

How to write binary classification with Tensorflow 1.x?

I’m at my wits end, every single tutorial for classification I find for Tensorflow 1.x is a goddamn MNIST tutorial, they always skip the basics, and I need the basics.

I have a test set with 6 numerical features and a label that is binary 1 or 0.

With Tensorflow 2.0 I can easily just use something like this

model = tf.keras.Sequential([ tf.keras.layers.Dense(21, activation="tanh"), tf.keras.layers.Dense(10, activation="sigmoid"), tf.keras.layers.Dense(1, activation="sigmoid") ]) model.compile( loss=tf.keras.losses.binary_crossentropy, optimizer=tf.keras.optimizers.Adam(0.001), metrics=['accuracy'] ) history = model.fit(X_train, y_train, epochs=25) 

For the life of me I don’t know how to go about doing this in Tensorflow 1.x.

submitted by /u/Practicing1s
[visit reddit] [comments]

Leave a Reply

Your email address will not be published.