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

How to use
Center
in
weka.filters.unsupervised.attribute

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: nz.ac.waikato.cms.weka/partialLeastSquares

/**
 * default constructor
 */
public PLSFilter() {
 super();
 // setup pre-processing
 m_Missing = new ReplaceMissingValues();
 m_Filter = new Center();
}
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 format has been set.
 */
public boolean input(Instance instance) {
 if (getInputFormat() == null)
  throw new IllegalStateException("No input instance format defined");
 if (m_NewBatch) {
  resetQueue();
  m_NewBatch = false;
 }
 
 if (m_Means == null) {
  bufferInput(instance);
  return false;
 } 
 else {
  convertInstance(instance);
  return true;
 }
}
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
 */
public boolean batchFinished() {
 if (getInputFormat() == null)
  throw new IllegalStateException("No input instance format defined");
 if (m_Means == null) {
  Instances input = getInputFormat();
  m_Means = new double[input.numAttributes()];
  for (int i = 0; i < input.numAttributes(); i++) {
   if (input.attribute(i).isNumeric() &&
       (input.classIndex() != i)) {
    m_Means[i] = input.meanOrMode(i);
   }
  }
  // Convert pending input instances
  for (int i = 0; i < input.numInstances(); i++)
   convertInstance(input.instance(i));
 }
 // Free memory
 flushInput();
 m_NewBatch = true;
 return (numPendingOutput() != 0);
}
origin: nz.ac.waikato.cms.weka/weka-stable

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

protected void fillCovariance() throws Exception {
 // just center the data or standardize it?
 if (m_center) {
  m_centerFilter = new Center();
  m_centerFilter.setInputFormat(m_TrainInstances);
  m_TrainInstances = Filter.useFilter(m_TrainInstances, m_centerFilter);
 } else {
  m_standardizeFilter = new Standardize();
  m_standardizeFilter.setInputFormat(m_TrainInstances);
  m_TrainInstances = Filter.useFilter(m_TrainInstances, m_standardizeFilter);
 }
 // now compute the covariance matrix
 m_Correlation = new UpperSymmDenseMatrix(m_NumAttribs);
 for (int i = 0; i < m_NumAttribs; i++) {
  for (int j = i; j < m_NumAttribs; j++) {
   double cov = 0;
   for (Instance inst: m_TrainInstances) {
    cov += inst.value(i) * inst.value(j);
   }
   cov /= m_TrainInstances.numInstances() - 1;
   m_Correlation.set(i, j, cov);
  }
 }
}
origin: nz.ac.waikato.cms.weka/weka-stable

 tempInst = m_standardizeFilter.output();
} else {
 m_centerFilter.input(tempInst);
 m_centerFilter.batchFinished();
 tempInst = m_centerFilter.output();
origin: nz.ac.waikato.cms.weka/partialLeastSquares

 m_ClassMean = instances.meanOrMode(instances.classIndex());
 m_ClassStdDev = 1;
 m_Filter = new Center();
 ((Center) m_Filter).setIgnoreClass(true);
 break;
case PREPROCESSING_STANDARDIZE:
origin: nz.ac.waikato.cms.weka/weka-stable

  if (instance.attribute(j).isNumeric() &&
      (!Utils.isMissingValue(vals[j])) &&
      (getInputFormat().classIndex() != j)) {
} else {
 double[] vals = instance.toDoubleArray();
 for (int j = 0; j < getInputFormat().numAttributes(); j++) {
  if (instance.attribute(j).isNumeric() &&
      (!Utils.isMissingValue(vals[j])) &&
      (getInputFormat().classIndex() != j)) {
   vals[j] = (vals[j] - m_Means[j]);
push(inst, false); // No need to copy instance
origin: nz.ac.waikato.cms.weka/weka-stable

protected void fillCovariance() throws Exception {
 // just center the data or standardize it?
 if (m_center) {
  m_centerFilter = new Center();
  m_centerFilter.setInputFormat(m_TrainInstances);
  m_TrainInstances = Filter.useFilter(m_TrainInstances, m_centerFilter);
 } else {
  m_standardizeFilter = new Standardize();
  m_standardizeFilter.setInputFormat(m_TrainInstances);
  m_TrainInstances = Filter.useFilter(m_TrainInstances, m_standardizeFilter);
 }
 // now compute the covariance matrix
 m_Correlation = new UpperSymmDenseMatrix(m_NumAttribs);
 for (int i = 0; i < m_NumAttribs; i++) {
  for (int j = i; j < m_NumAttribs; j++) {
   double cov = 0;
   for (Instance inst: m_TrainInstances) {
    cov += inst.value(i) * inst.value(j);
   }
   cov /= m_TrainInstances.numInstances() - 1;
   m_Correlation.set(i, j, cov);
  }
 }
}
origin: Waikato/weka-trunk

 tempInst = m_standardizeFilter.output();
} else {
 m_centerFilter.input(tempInst);
 m_centerFilter.batchFinished();
 tempInst = m_centerFilter.output();
origin: Waikato/weka-trunk

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

  if (instance.attribute(j).isNumeric() &&
      (!Utils.isMissingValue(vals[j])) &&
      (getInputFormat().classIndex() != j)) {
} else {
 double[] vals = instance.toDoubleArray();
 for (int j = 0; j < getInputFormat().numAttributes(); j++) {
  if (instance.attribute(j).isNumeric() &&
      (!Utils.isMissingValue(vals[j])) &&
      (getInputFormat().classIndex() != j)) {
   vals[j] = (vals[j] - m_Means[j]);
push(inst, false); // No need to copy instance
origin: Waikato/weka-trunk

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

 m_centerFilter = new Center();
 m_centerFilter.setInputFormat(m_trainInstances);
 m_trainInstances = Filter.useFilter(m_trainInstances, m_centerFilter);
} else {
origin: Waikato/weka-trunk

 tempInst = m_standardizeFilter.output();
} else {
 m_centerFilter.input(tempInst);
 m_centerFilter.batchFinished();
 tempInst = m_centerFilter.output();
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
 */
public boolean batchFinished() {
 if (getInputFormat() == null)
  throw new IllegalStateException("No input instance format defined");
 if (m_Means == null) {
  Instances input = getInputFormat();
  m_Means = new double[input.numAttributes()];
  for (int i = 0; i < input.numAttributes(); i++) {
   if (input.attribute(i).isNumeric() &&
       (input.classIndex() != i)) {
    m_Means[i] = input.meanOrMode(i);
   }
  }
  // Convert pending input instances
  for (int i = 0; i < input.numInstances(); i++)
   convertInstance(input.instance(i));
 }
 // Free memory
 flushInput();
 m_NewBatch = true;
 return (numPendingOutput() != 0);
}
origin: Waikato/weka-trunk

/**
 * 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 format has been set.
 */
public boolean input(Instance instance) {
 if (getInputFormat() == null)
  throw new IllegalStateException("No input instance format defined");
 if (m_NewBatch) {
  resetQueue();
  m_NewBatch = false;
 }
 
 if (m_Means == null) {
  bufferInput(instance);
  return false;
 } 
 else {
  convertInstance(instance);
  return true;
 }
}
origin: nz.ac.waikato.cms.weka/weka-stable

/** Creates a default Center */
public Filter getFilter() {
 return new Center();
}
origin: Waikato/weka-trunk

 m_centerFilter = new Center();
 m_centerFilter.setInputFormat(m_trainInstances);
 m_trainInstances = Filter.useFilter(m_trainInstances, m_centerFilter);
} else {
origin: nz.ac.waikato.cms.weka/weka-stable

 tempInst = m_standardizeFilter.output();
} else {
 m_centerFilter.input(tempInst);
 m_centerFilter.batchFinished();
 tempInst = m_centerFilter.output();
weka.filters.unsupervised.attributeCenter

Javadoc

Centers all numeric attributes in the given dataset to have zero mean (apart from the class attribute, if set).

Valid options are:

 -unset-class-temporarily 
Unsets the class index temporarily before the filter is 
applied to the data. 
(default: no)

Most used methods

  • <init>
  • batchFinished
    Signify that this batch of input to the filter is finished. If the filter requires all instances pri
  • bufferInput
  • convertInstance
    Convert a single instance over. The converted instance is added to the end of the output queue.
  • flushInput
  • getInputFormat
  • input
    Input an instance for filtering. Filter requires all training instances be read before producing out
  • numPendingOutput
  • output
  • push
  • resetQueue
  • runFilter
  • resetQueue,
  • runFilter,
  • setInputFormat,
  • setOutputFormat,
  • setIgnoreClass

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSystemService (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • onCreateOptionsMenu (Activity)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
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