⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svmlight.java

📁 wekaUT是 university texas austin 开发的基于weka的半指导学习(semi supervised learning)的分类器
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
  }  /**   * Gets the current settings    *   * @return an array of strings suitable for passing to setOptions()   */  public String [] getOptions() {    String [] options = new String [20];    int current = 0;    if (m_debug) {      options[current++] = "-D";    }    options[current++] = "-v";    options[current++] = "" + m_verbosityLevel;    if (m_autoBounds) {      options[current++] = "-A";    } else {       options[current++] = "-n";      options[current++] = "" + m_minMargin;      options[current++] = "-m";      options[current++] = "" + m_maxMargin;    }        switch(m_mode) {    case SVM_MODE_CLASSIFICATION:      options[current++] = "-C";      break;    case SVM_MODE_REGRESSION:      options[current++] = "-R";      options[current++] = "-w";      options[current++] = "" + m_width;      break;    case SVM_MODE_PREFERENCE_RANKING:      options[current++] = "-P";      break;    default:      System.err.println("UNKNOWN MODE: " + m_mode);    }    options[current++] = "-c";    options[current++] = "" + m_C;    options[current++] = "-j";    options[current++] = "" + m_costFactor;        if (m_biased) {      options[current++] = "-b";    }    if (m_removeInconsistentExamples) {      options[current++] = "-i";    }    switch (m_kernelType) {    case KERNEL_LINEAR:      options[current++] = "-L";      break;    case KERNEL_POLYNOMIAL:      options[current++] = "-O";      options[current++] = "-d";      options[current++] = "" + m_d;      options[current++] = "-s";      options[current++] = "" + m_s;      options[current++] = "-r";      options[current++] = "" + m_c1;      break;    case KERNEL_RBF:      options[current++] = "-B";      options[current++] = "-g";      options[current++] = "" + m_gamma;      break;    case KERNEL_SIGMOID_TANH:      options[current++] = "-S";      options[current++] = "-s";      options[current++] = "" + m_s;      options[current++] = "-r";      options[current++] = "" + m_c1;      break;    default:      System.err.println("UNKNOWN KERNEL TYPE: " + m_kernelType);    }    options[current++] = "-p";    options[current++] = m_binPath;        while (current < options.length) {      options[current++] = "";    }    return options;  }  /** Turn debugging output on/off   * @param debug if true, SVM-light output and other debugging info will be printed   */  public void setDebug(boolean debug) {    m_debug = debug;  }  /** See whether debugging output is on/off   * @returns if true, SVM-light output and other debugging info will be printed   */  public boolean getDebug() {    return m_debug;  }  /** Set SVM-light to operate via in/out bufffers or via temporary files   * @param bufferedMode if true, SVM-light classification is performed via stdin/stdout   */  public void setBufferedMode(boolean bufferedMode) {    m_bufferedMode = bufferedMode;  }  /** See whether SVM-light is operating via in/out bufffers or via temporary files   * @returns if true, SVM-light classification is performed via stdin/stdout   */  public boolean getBufferedMode() {    return m_bufferedMode;  }  /** Set verbosity level, can be anything between 0 and 3   * @param verbosity Verbosity level for SVM-light   */  public void setVerbosityLevel(int verbosity) {    m_verbosityLevel = verbosity;  }  /** Get verbosity level, can be anything between 0 and 3   * @param verbosity Verbosity level for SVM-light   */  public int getVerbosityLevel() {    return m_verbosityLevel;  }  /** Set the mode of the SVM   * @param mode one of classification, regression and preference ranking   */  public void setMode(SelectedTag mode) {    if (mode.getTags() == TAGS_SVM_MODE) {      m_mode = mode.getSelectedTag().getID();    }  }  /**   * return the SVM-light mode   * @return one of  classification, regression and preference ranking   */  public SelectedTag getMode() {    return new SelectedTag(m_mode, TAGS_SVM_MODE);  }  /** Set the epsilon width of tube for regression  */  public void setWidth(double width) {    m_width = width;  }  /** Get the epsilon width of tube for regression  */  public double getWidth() {    return m_width;  }  /** Set the trade-off between training error and margin (default 0 corresponds to [avg. x*x]^-1) */  public void setC(double C) {    m_C = C;  }  /** Get the trade-off between training error and margin (default 0 corresponds to [avg. x*x]^-1) */  public double getC() {    return m_C;  }  /** Set cost-factor, by which training errors on positive examples outweight errors on negative examples */  public void setCostFactor(double costFactor) {    m_costFactor = costFactor;  }  /** Get cost-factor, by which training errors on positive examples outweight errors on negative examples */  public double getCostFactor() {    return m_costFactor;  }  /** Set whether the hyperplane is biased (i.e. x*w+b>0) instead of unbiased hyperplane (i.e. x*w>0)   * @param biased if true, the hyperplane will be biased   */  public void setBiased(boolean biased) {    m_biased = biased;  }  /** Get whether the hyperplane is biased (i.e. x*w+b>0) instead of unbiased hyperplane (i.e. x*w>0)   * @returns if true, the hyperplane will be biased   */  public boolean getBiased() {    return m_biased;  }  /** Set whether the inconsistent examples are removed and retraining follows   * @param removeInconsistentExamples   */  public void setRemoveInconsistentExamples(boolean removeInconsistentExamples) {    m_removeInconsistentExamples = removeInconsistentExamples;  }   /** Get whether the inconsistent examples are removed and retraining follows   * @returns removeInconsistentExamples   */  public boolean getRemoveInconsistentExamples() {    return m_removeInconsistentExamples;  }   /** Set the kernel type for SVM-light   * @param type one of the kernel types    */  public void setKernelType(SelectedTag kernelType) {    if (kernelType.getTags() == TAGS_KERNEL_TYPE) {      m_kernelType = kernelType.getSelectedTag().getID();    }  }  /** Get the SVM-light kernel type   * @return kernel type    */  public SelectedTag getKernelType() {    return new SelectedTag(m_kernelType, TAGS_KERNEL_TYPE);  }  /** Set parameter d in polynomial kernel */  public void setD(int d) {    m_d = d;  }  /** Get parameter d in polynomial kernel */  public int getD() {    return m_d;  }    /** Set parameter gamma in rbf kernel */  public void setGamma(double gamma) {    m_gamma = gamma;  }  /** Get parameter gamma in rbf kernel */  public double getGamma() {    return m_gamma;  }  /** Set parameter s in sigmoid/polynomial kernel */  public void setS(double s) {    m_s = s;  }  /** Get parameter s in sigmoid/polynomial kernel */  public double getS() {    return m_s;  }  /** Set parameter c in sigmoid/poly kernel */  public void setC1(double c1) {    m_c1 = c1;  }   /** Get parameter c in sigmoid/poly kernel */  public double getC1() {    return m_c1;  }   /** Set the maxMargin that an SVM can return */  public void setMaxMargin(double maxMargin) {    m_maxMargin = maxMargin;  }  /** Get  the maxMargin that an SVM can return */  public double getMaxMargin() {    return m_maxMargin;  }  /** Set the minMargin that an SVM can return */  public void setMinMargin(double minMargin) {    m_minMargin = minMargin;  }  /** Get  the minMargin that an SVM can return */  public double getMinMargin() {    return m_minMargin;  }  /** Set whether min/max margins are determined automatically */  public void setAutoBounds(boolean autoBounds) {    m_autoBounds = autoBounds;  }  /** Get whether min/max margins are determined automatically */  public boolean getAutoBounds() {    return m_autoBounds;  }    /**   * Returns a description of this classifier.   *   * @return a description of this classifier as a string.   */  public String toString() {    if (m_train == null) {      return "SVMlight: No model built yet.";    }    String result = "SVM-light classifier\n";    return result;  }  /** Set the path for the temporary files   * @param tempDirPath a full path to the temporary directory   */  public void setTempDirPath(String tempDirPath) {    m_tempDirPath = tempDirPath;  }  /** Get the path for the temporary files   * @returns a full path to the temporary directory   */  public String getTempDirPath() {    return m_tempDirPath;  }  /** Set the path for the binary files   * @param tempDirPath a full path to the directory where SVMlight binary files are   */  public void setBinPath(String binPath) {    m_binPath = binPath;  }  /** Get the path for the binaries   * @returns a full path to the binaries directory   */  public String getBinPath() {    return m_binPath;  }    /** A little helper to create a single String from an array of Strings   * @param strings an array of strings   * @returns a single concatenated string, separated by commas   */  public static String concatStringArray(String[] strings) {    String result = new String();    for (int i = 0; i < strings.length; i++) {      result = result + "\"" + strings[i] + "\" ";    }    return result;  }   /**   * Main method for testing this class.   *   * @param argv should contain command line options (see setOptions)   */  public static void main(String [] argv) {    try {      System.out.println(Evaluation.evaluateModel(new SVMlight(), argv));    } catch (Exception e) {      e.printStackTrace();      System.err.println(e.getMessage());    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -