summaryrefslogtreecommitdiff
path: root/lin_reg_example.py
diff options
context:
space:
mode:
Diffstat (limited to 'lin_reg_example.py')
-rw-r--r--lin_reg_example.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lin_reg_example.py b/lin_reg_example.py
index 3a2043e..47f1a84 100644
--- a/lin_reg_example.py
+++ b/lin_reg_example.py
@@ -1,12 +1,11 @@
-#!/usr/bin/python
-#/usr/local/bin/python2.7
+#!/usr/bin/env python
import numpy as np
def main():
- dataz = np.genfromtxt('example.csv', delimiter=',', names=True)
+ dataz = np.genfromtxt('data/example.csv', delimiter=',', names=True)
y = dataz['attitude']
x = dataz['correct']
@@ -31,6 +30,7 @@ def main():
print 'Sy = {}'.format(Sy)
print 'r = {}'.format(r)
print 'r^2 = {}'.format(r**2)
+ print 'r^2 dB = {}'.format(10.0*np.log10(r**2))
b = r*(Sy/Sx)
a = np.mean(y) - b*np.mean(x)