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


Python ClassificationDataSet.nClasses方法代码示例

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


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

示例1: range

# 需要导入模块: from pybrain.datasets import ClassificationDataSet [as 别名]
# 或者: from pybrain.datasets.ClassificationDataSet import nClasses [as 别名]
    return ret

vecSize =  100
subjects = [2, 5, 6, 7, 8, 12, 16, 35 ,39]
ds = None
for s in subjects:
    for cycleNum in range(1, 13):
        fileName = '../inputs/Vicon from CMU/subjects/'+str(s)+'/'+str(cycleNum)+'.amc'
        try:
            data = getData(fileName, vecSize)
        except IOError:
            continue
        if ds is None:#initialization
            ds = ClassificationDataSet( len(data), 1 )
        ds.appendLinked(data ,  subjects.index(s))
ds.nClasses = len(subjects)

decay= 0.99995
myWeightdecay = 0.8
initialLearningrate= 0.005
hidden_size = 1000
epochs=1000
splitProportion = 0.5

print 'dataset size', len(ds)
print 'input layer size', len(ds.getSample(0)[0])
tstdata, trndata = ds.splitWithProportion( splitProportion )
trndata._convertToOneOfMany( )
tstdata._convertToOneOfMany( )

print "Number of training patterns: ", len(trndata)
开发者ID:ranBernstein,项目名称:GaitKinect,代码行数:33,代码来源:NNwithRealData.py

示例2: ClassificationDataSet

# 需要导入模块: from pybrain.datasets import ClassificationDataSet [as 别名]
# 或者: from pybrain.datasets.ClassificationDataSet import nClasses [as 别名]
            try:
                data = ge.getFeatureVec(fileName)
            except IOError:
                continue
            if ds is None:#initialization
                ds = ClassificationDataSet( len(data), 1 )
            excpectedLens[m]+=1
            ds.appendLinked(data ,  moods.index(mood))
splitProportion = 0.2
decay= 0.99993
myWeightdecay = 0.5
initialLearningrate= 0.01
hidden_size = 200
epochs=1000
momentum=0.15
ds.nClasses = len(moods)
tstdata, trndata = ds.splitWithProportion( splitProportion )
trndata._convertToOneOfMany( )
tstdata._convertToOneOfMany( )
inLayer = LinearLayer(len(trndata.getSample(0)[0]))
hiddenLayer = SigmoidLayer(hidden_size)
outLayer = LinearLayer(len(trndata.getSample(0)[1]))
n = FeedForwardNetwork()
n.addInputModule(inLayer)
n.addModule(hiddenLayer)
b = BiasUnit()
n.addModule(b)
n.addOutputModule(outLayer)
in_to_hidden = FullConnection(inLayer, hiddenLayer)
hidden_to_out = FullConnection(hiddenLayer, outLayer)
b_to_hidden = FullConnection(b, hiddenLayer)
开发者ID:ranBernstein,项目名称:GaitKinect,代码行数:33,代码来源:classifyMoodAll.py

示例3: str

# 需要导入模块: from pybrain.datasets import ClassificationDataSet [as 别名]
# 或者: from pybrain.datasets.ClassificationDataSet import nClasses [as 别名]
             str(typeNum)+'_'+str(take)+'.skl'
             try:
                 data = ge.getFeatureVec(fileName)
             except IOError:
                 continue
             if ds is None:#initialization
                 ds = ClassificationDataSet( len(data), 1 )
             ds.appendLinked(data ,  couple.index(mood))
 splitProportion = 0.2
 decay= 0.9999
 myWeightdecay = 1#0.75
 initialLearningrate= 0.002
 hidden_size = 75
 epochs=1000
 momentum=0.25
 ds.nClasses = len(couple)
 tstdata, trndata = ds.splitWithProportion( splitProportion )
 trndata._convertToOneOfMany( )
 tstdata._convertToOneOfMany( )
 inLayer = LinearLayer(len(trndata.getSample(0)[0]))
 hiddenLayer = SigmoidLayer(hidden_size)
 outLayer = LinearLayer(len(trndata.getSample(0)[1]))
 n = FeedForwardNetwork()
 n.addInputModule(inLayer)
 n.addModule(hiddenLayer)
 b = BiasUnit()
 n.addModule(b)
 n.addOutputModule(outLayer)
 in_to_hidden = FullConnection(inLayer, hiddenLayer)
 hidden_to_out = FullConnection(hiddenLayer, outLayer)
 b_to_hidden = FullConnection(b, hiddenLayer)
开发者ID:ranBernstein,项目名称:GaitKinect,代码行数:33,代码来源:classifyMoodCouples.py


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