Permalink
Browse files

Added generateDataSet to generate data from an input file

  • Loading branch information...
1 parent 6fdaab8 commit 41a6850b7197731449e36ecbf60b941229d3e3fb @swvist committed Nov 13, 2011
Showing with 8 additions and 1 deletion.
  1. +8 −1 ocrn/dataset.py
View
@@ -1,6 +1,7 @@
from pybrain.datasets import SupervisedDataSet
import numpy as np
-import feature as fr
+import feature as ft
+import fileinput
class dataset:
# Initialize the dataset with input and label size
@@ -21,3 +22,9 @@ def addTrainingData(self,inputdata, labeldata):
def getTrainingDataset(self):
return self.DS
+
+ def generateDataSet(self):
+ for line in fileinput.input(['data/inputdata']):
+ x = line.split(':')
+ self.addTrainingData(ft.feature.getImageFeatureVector(x[0]),np.array([int(x[1])]))
+ return 1

0 comments on commit 41a6850

Please sign in to comment.