congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Resample
Code IndexAdd Tabnine 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)

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

  • Finding current android device location
  • compareTo (BigDecimal)
  • onRequestPermissionsResult (Fragment)
  • startActivity (Activity)
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now