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


Python Util.sampleWithoutReplacement方法代码示例

本文整理汇总了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]
开发者ID:charanpald,项目名称:wallhack,代码行数:32,代码来源:WriteTransmissions.py


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