All Downloads are FREE. Search and download functionalities are using the official Maven repository.

weka.core.neighboursearch.kdtrees.KDTreeNodeSplitter Maven / Gradle / Ivy

Go to download

The Waikato Environment for Knowledge Analysis (WEKA), a machine learning workbench. This version represents the developer version, the "bleeding edge" of development, you could say. New functionality gets added to this version.

There is a newer version: 3.9.6
Show newest version
/*
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see .
 */

/*
 * KDTreeNodeSplitter.java
 * Copyright (C) 1999-2012 University of Waikato
 */

package weka.core.neighboursearch.kdtrees;

import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;

import weka.core.EuclideanDistance;
import weka.core.Instances;
import weka.core.Option;
import weka.core.OptionHandler;
import weka.core.RevisionHandler;
import weka.core.RevisionUtils;

/**
 * Class that splits up a KDTreeNode.
 * 
 * @author Ashraf M. Kibriya (amk14[at-the-rate]cs[dot]waikato[dot]ac[dot]nz)
 * @version $Revision: 10203 $
 */
public abstract class KDTreeNodeSplitter implements Serializable,
  OptionHandler, RevisionHandler {

  /** ID added to prevent warning */
  private static final long serialVersionUID = 7222420817095067166L;

  /** The instances that'll be used for tree construction. */
  protected Instances m_Instances;

  /** The distance function used for building the tree. */
  protected EuclideanDistance m_EuclideanDistance;

  /**
   * The master index array that'll be reshuffled as nodes are split and the
   * tree is constructed.
   */
  protected int[] m_InstList;

  /**
   * Stores whether if the width of a KDTree node is normalized or not.
   */
  protected boolean m_NormalizeNodeWidth;

  // Constants
  /** Index of min value in an array of attributes' range. */
  public static final int MIN = EuclideanDistance.R_MIN;

  /** Index of max value in an array of attributes' range. */
  public static final int MAX = EuclideanDistance.R_MAX;

  /** Index of width value (max-min) in an array of attributes' range. */
  public static final int WIDTH = EuclideanDistance.R_WIDTH;

  /**
   * default constructor.
   */
  public KDTreeNodeSplitter() {
  }

  /**
   * Creates a new instance of KDTreeNodeSplitter.
   * 
   * @param instList Reference of the master index array.
   * @param insts The set of training instances on which the tree is built.
   * @param e The EuclideanDistance object that is used in tree contruction.
   */
  public KDTreeNodeSplitter(int[] instList, Instances insts, EuclideanDistance e) {
    m_InstList = instList;
    m_Instances = insts;
    m_EuclideanDistance = e;
  }

  /**
   * Returns an enumeration describing the available options.
   * 
   * @return an enumeration of all the available options.
   */
  @Override
  public Enumeration




© 2015 - 2024 Weber Informatics LLC | Privacy Policy