Permalink
Browse files

Class to store dataset. Added function to append data to pybrain dataset

  • Loading branch information...
1 parent f8e7ac1 commit 4fab3cd8ac2aaa025d0921f530c090db5c390c25 @swvist committed Nov 12, 2011
Showing with 18 additions and 0 deletions.
  1. +18 −0 ocrn/dataset.py
View
@@ -0,0 +1,18 @@
+from pybrain.datasets import SupervisedDataSet
+import numpy as np
+import feature as fr
+
+class dataset:
+ def __init__(self, inputsize, labelsize):
+ self.inputsize = inputsize
+ self.labelsize = labelsize
+ self.DS = SupervisedDataSet(self.inputsize, self.labelsize)
+
+ def addData(self,inputdata, labeldata):
+ try:
+ if inputdata.size == self.inputsize and labeldata.size == self.labelsize:
+ self.DS.appendLinked(inputdata, labeldata)
+ return 1
+ except AttributeError:
+ print "Input error."
+ return 0

0 comments on commit 4fab3cd

Please sign in to comment.