weka.core.Instances.getRandomNumberGenerator()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中weka.core.Instances.getRandomNumberGenerator()方法的一些代码示例,展示了Instances.getRandomNumberGenerator()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instances.getRandomNumberGenerator()方法的具体详情如下:
包路径:weka.core.Instances
类名称:Instances
方法名:getRandomNumberGenerator

Instances.getRandomNumberGenerator介绍

[英]Returns a random number generator. The initial seed of the random number generator depends on the given seed and the hash code of a string representation of a instances chosen based on the given seed.
[中]返回一个随机数生成器。随机数生成器的初始种子取决于给定种子和基于给定种子选择的实例的字符串表示的哈希代码。

代码示例

代码示例来源:origin: com.googlecode.obvious/obviousx-weka

@Override
public Random getRandomNumberGenerator(long seed) {
 return super.getRandomNumberGenerator(seed);
}

代码示例来源:origin: nz.ac.waikato.cms.weka/predictiveApriori

/**
 * Constructor
 * 
 * @param instances the instances to be used for generating the associations
 * @param numRules the number of random rules used for generating the prior
 * @param numIntervals the number of intervals to discretise [0,1]
 * @param car flag indicating whether standard or class association rules are
 *          mined
 */
public PriorEstimation(Instances instances, int numRules, int numIntervals,
 boolean car) {
 m_instances = instances;
 m_CARs = car;
 m_numRandRules = numRules;
 m_numIntervals = numIntervals;
 m_randNum = m_instances.getRandomNumberGenerator(SEED);
}

代码示例来源:origin: Waikato/weka-trunk

/**
 * constructor
 * 
 * @param numClasses the number of classes
 * @param numCodes the number of codes
 * @param data the data to use
 */
public RandomCode(int numClasses, int numCodes, Instances data) {
 r = data.getRandomNumberGenerator(m_Seed);
 numCodes = Math.max(2, numCodes); // Need at least two classes
 m_Codebits = new boolean[numCodes][numClasses];
 int i = 0;
 do {
  randomize();
  //System.err.println(this);
 } while (!good() && (i++ < 100));
 //System.err.println("Code:\n" + this);
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * constructor
 * 
 * @param numClasses the number of classes
 * @param numCodes the number of codes
 * @param data the data to use
 */
public RandomCode(int numClasses, int numCodes, Instances data) {
 r = data.getRandomNumberGenerator(m_Seed);
 numCodes = Math.max(2, numCodes); // Need at least two classes
 m_Codebits = new boolean[numCodes][numClasses];
 int i = 0;
 do {
  randomize();
  //System.err.println(this);
 } while (!good() && (i++ < 100));
 //System.err.println("Code:\n" + this);
}

代码示例来源:origin: net.sf.meka/meka

if (getDebug()) System.err.print(" moving target attributes to the beginning ... ");
Random r = instances.getRandomNumberGenerator(0);
String name = "temp_"+MLUtils.getDatasetName(instances)+"_"+r.nextLong()+".arff";
System.err.println("Using temporary file: "+name);

代码示例来源:origin: sc.fiji/Trainable_Segmentation

new Splitter(new GiniFunction(numFeatures, data.getRandomNumberGenerator( random.nextInt() ) ));

代码示例来源:origin: nz.ac.waikato.cms.weka/meka

if (getDebug()) System.err.print(" moving target attributes to the beginning ... ");
Random r = instances.getRandomNumberGenerator(0);
String name = "temp_"+MLUtils.getDatasetName(instances)+"_"+r.nextLong()+".arff";
System.err.println("Using temporary file: "+name);

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

Random random = m_data.getRandomNumberGenerator(m_Seed);

代码示例来源:origin: Waikato/weka-trunk

Random random = m_data.getRandomNumberGenerator(m_Seed);

代码示例来源:origin: Waikato/weka-trunk

Random rand = inputFormat.getRandomNumberGenerator(getSeed());

代码示例来源:origin: Waikato/meka

/**
 * Build the classifier on the filtered data.
 *
 * @param data the training data
 * @throws Exception if the classifier could not be built successfully
 */
public void buildClassifier(Instances data) throws Exception {
 if (m_Classifier == null) {
  throw new Exception("No base classifier has been set!");
 }
 getCapabilities().testWithFail(data);
 Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
 data = setUp(data, r);
 if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {
  data = data.resampleWithWeights(r); // The filter may have assigned weights.
 }
 if (!data.allAttributeWeightsIdentical() && !(m_Classifier instanceof WeightedAttributesHandler)) {
  data = resampleAttributes(data, false, r);
 }
 if (m_Classifier instanceof Randomizable) {
  ((Randomizable)m_Classifier).setSeed(r.nextInt());
 }
 m_Classifier.buildClassifier(data);
}

代码示例来源:origin: net.sf.meka/meka

/**
 * Build the classifier on the filtered data.
 *
 * @param data the training data
 * @throws Exception if the classifier could not be built successfully
 */
public void buildClassifier(Instances data) throws Exception {
 if (m_Classifier == null) {
  throw new Exception("No base classifier has been set!");
 }
 getCapabilities().testWithFail(data);
 Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
 data = setUp(data, r);
 if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {
  data = data.resampleWithWeights(r); // The filter may have assigned weights.
 }
 if (!data.allAttributeWeightsIdentical() && !(m_Classifier instanceof WeightedAttributesHandler)) {
  data = resampleAttributes(data, false, r);
 }
 if (m_Classifier instanceof Randomizable) {
  ((Randomizable)m_Classifier).setSeed(r.nextInt());
 }
 m_Classifier.buildClassifier(data);
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
data = setUp(data, r);
if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {

代码示例来源:origin: Waikato/weka-trunk

Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
data = setUp(data, r);
if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Build the classifier on the filtered data.
 *
 * @param data the training data
 * @throws Exception if the classifier could not be built successfully
 */
public void buildClassifier(Instances data) throws Exception {
 if (m_Classifier == null) {
  throw new Exception("No base classifier has been set!");
 }
 getCapabilities().testWithFail(data);
 Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
 data = setUp(data, r);
 if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {
  data = data.resampleWithWeights(r); // The filter may have assigned weights.
 }
 if (!data.allAttributeWeightsIdentical() && !(m_Classifier instanceof WeightedAttributesHandler)) {
  data = resampleAttributes(data, false, r);
 }
 // can classifier handle the data?
 getClassifier().getCapabilities().testWithFail(data);
 if (m_Classifier instanceof Randomizable) {
  ((Randomizable)m_Classifier).setSeed(r.nextInt());
 }
 m_Classifier.buildClassifier(data);
}

代码示例来源:origin: Waikato/weka-trunk

/**
 * Build the classifier on the filtered data.
 *
 * @param data the training data
 * @throws Exception if the classifier could not be built successfully
 */
public void buildClassifier(Instances data) throws Exception {
 if (m_Classifier == null) {
  throw new Exception("No base classifier has been set!");
 }
 getCapabilities().testWithFail(data);
 Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
 data = setUp(data, r);
 if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {
  data = data.resampleWithWeights(r); // The filter may have assigned weights.
 }
 if (!data.allAttributeWeightsIdentical() && !(m_Classifier instanceof WeightedAttributesHandler)) {
  data = resampleAttributes(data, false, r);
 }
 // can classifier handle the data?
 getClassifier().getCapabilities().testWithFail(data);
 if (m_Classifier instanceof Randomizable) {
  ((Randomizable)m_Classifier).setSeed(r.nextInt());
 }
 m_Classifier.buildClassifier(data);
}

代码示例来源:origin: Waikato/weka-trunk

Random random = data.getRandomNumberGenerator(m_Seed);

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

Random random = data.getRandomNumberGenerator(m_Seed);

代码示例来源:origin: nz.ac.waikato.cms.weka/rotationForest

m_random = m_data.getRandomNumberGenerator(m_Seed);

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

Random rand = data.getRandomNumberGenerator(m_randomSeed);
if (m_NumFolds <= 0) {
 train = data;

相关文章

Instances类方法