当前位置: 首页>>代码示例>>Python>>正文


Python SupervisedDataSet.__init__方法代码示例

本文整理汇总了Python中pybrain.datasets.SupervisedDataSet.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python SupervisedDataSet.__init__方法的具体用法?Python SupervisedDataSet.__init__怎么用?Python SupervisedDataSet.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pybrain.datasets.SupervisedDataSet的用法示例。


在下文中一共展示了SupervisedDataSet.__init__方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from pybrain.datasets import SupervisedDataSet [as 别名]
# 或者: from pybrain.datasets.SupervisedDataSet import __init__ [as 别名]
    def __init__(self):
        SupervisedDataSet.__init__(self, 2, 1)

        with open('C:\Users\Brian\Desktop\Brian\Universitetet\Kandidat\Master Thesis\WeLoveGREEN-ENERGY\DATASET_FOR_GREEN_ENERGY_PLOTTING\WIND_TEMP_PRODUCTION_AVERAGE.csv', 'rb') as csvfile:
            dat = csv.reader(csvfile, delimiter=';')
            for row in dat:
              #  print 'sample 0: ' + row[0] + ' sample 1: ' + row[1]
                self.addSample([int(row[1]),int(row[2])],[int(row[0])])
开发者ID:kri5t,项目名称:GreenEnergy,代码行数:10,代码来源:BuildDataSet.py

示例2: __init__

# 需要导入模块: from pybrain.datasets import SupervisedDataSet [as 别名]
# 或者: from pybrain.datasets.SupervisedDataSet import __init__ [as 别名]
    def __init__(self, filename=None):
        SupervisedDataSet.__init__(self,0,0)

        self.nCls = 0
        self.nSamples = 0
        self.classHist = {}
        self.filename = ''
        if filename is not None:
            self.loadData(filename)
开发者ID:HKou,项目名称:pybrain,代码行数:11,代码来源:svmdata.py

示例3: _setDataFields

# 需要导入模块: from pybrain.datasets import SupervisedDataSet [as 别名]
# 或者: from pybrain.datasets.SupervisedDataSet import __init__ [as 别名]
    def _setDataFields( self, x, y ):
        if not len(x): raise Exception("no input data found")
        SupervisedDataSet.__init__( self, len(x[0]), 1 )
        self.setField( 'input'  , x )
        self.setField( 'target' , y )

        flat_labels = list( self.getField('target').flatten() )
        classes       = list(set( flat_labels ))
        self._classes = classes
        self.nClasses = len(classes)
        for class_ in classes:
            self.classHist[class_] = flat_labels.count(class_)
开发者ID:HKou,项目名称:pybrain,代码行数:14,代码来源:svmdata.py

示例4: __init__

# 需要导入模块: from pybrain.datasets import SupervisedDataSet [as 别名]
# 或者: from pybrain.datasets.SupervisedDataSet import __init__ [as 别名]
 def __init__(self, oneInN=False):
     if oneInN:
         SupervisedDataSet.__init__(self, 2, 2)
         self.addSample([0, 0], [0, 1])
         self.addSample([0, 1], [1, 0])
         self.addSample([1, 0], [1, 0])
         self.addSample([1, 1], [0, 1])
     else:
         SupervisedDataSet.__init__(self, 2, 1)
         self.addSample([0, 0], [0])
         self.addSample([0, 1], [1])
         self.addSample([1, 0], [1])
         self.addSample([1, 1], [0])
开发者ID:Andres-Hernandez,项目名称:py-optim,代码行数:15,代码来源:test_xor.py

示例5: __init__

# 需要导入模块: from pybrain.datasets import SupervisedDataSet [as 别名]
# 或者: from pybrain.datasets.SupervisedDataSet import __init__ [as 别名]
    def __init__(self,begin=0,end=40000):
        SupervisedDataSet.__init__(self, 5, 1)

        rid_url = fileio.read_file_to_dict(FEATURE_PATH+"url_id_feature.dat")
        rid_sent = fileio.read_file_to_dict(FEATURE_PATH+"rid_sentratio.dict")
        rid_general = fileio.read_file_to_dict(FEATURE_PATH+"rid_general.dict")
        rid_len = fileio.read_file_to_dict(FEATURE_PATH+"rid_lenratio.dict")
        rid_cate = fileio.read_file_to_dict(FEATURE_PATH+"rid_cateratio.dict",delimiter=None)
        
        fake = fileio.read_file_to_list("data/target/all_replicaId.dat")

        for rid in rid_url.keys()[begin:end]:
            inps = [rid_url[rid],rid_sent[rid],rid_general[rid],rid_len[rid],rid_cate[rid]]
            target = [1 if rid in fake else 0]
            self.addSample(inps,target)
开发者ID:Miyayx,项目名称:FakeReview-Detector,代码行数:17,代码来源:xor_data.py

示例6: __init__

# 需要导入模块: from pybrain.datasets import SupervisedDataSet [as 别名]
# 或者: from pybrain.datasets.SupervisedDataSet import __init__ [as 别名]
    def __init__(self, number_of_days_before, quotes):
        SupervisedDataSet.__init__(self, number_of_days_before, 1)

        gains = []
        for i, quote in enumerate(quotes):
            if i >= 1:
                gain = (quote - quotes[i-1])/quotes[i-1]
                gains.append(gain)

        for i, quote in enumerate(gains):
            if i >= number_of_days_before:
                first_day = i - number_of_days_before
                input = gains[first_day:i]
                output = [gains[i]]

                self.addSample(input, output)
开发者ID:pobed2,项目名称:NeuralNetworkStock,代码行数:18,代码来源:stock_dataset.py

示例7: __init__

# 需要导入模块: from pybrain.datasets import SupervisedDataSet [as 别名]
# 或者: from pybrain.datasets.SupervisedDataSet import __init__ [as 别名]
    def __init__(self, inp, target=1, nb_classes=0, class_labels=None):
        """Initialize an empty dataset.

        `inp` is used to specify the dimensionality of the input. While the
        number of targets is given by implicitly by the training samples, it can
        also be set explicity by `nb_classes`. To give the classes names, supply
        an iterable of strings as `class_labels`."""
        # FIXME: hard to keep nClasses synchronized if appendLinked() etc. is used.
        SupervisedDataSet.__init__(self, inp, target)
        self.addField('class', 1)
        self.nClasses = nb_classes
        if len(self) > 0:
            # calculate class histogram, if we already have data
            self.calculateStatistics()
        self.convertField('target', int)
        if class_labels is None:
            self.class_labels = list(set(self.getField('target').flatten()))
        else:
            self.class_labels = class_labels
        # copy classes (may be changed into other representation)
        self.setField('class', self.getField('target'))
开发者ID:fh-wedel,项目名称:pybrain,代码行数:23,代码来源:classification.py

示例8: __init__

# 需要导入模块: from pybrain.datasets import SupervisedDataSet [as 别名]
# 或者: from pybrain.datasets.SupervisedDataSet import __init__ [as 别名]
	def __init__(self, imgnames=None):
		SupervisedDataSet.__init__(self, 10*15, 1)
		'''
		if imgnames==None:
			imgnames = os.listdir('./dataset')
			map(lambda a: './dataset/'+a, imgnames)
		'''
		imgnames.sort()

		for iname in imgnames:
			img = Image.open(iname)
			w,h = img.size
			assert(w*h==150)
			pixels=[]
			for i in range(w):
				for j in range(h):
					p = img.getpixel((i,j))
					#All the 3 fields of p are equal, always.
					#Therefore we need only one to represent.
					pixels.append(float(p[0])/255)

			num = iname[rfind(iname,'/')+1:rfind(iname,'.')]
			assert(len(pixels)==150)
			self.addSample(pixels, [int(num)])
开发者ID:kirawrath,项目名称:RP,代码行数:26,代码来源:digits_dataset.py

示例9: __init__

# 需要导入模块: from pybrain.datasets import SupervisedDataSet [as 别名]
# 或者: from pybrain.datasets.SupervisedDataSet import __init__ [as 别名]
 def __init__(self):
     SupervisedDataSet.__init__(self, 2, 1)
     self.addSample([0,0],[0])
     self.addSample([0,1],[1])
     self.addSample([1,0],[1])
     self.addSample([1,1],[0])
开发者ID:Angeliqe,项目名称:pybrain,代码行数:8,代码来源:xor.py


注:本文中的pybrain.datasets.SupervisedDataSet.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。