Skip to content

Commit

Permalink
added demo file
Browse files Browse the repository at this point in the history
some output changes

Signed-off-by: Carsten Witzke <carsten@staticline.de>
  • Loading branch information
whiskey committed May 9, 2011
1 parent 1ebcbfc commit 2c9468f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 11 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@
.settings
.checkstyle*
data.db
Playground.*
10 changes: 1 addition & 9 deletions src/de/staticline/regression/SimpleRegression.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
'''

from numpy import *
from math import sqrt
from numpy.linalg.linalg import inv

class RidgeRegression(object):
Expand All @@ -32,13 +31,7 @@ def trainModel(self, train):
f2 = y - dot(x,self.get_model())
f3 = dot(dot(self.__complexity,self.__model.transpose()),self.__model)
rss = dot(f1,f2) + f3
print 'RSS ?= %f' % rss

#RSS old school
#diff = train.get_matrix() - self.__model
#print diff
#print diff**2

print 'RSS = %f' % rss #TODO: validate RSS

def validate_model(self, test):#FIXME: make new
testdata = matrix(test.get_matrix())
Expand All @@ -60,6 +53,5 @@ def set_lambda(self, value):
def get_model(self):
return self.__model


complexity = property(get_lambda, set_lambda, doc='the model complexity factor lambda')
model = property(get_model, doc='the learned model')
1 change: 0 additions & 1 deletion src/de/staticline/tests/RegressionTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

class Test(unittest.TestCase):


def testRidgeRegression(self):
_x = matrix('1 1 2; 1 2 3; 1 4 1; 1 5 5')
_y = matrix('3;2;7;1')
Expand Down

0 comments on commit 2c9468f

Please sign in to comment.