Codota Logo
Resample
Code IndexAdd Codota to your IDE (free)

How to use
Resample
in
weka.filters.unsupervised.instance

Best Java code snippets using weka.filters.unsupervised.instance.Resample (Showing top 20 results out of 315)

  • Common ways to obtain Resample
private void myMethod () {
Resample r =
  • Codota Iconnew Resample()
  • Smart code suggestions by Codota
}
origin: nz.ac.waikato.cms.weka/weka-stable

/** Creates a default Resample */
public Filter getFilter() {
 Resample f = new Resample();
 f.setSampleSizePercent(50);
 return f;
}
origin: nz.ac.waikato.cms.weka/weka-stable

 setRandomSeed(Integer.parseInt(tmpStr));
} else {
 setRandomSeed(1);
 setSampleSizePercent(Double.parseDouble(tmpStr));
} else {
 setSampleSizePercent(100);
setNoReplacement(Utils.getFlag("no-replacement", options));
if (getNoReplacement()) {
 setInvertSelection(Utils.getFlag('V', options));
if (getInputFormat() != null) {
 setInputFormat(getInputFormat());
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Input an instance for filtering. Filter requires all training instances be
 * read before producing output.
 * 
 * @param instance the input instance
 * @return true if the filtered instance may now be collected with output().
 * @throws IllegalStateException if no input structure has been defined
 */
@Override
public boolean input(Instance instance) {
 if (getInputFormat() == null) {
  throw new IllegalStateException("No input instance format defined");
 }
 if (m_NewBatch) {
  resetQueue();
  m_NewBatch = false;
 }
 if (isFirstBatchDone()) {
  push(instance);
  return true;
 } else {
  bufferInput(instance);
  return false;
 }
}
origin: nz.ac.waikato.cms.weka/weka-stable

 /**
  * Main method for testing this class.
  * 
  * @param argv should contain arguments to the filter: use -h for help
  */
 public static void main(String[] argv) {
  runFilter(new Resample(), argv);
 }
}
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Signify that this batch of input to the filter is finished. If the filter
 * requires all instances prior to filtering, output() may now be called to
 * retrieve the filtered instances.
 * 
 * @return true if there are instances pending output
 * @throws IllegalStateException if no input structure has been defined
 */
@Override
public boolean batchFinished() {
 if (getInputFormat() == null) {
  throw new IllegalStateException("No input instance format defined");
 }
 if (!isFirstBatchDone()) {
  // Do the subsample, and clear the input instances.
  createSubsample();
 }
 flushInput();
 m_NewBatch = true;
 m_FirstBatchDone = true;
 return (numPendingOutput() != 0);
}
origin: com.github.fracpete/multisearch-weka-package

} else {
 log("Generating sample (" + getSampleSizePercent() + "%)");
 resample = new Resample();
 resample.setRandomSeed(retrieveOwner().getSeed());
 resample.setSampleSizePercent(getSampleSizePercent());
 resample.setInputFormat(inst);
 sample = Filter.useFilter(inst, resample);
origin: nz.ac.waikato.cms.weka/weka-stable

public void testSampleSizePercentNoReplacementInverted() {
 ((Resample) m_Filter).setSampleSizePercent(20);
 ((Resample) m_Filter).setNoReplacement(true);
 ((Resample) m_Filter).setInvertSelection(true);
 Instances result = useFilter();
 assertEquals(m_Instances.numAttributes(), result.numAttributes());
 assertEquals("Expecting output to be 80% of input (20% inverted)",
        m_Instances.numInstances() 
        - (int) (m_Instances.numInstances() * 20.0 / 100),  result.numInstances());
}
origin: nz.ac.waikato.cms.weka/weka-stable

public void testSampleSizePercentNoReplacement() {
 ((Resample) m_Filter).setSampleSizePercent(20);
 ((Resample) m_Filter).setNoReplacement(true);
 Instances result = useFilter();
 assertEquals(m_Instances.numAttributes(), result.numAttributes());
 assertEquals("Expecting output to be 20% of input",
        (int) (m_Instances.numInstances() * 20.0 / 100),  result.numInstances());
}
origin: nz.ac.waikato.cms.weka/weka-stable

public void testSampleSizePercent() {
 Instances result = useFilter();
 assertEquals(m_Instances.numAttributes(), result.numAttributes());
 assertEquals("Expecting output to be 50% of input",
        m_Instances.numInstances() / 2,  result.numInstances());
 ((Resample)m_Filter).setSampleSizePercent(200);
 result = useFilter();
 assertEquals(m_Instances.numAttributes(), result.numAttributes());
 assertEquals("Expecting output to be 200% of input",
        m_Instances.numInstances() * 2,  result.numInstances());
}
origin: nz.ac.waikato.cms.weka/weka-stable

@ProgrammaticProperty
public void setSeed(int seed) {
 setRandomSeed(seed);
}
origin: net.sf.meka/meka

resample = new Resample();
resample.setRandomSeed(retrieveOwner().getSeed());
resample.setSampleSizePercent(getSampleSizePercent());
resample.setInputFormat(inst);
sample = Filter.useFilter(inst, resample);
origin: Waikato/weka-trunk

public void testSampleSizePercentNoReplacementInverted() {
 ((Resample) m_Filter).setSampleSizePercent(20);
 ((Resample) m_Filter).setNoReplacement(true);
 ((Resample) m_Filter).setInvertSelection(true);
 Instances result = useFilter();
 assertEquals(m_Instances.numAttributes(), result.numAttributes());
 assertEquals("Expecting output to be 80% of input (20% inverted)",
        m_Instances.numInstances() 
        - (int) (m_Instances.numInstances() * 20.0 / 100),  result.numInstances());
}
origin: Waikato/weka-trunk

public void testSampleSizePercentNoReplacement() {
 ((Resample) m_Filter).setSampleSizePercent(20);
 ((Resample) m_Filter).setNoReplacement(true);
 Instances result = useFilter();
 assertEquals(m_Instances.numAttributes(), result.numAttributes());
 assertEquals("Expecting output to be 20% of input",
        (int) (m_Instances.numInstances() * 20.0 / 100),  result.numInstances());
}
origin: Waikato/weka-trunk

/**
 * Signify that this batch of input to the filter is finished. If the filter
 * requires all instances prior to filtering, output() may now be called to
 * retrieve the filtered instances.
 * 
 * @return true if there are instances pending output
 * @throws IllegalStateException if no input structure has been defined
 */
@Override
public boolean batchFinished() {
 if (getInputFormat() == null) {
  throw new IllegalStateException("No input instance format defined");
 }
 if (!isFirstBatchDone()) {
  // Do the subsample, and clear the input instances.
  createSubsample();
 }
 flushInput();
 m_NewBatch = true;
 m_FirstBatchDone = true;
 return (numPendingOutput() != 0);
}
origin: Waikato/weka-trunk

 /**
  * Main method for testing this class.
  * 
  * @param argv should contain arguments to the filter: use -h for help
  */
 public static void main(String[] argv) {
  runFilter(new Resample(), argv);
 }
}
origin: Waikato/weka-trunk

public void testSampleSizePercent() {
 Instances result = useFilter();
 assertEquals(m_Instances.numAttributes(), result.numAttributes());
 assertEquals("Expecting output to be 50% of input",
        m_Instances.numInstances() / 2,  result.numInstances());
 ((Resample)m_Filter).setSampleSizePercent(200);
 result = useFilter();
 assertEquals(m_Instances.numAttributes(), result.numAttributes());
 assertEquals("Expecting output to be 200% of input",
        m_Instances.numInstances() * 2,  result.numInstances());
}
origin: Waikato/weka-trunk

@ProgrammaticProperty
public void setSeed(int seed) {
 setRandomSeed(seed);
}
origin: com.github.fracpete/multisearch-weka-package

resample = new Resample();
resample.setRandomSeed(retrieveOwner().getSeed());
resample.setSampleSizePercent(getSampleSizePercent());
resample.setInputFormat(inst);
sample = Filter.useFilter(inst, resample);
origin: Waikato/weka-trunk

 setRandomSeed(Integer.parseInt(tmpStr));
} else {
 setRandomSeed(1);
 setSampleSizePercent(Double.parseDouble(tmpStr));
} else {
 setSampleSizePercent(100);
setNoReplacement(Utils.getFlag("no-replacement", options));
if (getNoReplacement()) {
 setInvertSelection(Utils.getFlag('V', options));
if (getInputFormat() != null) {
 setInputFormat(getInputFormat());
origin: Waikato/weka-trunk

/** Creates a default Resample */
public Filter getFilter() {
 Resample f = new Resample();
 f.setSampleSizePercent(50);
 return f;
}
weka.filters.unsupervised.instanceResample

Javadoc

Produces a random subsample of a dataset using either sampling with replacement or without replacement. The original dataset must fit entirely in memory. The number of instances in the generated dataset may be specified. When used in batch mode, subsequent batches are NOT resampled.

Valid options are:

 
-S <num> 
Specify the random number seed (default 1) 
 
-Z <num> 
The size of the output dataset, as a percentage of 
the input dataset (default 100) 
 
-no-replacement 
Disables replacement of instances 
(default: with replacement) 
 
-V 
Inverts the selection - only available with '-no-replacement'. 

Most used methods

  • <init>
  • setSampleSizePercent
    Sets the size of the subsample, as a percentage of the original set.
  • setInputFormat
    Sets the format of the input instances.
  • setInvertSelection
    Sets whether the selection is inverted (only if instances are drawn WIHTOUT replacement).
  • setNoReplacement
    Sets whether instances are drawn with or with out replacement.
  • setRandomSeed
    Sets the random number seed.
  • bufferInput
  • createSubsample
    Creates a subsample of the current set of input instances. The output instances are pushed onto the
  • flushInput
  • getInputFormat
  • getInvertSelection
    Gets whether selection is inverted (only if instances are drawn WIHTOUT replacement).
  • getNoReplacement
    Gets whether instances are drawn with or without replacement.
  • getInvertSelection,
  • getNoReplacement,
  • getRandomSeed,
  • getSampleSizePercent,
  • isFirstBatchDone,
  • numPendingOutput,
  • push,
  • resetQueue,
  • runFilter,
  • setOutputFormat

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getContentResolver (Context)
  • getApplicationContext (Context)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Menu (java.awt)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • ImageIO (javax.imageio)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now