本文整理汇总了Python中sandbox.util.Util.Util.sampleWithoutReplacement方法的典型用法代码示例。如果您正苦于以下问题:Python Util.sampleWithoutReplacement方法的具体用法?Python Util.sampleWithoutReplacement怎么用?Python Util.sampleWithoutReplacement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sandbox.util.Util.Util
的用法示例。
在下文中一共展示了Util.sampleWithoutReplacement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: str
# 需要导入模块: from sandbox.util.Util import Util [as 别名]
# 或者: from sandbox.util.Util.Util import sampleWithoutReplacement [as 别名]
#Find all of the decays in information transmission
egoTestFileName = dataDir + "EgoInfoTest.csv"
alterTestFileName = dataDir + "AltersInfoTest.csv"
decayGraph = eCsvReader.findInfoDecayGraph(egoTestFileName, alterTestFileName, egoIndicesR, alterIndices, egoIndicesNR, alterIndicesNR, egoFileName, alterFileName, missing)
logging.info("Size of decay graph: " + str(decayGraph.getNumVertices()))
logging.info("Number of edges: " + str(decayGraph.getNumEdges()))
#Now write the decays to a simplegraph file
decayFileName = dataDir + "EgoAlterDecays.dat"
decayGraph.save(decayFileName)
logging.info("Wrote decays to file " + decayFileName)
#Now write out transmissions
sampleSize = 1000
indices = Util.sampleWithoutReplacement(sampleSize, examplesList.getNumExamples())
examplesListSample = examplesList.getSubExamplesList(indices)
outputFileName1 = dataDir + "EgoAlterTransmissions"
outputFileName2 = dataDir + "EgoAlterTransmissions1000"
examplesList.writeToMatFile(outputFileName1)
examplesListSample.writeToMatFile(outputFileName2)
#Let's also write out the csv file for analysis
X = examplesList.getDataField(examplesList.getDefaultExamplesName())
y = examplesList.getDataField(examplesList.getLabelsName())
X = numpy.c_[X, y]