本文整理汇总了Python中Data.loadData方法的典型用法代码示例。如果您正苦于以下问题:Python Data.loadData方法的具体用法?Python Data.loadData怎么用?Python Data.loadData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.loadData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write_eVectors_to_file
# 需要导入模块: import Data [as 别名]
# 或者: from Data import loadData [as 别名]
#debug
#break
self.write_eVectors_to_file(self.eVectors, "1et_")
self.write_eVectors_to_file( self.eVectors_c, "1ec_")
return
def write_eVectors_to_file(self, eVectors, filePath):
f = np.savetxt(filePath+"eVectors.txt", eVectors)
def load_eVectors_from_file(self, filePath=""):
return np.loadtxt(filePath+"eVectors.txt")
if __name__ == "__main__":
dim = 500
batch_size = 100
neg_sample_size = 5
gradient_step = 0.1
data = Data()
data.loadData("")
learn = Learn(data, dim, batch_size, neg_sample_size, gradient_step)
#print(learn.cVectors)
#print(learn.cVectors.shape)
#print(np.linalg.norm(learn.cVectors[1]))
learn.solve()
示例2: loadDataSet
# 需要导入模块: import Data [as 别名]
# 或者: from Data import loadData [as 别名]
import Data
from pybrain.datasets import ClassificationDataSet
from pybrain.tools.shortcuts import buildNetwork
from pybrain.supervised.trainers import BackpropTrainer
from pybrain.structure.modules import SoftmaxLayer
from pybrain.utilities import percentError
def loadDataSet(x,y):
dataset = ClassificationDataSet(x.shape[1], y.shape[1], nb_classes=10)
dataset.setField('input', x)
dataset.setField('target', y)
return dataset
X,Y = Data.loadData("TrainBig.csv")
train = loadDataSet(X,Y)
train._convertToOneOfMany() #One vs All
#train
print "Training"
neuralnet = buildNetwork( train.indim, 20, train.outdim, outclass=SoftmaxLayer )
trainer = BackpropTrainer(neuralnet, dataset=train, momentum=0.1, verbose=True, weightdecay=0.01)
#trainer.trainUntilConvergence()
trainer.trainEpochs( 20 )
#test
print "Testing"
X,Y = Data.loadData("Test.csv")
test = loadDataSet(X,Y)
test._convertToOneOfMany() #One vs All