Java 类weka.core.neighboursearch.NearestNeighbourSearch 实例源码

项目:autoweka    文件:LOF.java   
/**
 * Parses a given list of options.
 * <p/>
 * 
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -min &lt;num&gt;
 *  Lower bound on the k nearest neighbors for finding max LOF (minPtsLB)
 *  (default = 10)</pre>
 * 
 * <pre> -max &lt;num&gt;
 *  Upper bound on the k nearest neighbors for finding max LOF (minPtsUB)
 *  (default = 40)</pre>
 * 
 * <pre> -A
 *  The nearest neighbour search algorithm to use (default: weka.core.neighboursearch.LinearNNSearch).
 * </pre>
 * 
 * <pre> -num-slots &lt;num&gt;
 *  Number of execution slots.
 *  (default 1 - i.e. no parallelism)</pre>
 * 
 <!-- options-end -->
 * 
 * @param options the list of options as an array of strings
 * @throws Exception if an option is not supported
 */
@Override
public void setOptions(String[] options) throws Exception {
  String minP = Utils.getOption("min", options);
  if (minP.length() > 0) {
    setMinPointsLowerBound(minP);
  }

  String maxP = Utils.getOption("max", options);
  if (maxP.length() > 0) {
    setMinPointsUpperBound(maxP);
  }

  String nnSearchClass = Utils.getOption('A', options);
  if (nnSearchClass.length() != 0) {
    String nnSearchClassSpec[] = Utils.splitOptions(nnSearchClass);
    if (nnSearchClassSpec.length == 0) {
      throw new Exception("Invalid NearestNeighbourSearch algorithm "
          + "specification string.");
    }
    String className = nnSearchClassSpec[0];
    nnSearchClassSpec[0] = "";

    setNNSearch((NearestNeighbourSearch) Utils.forName(
        NearestNeighbourSearch.class, className, nnSearchClassSpec));
  } else {
    this.setNNSearch(new LinearNNSearch());
  }

  String slotsS = Utils.getOption("num-slots", options);
  if (slotsS.length() > 0) {
    setNumExecutionSlots(slotsS);
  }

  Utils.checkForRemainingOptions(options);
}
项目:autoweka    文件:LOF.java   
public NNFinder(Instances training, int start, int end,
    NearestNeighbourSearch search) {
  m_nnTrain = training;
  m_start = start;
  m_end = end;
  m_search = search;
}
项目:repo.kmeanspp.silhouette_score    文件:LWL.java   
/**
 * Parses a given list of options. <p/>
 *
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -A
 *  The nearest neighbour search algorithm to use (default: weka.core.neighboursearch.LinearNNSearch).
 * </pre>
 * 
 * <pre> -K &lt;number of neighbours&gt;
 *  Set the number of neighbours used to set the kernel bandwidth.
 *  (default all)</pre>
 * 
 * <pre> -U &lt;number of weighting method&gt;
 *  Set the weighting kernel shape to use. 0=Linear, 1=Epanechnikov,
 *  2=Tricube, 3=Inverse, 4=Gaussian.
 *  (default 0 = Linear)</pre>
 * 
 * <pre> -D
 *  If set, classifier is run in debug mode and
 *  may output additional info to the console</pre>
 * 
 * <pre> -W
 *  Full name of base classifier.
 *  (default: weka.classifiers.trees.DecisionStump)</pre>
 * 
 * <pre> 
 * Options specific to classifier weka.classifiers.trees.DecisionStump:
 * </pre>
 * 
 * <pre> -D
 *  If set, classifier is run in debug mode and
 *  may output additional info to the console</pre>
 * 
 <!-- options-end -->
 *
 * @param options the list of options as an array of strings
 * @throws Exception if an option is not supported
 */
public void setOptions(String[] options) throws Exception {

  String knnString = Utils.getOption('K', options);
  if (knnString.length() != 0) {
    setKNN(Integer.parseInt(knnString));
  } else {
    setKNN(-1);
  }

  String weightString = Utils.getOption('U', options);
  if (weightString.length() != 0) {
    setWeightingKernel(Integer.parseInt(weightString));
  } else {
    setWeightingKernel(LINEAR);
  }

  String nnSearchClass = Utils.getOption('A', options);
  if(nnSearchClass.length() != 0) {
    String nnSearchClassSpec[] = Utils.splitOptions(nnSearchClass);
    if(nnSearchClassSpec.length == 0) { 
      throw new Exception("Invalid NearestNeighbourSearch algorithm " +
                          "specification string."); 
    }
    String className = nnSearchClassSpec[0];
    nnSearchClassSpec[0] = "";

    setNearestNeighbourSearchAlgorithm( (NearestNeighbourSearch)
                Utils.forName( NearestNeighbourSearch.class, 
                               className, 
                               nnSearchClassSpec)
                                      );
  }
  else 
    this.setNearestNeighbourSearchAlgorithm(new LinearNNSearch());

  super.setOptions(options);
}
项目:autoweka    文件:LOF.java   
/**
 * Parses a given list of options.
 * <p/>
 * 
 <!-- options-start --> 
 * Valid options are:
 * <p/>
 * 
 * <pre>
 * -min &lt;num&gt;
 *  Lower bound on the k nearest neighbors for finding max LOF (minPtsLB)
 *  (default = 10)
 * </pre>
 * 
 * <pre>
 * -max &lt;num&gt;
 *  Upper bound on the k nearest neighbors for finding max LOF (minPtsUB)
 *  (default = 40)
 * </pre>
 * 
 * <pre>
 * -A
 *  The nearest neighbour search algorithm to use (default: weka.core.neighboursearch.LinearNNSearch).
 * </pre>
 * 
 * <pre>
 * -num-slots &lt;num&gt;
 *  Number of execution slots.
 *  (default 1 - i.e. no parallelism)
 * </pre>
 * 
 <!-- options-end -->
 * 
 * @param options the list of options as an array of strings
 * @throws Exception if an option is not supported
 */
@Override
public void setOptions(String[] options) throws Exception {
  String minP = Utils.getOption("min", options);
  if (minP.length() > 0) {
    setMinPointsLowerBound(minP);
  }

  String maxP = Utils.getOption("max", options);
  if (maxP.length() > 0) {
    setMinPointsUpperBound(maxP);
  }

  String nnSearchClass = Utils.getOption('A', options);
  if (nnSearchClass.length() != 0) {
    String nnSearchClassSpec[] = Utils.splitOptions(nnSearchClass);
    if (nnSearchClassSpec.length == 0) {
      throw new Exception("Invalid NearestNeighbourSearch algorithm "
          + "specification string.");
    }
    String className = nnSearchClassSpec[0];
    nnSearchClassSpec[0] = "";

    setNNSearch((NearestNeighbourSearch) Utils.forName(
        NearestNeighbourSearch.class, className, nnSearchClassSpec));
  } else {
    this.setNNSearch(new LinearNNSearch());
  }

  String slotsS = Utils.getOption("num-slots", options);
  if (slotsS.length() > 0) {
    setNumExecutionSlots(slotsS);
  }

  Utils.checkForRemainingOptions(options);
}
项目:autoweka    文件:LWL.java   
/**
 * Parses a given list of options. <p/>
 *
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -A
 *  The nearest neighbour search algorithm to use (default: weka.core.neighboursearch.LinearNNSearch).
 * </pre>
 * 
 * <pre> -K &lt;number of neighbours&gt;
 *  Set the number of neighbours used to set the kernel bandwidth.
 *  (default all)</pre>
 * 
 * <pre> -U &lt;number of weighting method&gt;
 *  Set the weighting kernel shape to use. 0=Linear, 1=Epanechnikov,
 *  2=Tricube, 3=Inverse, 4=Gaussian.
 *  (default 0 = Linear)</pre>
 * 
 * <pre> -D
 *  If set, classifier is run in debug mode and
 *  may output additional info to the console</pre>
 * 
 * <pre> -W
 *  Full name of base classifier.
 *  (default: weka.classifiers.trees.DecisionStump)</pre>
 * 
 * <pre> 
 * Options specific to classifier weka.classifiers.trees.DecisionStump:
 * </pre>
 * 
 * <pre> -D
 *  If set, classifier is run in debug mode and
 *  may output additional info to the console</pre>
 * 
 <!-- options-end -->
 *
 * @param options the list of options as an array of strings
 * @throws Exception if an option is not supported
 */
public void setOptions(String[] options) throws Exception {

  String knnString = Utils.getOption('K', options);
  if (knnString.length() != 0) {
    setKNN(Integer.parseInt(knnString));
  } else {
    setKNN(-1);
  }

  String weightString = Utils.getOption('U', options);
  if (weightString.length() != 0) {
    setWeightingKernel(Integer.parseInt(weightString));
  } else {
    setWeightingKernel(LINEAR);
  }

  String nnSearchClass = Utils.getOption('A', options);
  if(nnSearchClass.length() != 0) {
    String nnSearchClassSpec[] = Utils.splitOptions(nnSearchClass);
    if(nnSearchClassSpec.length == 0) { 
      throw new Exception("Invalid NearestNeighbourSearch algorithm " +
                          "specification string."); 
    }
    String className = nnSearchClassSpec[0];
    nnSearchClassSpec[0] = "";

    setNearestNeighbourSearchAlgorithm( (NearestNeighbourSearch)
                Utils.forName( NearestNeighbourSearch.class, 
                               className, 
                               nnSearchClassSpec)
                                      );
  }
  else 
    this.setNearestNeighbourSearchAlgorithm(new LinearNNSearch());

  super.setOptions(options);
}
项目:umple    文件:LWL.java   
/**
 * Parses a given list of options. <p/>
 *
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -A
 *  The nearest neighbour search algorithm to use (default: weka.core.neighboursearch.LinearNNSearch).
 * </pre>
 * 
 * <pre> -K &lt;number of neighbours&gt;
 *  Set the number of neighbours used to set the kernel bandwidth.
 *  (default all)</pre>
 * 
 * <pre> -U &lt;number of weighting method&gt;
 *  Set the weighting kernel shape to use. 0=Linear, 1=Epanechnikov,
 *  2=Tricube, 3=Inverse, 4=Gaussian.
 *  (default 0 = Linear)</pre>
 * 
 * <pre> -D
 *  If set, classifier is run in debug mode and
 *  may output additional info to the console</pre>
 * 
 * <pre> -W
 *  Full name of base classifier.
 *  (default: weka.classifiers.trees.DecisionStump)</pre>
 * 
 * <pre> 
 * Options specific to classifier weka.classifiers.trees.DecisionStump:
 * </pre>
 * 
 * <pre> -D
 *  If set, classifier is run in debug mode and
 *  may output additional info to the console</pre>
 * 
 <!-- options-end -->
 *
 * @param options the list of options as an array of strings
 * @throws Exception if an option is not supported
 */
public void setOptions(String[] options) throws Exception {

  String knnString = Utils.getOption('K', options);
  if (knnString.length() != 0) {
    setKNN(Integer.parseInt(knnString));
  } else {
    setKNN(-1);
  }

  String weightString = Utils.getOption('U', options);
  if (weightString.length() != 0) {
    setWeightingKernel(Integer.parseInt(weightString));
  } else {
    setWeightingKernel(LINEAR);
  }

  String nnSearchClass = Utils.getOption('A', options);
  if(nnSearchClass.length() != 0) {
    String nnSearchClassSpec[] = Utils.splitOptions(nnSearchClass);
    if(nnSearchClassSpec.length == 0) { 
      throw new Exception("Invalid NearestNeighbourSearch algorithm " +
                          "specification string."); 
    }
    String className = nnSearchClassSpec[0];
    nnSearchClassSpec[0] = "";

    setNearestNeighbourSearchAlgorithm( (NearestNeighbourSearch)
                Utils.forName( NearestNeighbourSearch.class, 
                               className, 
                               nnSearchClassSpec)
                                      );
  }
  else 
    this.setNearestNeighbourSearchAlgorithm(new LinearNNSearch());

  super.setOptions(options);
}
项目:jbossBA    文件:LWL.java   
/**
 * Parses a given list of options. <p/>
 *
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -A
 *  The nearest neighbour search algorithm to use (default: weka.core.neighboursearch.LinearNNSearch).
 * </pre>
 * 
 * <pre> -K &lt;number of neighbours&gt;
 *  Set the number of neighbours used to set the kernel bandwidth.
 *  (default all)</pre>
 * 
 * <pre> -U &lt;number of weighting method&gt;
 *  Set the weighting kernel shape to use. 0=Linear, 1=Epanechnikov,
 *  2=Tricube, 3=Inverse, 4=Gaussian.
 *  (default 0 = Linear)</pre>
 * 
 * <pre> -D
 *  If set, classifier is run in debug mode and
 *  may output additional info to the console</pre>
 * 
 * <pre> -W
 *  Full name of base classifier.
 *  (default: weka.classifiers.trees.DecisionStump)</pre>
 * 
 * <pre> 
 * Options specific to classifier weka.classifiers.trees.DecisionStump:
 * </pre>
 * 
 * <pre> -D
 *  If set, classifier is run in debug mode and
 *  may output additional info to the console</pre>
 * 
 <!-- options-end -->
 *
 * @param options the list of options as an array of strings
 * @throws Exception if an option is not supported
 */
public void setOptions(String[] options) throws Exception {

  String knnString = Utils.getOption('K', options);
  if (knnString.length() != 0) {
    setKNN(Integer.parseInt(knnString));
  } else {
    setKNN(-1);
  }

  String weightString = Utils.getOption('U', options);
  if (weightString.length() != 0) {
    setWeightingKernel(Integer.parseInt(weightString));
  } else {
    setWeightingKernel(LINEAR);
  }

  String nnSearchClass = Utils.getOption('A', options);
  if(nnSearchClass.length() != 0) {
    String nnSearchClassSpec[] = Utils.splitOptions(nnSearchClass);
    if(nnSearchClassSpec.length == 0) { 
      throw new Exception("Invalid NearestNeighbourSearch algorithm " +
                          "specification string."); 
    }
    String className = nnSearchClassSpec[0];
    nnSearchClassSpec[0] = "";

    setNearestNeighbourSearchAlgorithm( (NearestNeighbourSearch)
                Utils.forName( NearestNeighbourSearch.class, 
                               className, 
                               nnSearchClassSpec)
                                      );
  }
  else 
    this.setNearestNeighbourSearchAlgorithm(new LinearNNSearch());

  super.setOptions(options);
}
项目:repo.kmeanspp.silhouette_score    文件:LWL.java   
/**
 * Returns the current nearestNeighbourSearch algorithm in use.
 * @return the NearestNeighbourSearch algorithm currently in use.
 */
public NearestNeighbourSearch getNearestNeighbourSearchAlgorithm() {
  return m_NNSearch;
}
项目:repo.kmeanspp.silhouette_score    文件:LWL.java   
/**
 * Sets the nearestNeighbourSearch algorithm to be used for finding nearest
 * neighbour(s).
 * @param nearestNeighbourSearchAlgorithm - The NearestNeighbourSearch class.
 */
public void setNearestNeighbourSearchAlgorithm(NearestNeighbourSearch nearestNeighbourSearchAlgorithm) {
  m_NNSearch = nearestNeighbourSearchAlgorithm;
}
项目:repo.kmeanspp.silhouette_score    文件:IBk.java   
/**
 * Returns the current nearestNeighbourSearch algorithm in use.
 * @return the NearestNeighbourSearch algorithm currently in use.
 */
public NearestNeighbourSearch getNearestNeighbourSearchAlgorithm() {
  return m_NNSearch;
}
项目:repo.kmeanspp.silhouette_score    文件:IBk.java   
/**
 * Sets the nearestNeighbourSearch algorithm to be used for finding nearest
 * neighbour(s).
 * @param nearestNeighbourSearchAlgorithm - The NearestNeighbourSearch class.
 */
public void setNearestNeighbourSearchAlgorithm(NearestNeighbourSearch nearestNeighbourSearchAlgorithm) {
  m_NNSearch = nearestNeighbourSearchAlgorithm;
}
项目:collective-classification-weka-package    文件:YATSI.java   
/**
 * Returns the current nearestNeighbourSearch algorithm in use.
 * @return the NearestNeighbourSearch algorithm currently in use.
 */
public NearestNeighbourSearch getNearestNeighbourSearchAlgorithm() {
  return m_NNSearch;
}
项目:collective-classification-weka-package    文件:YATSI.java   
/**
 * Sets the nearestNeighbourSearch algorithm to be used for finding nearest
 * neighbour(s).
 * @param value The NearestNeighbourSearch class.
 */
public void setNearestNeighbourSearchAlgorithm(NearestNeighbourSearch value) {
  m_NNSearch = value;
}
项目:collective-classification-weka-package    文件:CollectiveIBk.java   
/**
 * Returns the current nearestNeighbourSearch algorithm in use.
 * 
 * @return      the NearestNeighbourSearch algorithm currently in use.
 */
public NearestNeighbourSearch getNearestNeighbourSearchAlgorithm() {
  return m_Classifier.getNearestNeighbourSearchAlgorithm();
}
项目:collective-classification-weka-package    文件:CollectiveIBk.java   
/**
 * Sets the nearestNeighbourSearch algorithm to be used for finding nearest
 * neighbour(s).
 * 
 * @param value     The NearestNeighbourSearch class.
 */
public void setNearestNeighbourSearchAlgorithm(NearestNeighbourSearch value) {
  m_Classifier.setNearestNeighbourSearchAlgorithm(value);
}
项目:autoweka    文件:LOF.java   
/**
 * Set the nearest neighbor search method to use
 * 
 * @param s the nearest neighbor search method to use
 */
public void setNNSearch(NearestNeighbourSearch s) {
  m_nnTemplate = s;
}
项目:autoweka    文件:LOF.java   
/**
 * Get the nearest neighbor search method to use
 * 
 * @return the nearest neighbor search method to use
 */
public NearestNeighbourSearch getNNSearch() {
  return m_nnTemplate;
}
项目:autoweka    文件:LOF.java   
/**
 * Set the nearest neighbor search method to use
 * 
 * @param s the nearest neighbor search method to use
 */
public void setNNSearch(NearestNeighbourSearch s) {
  m_nnTemplate = s;
}
项目:autoweka    文件:LOF.java   
/**
 * Get the nearest neighbor search method to use
 * 
 * @return the nearest neighbor search method to use
 */
public NearestNeighbourSearch getNNSearch() {
  return m_nnTemplate;
}
项目:autoweka    文件:LWL.java   
/**
 * Returns the current nearestNeighbourSearch algorithm in use.
 * @return the NearestNeighbourSearch algorithm currently in use.
 */
public NearestNeighbourSearch getNearestNeighbourSearchAlgorithm() {
  return m_NNSearch;
}
项目:autoweka    文件:LWL.java   
/**
 * Sets the nearestNeighbourSearch algorithm to be used for finding nearest
 * neighbour(s).
 * @param nearestNeighbourSearchAlgorithm - The NearestNeighbourSearch class.
 */
public void setNearestNeighbourSearchAlgorithm(NearestNeighbourSearch nearestNeighbourSearchAlgorithm) {
  m_NNSearch = nearestNeighbourSearchAlgorithm;
}
项目:autoweka    文件:IBk.java   
/**
 * Returns the current nearestNeighbourSearch algorithm in use.
 * @return the NearestNeighbourSearch algorithm currently in use.
 */
public NearestNeighbourSearch getNearestNeighbourSearchAlgorithm() {
  return m_NNSearch;
}
项目:autoweka    文件:IBk.java   
/**
 * Sets the nearestNeighbourSearch algorithm to be used for finding nearest
 * neighbour(s).
 * @param nearestNeighbourSearchAlgorithm - The NearestNeighbourSearch class.
 */
public void setNearestNeighbourSearchAlgorithm(NearestNeighbourSearch nearestNeighbourSearchAlgorithm) {
  m_NNSearch = nearestNeighbourSearchAlgorithm;
}
项目:umple    文件:LWL.java   
/**
 * Returns the current nearestNeighbourSearch algorithm in use.
 * @return the NearestNeighbourSearch algorithm currently in use.
 */
public NearestNeighbourSearch getNearestNeighbourSearchAlgorithm() {
  return m_NNSearch;
}
项目:umple    文件:LWL.java   
/**
 * Sets the nearestNeighbourSearch algorithm to be used for finding nearest
 * neighbour(s).
 * @param nearestNeighbourSearchAlgorithm - The NearestNeighbourSearch class.
 */
public void setNearestNeighbourSearchAlgorithm(NearestNeighbourSearch nearestNeighbourSearchAlgorithm) {
  m_NNSearch = nearestNeighbourSearchAlgorithm;
}
项目:umple    文件:IBk.java   
/**
 * Returns the current nearestNeighbourSearch algorithm in use.
 * @return the NearestNeighbourSearch algorithm currently in use.
 */
public NearestNeighbourSearch getNearestNeighbourSearchAlgorithm() {
  return m_NNSearch;
}
项目:umple    文件:IBk.java   
/**
 * Sets the nearestNeighbourSearch algorithm to be used for finding nearest
 * neighbour(s).
 * @param nearestNeighbourSearchAlgorithm - The NearestNeighbourSearch class.
 */
public void setNearestNeighbourSearchAlgorithm(NearestNeighbourSearch nearestNeighbourSearchAlgorithm) {
  m_NNSearch = nearestNeighbourSearchAlgorithm;
}
项目:missing-values-imputation-weka-package    文件:SimpleNearestNeighbor.java   
/**
 * Returns the default nearest neighbor search to use.
 *
 * @return      the default
 */
protected NearestNeighbourSearch getDefaultSearch() {
  return new LinearNNSearch();
}
项目:missing-values-imputation-weka-package    文件:SimpleNearestNeighbor.java   
/**
 * Sets the nearest neighbor search to use.
 *
 * @param value     the search
 */
public void setSearch(NearestNeighbourSearch value) {
  m_Search = value;
}
项目:missing-values-imputation-weka-package    文件:SimpleNearestNeighbor.java   
/**
 * Returns the current nearest neighbor search in use.
 *
 * @return      the search
 */
public NearestNeighbourSearch getSearch() {
  return m_Search;
}
项目:jbossBA    文件:LWL.java   
/**
 * Returns the current nearestNeighbourSearch algorithm in use.
 * @return the NearestNeighbourSearch algorithm currently in use.
 */
public NearestNeighbourSearch getNearestNeighbourSearchAlgorithm() {
  return m_NNSearch;
}
项目:jbossBA    文件:LWL.java   
/**
 * Sets the nearestNeighbourSearch algorithm to be used for finding nearest
 * neighbour(s).
 * @param nearestNeighbourSearchAlgorithm - The NearestNeighbourSearch class.
 */
public void setNearestNeighbourSearchAlgorithm(NearestNeighbourSearch nearestNeighbourSearchAlgorithm) {
  m_NNSearch = nearestNeighbourSearchAlgorithm;
}
项目:jbossBA    文件:IBk.java   
/**
 * Returns the current nearestNeighbourSearch algorithm in use.
 * @return the NearestNeighbourSearch algorithm currently in use.
 */
public NearestNeighbourSearch getNearestNeighbourSearchAlgorithm() {
  return m_NNSearch;
}
项目:jbossBA    文件:IBk.java   
/**
 * Sets the nearestNeighbourSearch algorithm to be used for finding nearest
 * neighbour(s).
 * @param nearestNeighbourSearchAlgorithm - The NearestNeighbourSearch class.
 */
public void setNearestNeighbourSearchAlgorithm(NearestNeighbourSearch nearestNeighbourSearchAlgorithm) {
  m_NNSearch = nearestNeighbourSearchAlgorithm;
}