Tensorflow - logistic regression -oneHot Encoder - Transformed array of different size for both train and test x_train = tr1.loc[:, ['Sepal Length', 'Sepal Width', 'Petal Length', 'Petal Width']]
#x_train.shape - (120 x 4)

y_train = tr1.loc[:, ['Species']]
#shape - 120 x 3

x_test = test1.loc[:, ['Sepal Length', 'Sepal Width', 'Petal Length', 'Petal Width']]
#shape 30 x 4
y_test = test1.loc[:, ['Species']]
# shape 30 x 3

oneHot = OneHotEncoder()
oneHot.fit(x_train)
# transform
x_train = oneHot.transform(x_train).toarray()
 # fit our y to oneHot encoder
 oneHot.fit(y_train)
 # transform
 y_train = oneHot.transform(y_train).toarray()

 oneHot.fit(x_test)
 # transform
 x_test = oneHot.transform(x_test).toarray()
 # fit our y to oneHot encoder
  oneHot.fit(y_test)
   # transform
  y_test = oneHot.transform(y_test).toarray()

   print("Our features X_test1 in one-hot format")
    print(x_test)


Shape of x_train:  (120, 15)
Shape of y_train:  (120, 3)
Shape of x_test:  (30, 14)
Shape of y_test:  (30, 3)

a) After conversion why is the size x_test = 30 x 14  I assume it has to be  30 x 15 ? 

# hyperparameters
learning_rate = 0.0001
num_epochs = 100
display_step = 1

# for visualize purpose in tensorboard we use tf.name_scope
with tf.name_scope("Declaring_placeholder"):
# X is placeholdre for iris features. We will feed data later on
x = tf.placeholder(tf.float32, shape=[None, 15])
# y is placeholder for iris labels. We will feed data later on
y = tf.placeholder(tf.float32, shape=[None, 3])


with tf.name_scope("Declaring_variables"):
    # W is our weights. This will update during training time
    W = tf.Variable(tf.zeros([15, 3]))
    # b is our bias. This will also update during training time
    b = tf.Variable(tf.zeros([3]))

with tf.name_scope("Declaring_functions"):
# our prediction function
y_ = tf.nn.softmax(tf.add(tf.matmul(x, W), b))


b) did I define x, y, W, b correctly because when I run the accuracy I get this error "ValueError: Cannot feed value of shape (30, 14) for Tensor 'Declaring_placeholder_10/Placeholder:0', which has shape '(?, 15)'
"
Your shape is (30, 14) and not (30, 15) because there are only 14 unique values in your test (one is missing). In any case you shouldn't fit the encoder on the test set, just on the training set. Then just transform on the test set and you'll get the correct dimensions.

Also as far as I can see W and b are declared correctly. I'd ask however you take a minute to format your question a bit better next time.