I am begginer in using tensorflow and am using for a school project. Here I am attempting to make a house identifier, where I made some data on an excel sheet, turned it into a csv file and I was testing if the data would be read. The data was read but it produces multiple errors when I do the matrix multiplication and says.... "ValueError: Shape must be rank 2 but is rank 0 for 'MatMul' (op: 'MatMul') with input shapes: [], [1,1]." Thank you so much!
import tensorflow as tf
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
filename = dir_path+ "\House Price Data .csv"
w1=tf.Variable(tf.zeros([1,1]))
w2=tf.Variable(tf.zeros([1,1])) #Feature 1's weight
w3=tf.Variable(tf.zeros([1,1])) #Feature 1's weight
b=tf.Variable(tf.zeros([1])) #bias for various features
x1= tf.placeholder(tf.float32,[None, 1])
x2= tf.placeholder(tf.float32,[None, 1])
x3= tf.placeholder(tf.float32,[None, 1])
Y= tf.placeholder(tf.float32,[None, 1])
y_=tf.placeholder(tf.float32,[None,1])
with tf.Session() as sess:
sess.run( tf.global_variables_initializer())
with open(filename) as inf:
# Skip header
next(inf)
for line in inf:
# Read data, using python, into our features
housenumber, x1, x2, x3, y_ = line.strip().split(",")
x1 = float(x1)
product = tf.matmul(x1, w1)
y = product + b