Now we can try a more complex example implementing a logistic regression algorithm. The first step, as usual, is to create a dummy dataset:
from sklearn.datasets import make_classificationnb_samples = 500X, Y = make_classification(n_samples=nb_samples, n_features=2, n_redundant=0, n_classes=2)
The dataset is shown in the following graph:
At this point, we can create the graph and all placeholders, variables, and operations:
import tensorflow as tfgraph = tf.Graph()with graph.as_default(): Xt = tf.placeholder(tf.float32, shape=(None, 2), name='points') Yt = tf.placeholder(tf.float32, ...