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

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

  • Finding current android device location
  • notifyDataSetChanged (ArrayAdapter)
  • getSystemService (Context)
  • onCreateOptionsMenu (Activity)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Menu (java.awt)
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • BoxLayout (javax.swing)
  • 14 Best Plugins for Eclipse
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