Package weka.core

# Class ResampleUtils

java.lang.Object
weka.core.ResampleUtils

public class ResampleUtils extends Object
Helper class for resampling.

Version:
  $Revision: 12226 $
Author:
  FracPete (fracpete at waikato dot ac dot nz)

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ResampleUtils()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `hasInstanceWeights(Instances insts)`
  Checks whether there are any instance weights other than 1.0 set.
  `static Instances`
  `resampleWithWeightIfNecessary(Instances insts, Random rand)`
  Resamples the dataset using `Instances.resampleWithWeights(Random)` if there are any instance weights other than 1.0 set.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ResampleUtils

    public ResampleUtils()

- ## Method Details

  - ### hasInstanceWeights

    public static boolean hasInstanceWeights(Instances insts)
    Checks whether there are any instance weights other than 1.0 set.
    Parameters:
      `insts` - the dataset to check
    Returns:
      true if instance weights other than 1.0 are set

  - ### resampleWithWeightIfNecessary

    public static Instances resampleWithWeightIfNecessary(Instances insts, Random rand)
    Resamples the dataset using `Instances.resampleWithWeights(Random)` if there are any instance weights other than 1.0 set. Simply returns the dataset if no instance weights other than 1.0 are set.
    Parameters:
      `insts` - the dataset to resample
      `rand` - the random number generator to use
    Returns:
      the (potentially) resampled dataset