diff --git a/regressions.py b/linear_regression.py
similarity index 100%
rename from regressions.py
rename to linear_regression.py
diff --git a/regression2.py b/linear_regression2.py
similarity index 100%
rename from regression2.py
rename to linear_regression2.py
diff --git a/linear_regression3.py b/linear_regression3.py
new file mode 100644
index 0000000..35b7a4a
--- /dev/null
+++ b/linear_regression3.py
@@ -0,0 +1,41 @@
+import numpy as np
+import pandas as pd
+
+import utility
+
+df = utility.load_data()
+y_data = df.values[:, 0]
+x_data = df.values[:, 1:]
+m, n = x_data.shape
+
+
+import tensorflow as tf
+y = tf.Variable(y_data)
+x = tf.Variable(x_data)
+w = tf.Variable(tf.zeros((n, 1)))
+
+a = 0.1
+
+#h = tf.matmul(x, w)
+#cost = tf.reduce_mean(tf.square(h - y))
+#optimizer = tf.train.GradientDescentOptimizer(a)
+#train = optimizer.minimize(cost)
+
+a = tf.Variable([[1], [2], [3]])
+b = tf.Variable([1,2,3])
+
+with tf.Session() as sess:
+ sess.run(tf.global_variables_initializer())
+
+ #k = sess.run(a*b)
+ #kk = sess.run(b*a)
+ ##kkk = sess.run(tf.matmul(a, b))
+ #kkkk = sess.run(tf.matmul(b, a))
+
+ h = tf.matmul(x, w)
+ cost = tf.reduce_mean((h-y)**2)/2
+ gradient = (h-y)*x
+
+ values = sess.run((h, cost, gradient))
+
+ print(values)
diff --git a/regressions.pyproj b/regressions.pyproj
index f6df29d..fd53e5f 100644
--- a/regressions.pyproj
+++ b/regressions.pyproj
@@ -5,7 +5,7 @@
2.0
db253b3a-f559-48b8-9804-846029a6ebef
.
- regression2.py
+ linear_regression3.py
.
@@ -25,13 +25,19 @@
Code
-
+
Code
-
+
+ Code
+
+
Code
+
+ Code
+
10.0
diff --git a/utility.py b/utility.py
new file mode 100644
index 0000000..b9bd463
--- /dev/null
+++ b/utility.py
@@ -0,0 +1,17 @@
+import numpy as np
+import pandas as pd
+
+
+def load_data():
+ df = pd.read_csv('data/sample.txt', delimiter=',', header=None).astype(np.float32)
+
+ #df = pd.read_csv('data/ex1data1.txt', delimiter=',', header=None).astype(np.float32)
+
+ #df = pd.read_csv('data/train.csv', delimiter=',', comment='#').astype(np.float32)
+ #df[0] = df['x']
+ #df[1] = df['y']
+
+ df[2] = pd.Series([1]*len(df[0]))
+ df = df.reindex(columns=[1, 2, 0])
+
+ return df