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

📄 testinstances.java

📁 Java 编写的多种数据挖掘算法 包括聚类、分类、预处理等
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        if (Utils.getOptionPos("word-separators", options) > -1) {      tmpStr = Utils.getOption("word-separators", options);      setWordSeparators(tmpStr);    }    else if (!initialized) {      setWordSeparators(DEFAULT_SEPARATORS);    }        tmpStr = Utils.getOption("date", options);    if (tmpStr.length() != 0)      setNumDate(Integer.parseInt(tmpStr));    else if (!initialized)      setNumDate(0);        tmpStr = Utils.getOption("relational", options);    if (tmpStr.length() != 0)      setNumRelational(Integer.parseInt(tmpStr));    else if (!initialized)      setNumRelational(0);        tmpStr = Utils.getOption("num-instances-relational", options);    if (tmpStr.length() != 0)      setNumInstancesRelational(Integer.parseInt(tmpStr));    else if (!initialized)      setNumInstancesRelational(10);        if (!initialized)      setMultiInstance(Utils.getFlag("multi-instance", options));  }    /**   * Gets the current settings of this object.   *   * @return an array of strings suitable for passing to setOptions   */  public String[] getOptions() {    Vector 	result;    String[]	options;    int		i;    result = new Vector();        result.add("-relation");    result.add(getRelation());        result.add("-seed");    result.add("" + getSeed());        result.add("-num-instances");    result.add("" + getNumInstances());        if (getNoClass()) {      result.add("-no-class");    }    else {      result.add("-class-type");      result.add("" + getClassType());            result.add("-class-values");      result.add("" + getNumClasses());            result.add("-class-index");      result.add("" + getClassIndex());    }        result.add("-nominal");    result.add("" + getNumNominal());        result.add("-nominal-values");    result.add("" + getNumNominalValues());        result.add("-numeric");    result.add("" + getNumNumeric());        result.add("-string");    result.add("" + getNumString());        result.add("-words");    result.add("" + getWords());        result.add("-word-separators");    result.add("" + getWordSeparators());        result.add("-date");    result.add("" + getNumDate());        result.add("-relation");    result.add("" + getNumRelational());        result.add("-num-instances-relational");    result.add("" + getNumInstancesRelational());    if (getMultiInstance())      result.add("-multi-instance");    if (getHandler() != null) {      result.add("-W");      result.add(getHandler().getClass().getName());      if (getHandler() instanceof OptionHandler) {	result.add("--");	options = ((OptionHandler) getHandler()).getOptions();	for (i = 0; i < options.length; i++)	  result.add(options[i]);      }    }        return (String[]) result.toArray(new String[result.size()]);  }    /**   * sets the name of the relation   *    * @param value 	the name of the relation   */  public void setRelation(String value) {    m_Relation = value;  }    /**   * returns the current name of the relation   *    * @return 		the name of the relation   */  public String getRelation() {    return m_Relation;  }    /**   * sets the seed value for the random number generator   *    * @param value	the seed   */  public void setSeed(int value) {    m_Seed   = value;    m_Random = new Random(m_Seed);  }    /**   * returns the current seed value   *    * @return 		the seed value   */  public int getSeed() {    return m_Seed;  }    /**   * sets the number of instances to produce   *    * @param value	the number of instances   */  public void setNumInstances(int value) {    m_NumInstances = value;  }    /**   * returns the current number of instances to produce   *    * @return the number of instances   */  public int getNumInstances() {    return m_NumInstances;  }    /**   * sets the class attribute type   *    * @param value	the class attribute type   */  public void setClassType(int value) {    m_ClassType = value;    m_RelationalClassFormat = null;  }    /**   * returns the current class type   *    * @return the class attribute type   */  public int getClassType() {    return m_ClassType;  }    /**   * sets the number of classes   *    * @param value	the number of classes   */  public void setNumClasses(int value) {    m_NumClasses = value;  }    /**   * returns the current number of classes   *    * @return the number of classes   */  public int getNumClasses() {    return m_NumClasses;  }    /**   * sets the class index (0-based)   *    * @param value	the class index    * @see #CLASS_IS_LAST   * @see #NO_CLASS   */  public void setClassIndex(int value) {    m_ClassIndex = value;  }    /**   * returns the current class index (0-based), -1 is last attribute   *    * @return 		the class index   * @see #CLASS_IS_LAST   * @see #NO_CLASS   */  public int getClassIndex() {    return m_ClassIndex;  }    /**   * whether to have no class, e.g., for clusterers; otherwise the class   * attribute index is set to last   *    * @param value whether to have no class   * @see #CLASS_IS_LAST   * @see #NO_CLASS   */  public void setNoClass(boolean value) {    if (value)      setClassIndex(NO_CLASS);    else      setClassIndex(CLASS_IS_LAST);  }    /**   * whether no class attribute is generated   *    * @return 		true if no class attribute is generated   */  public boolean getNoClass() {    return (getClassIndex() == NO_CLASS);  }    /**   * sets the number of nominal attributes   *    * @param value	the number of nominal attributes   */  public void setNumNominal(int value) {    m_NumNominal = value;  }    /**   * returns the current number of nominal attributes   *    * @return 		the number of nominal attributes   */  public int getNumNominal() {    return m_NumNominal;  }    /**   * sets the number of values for nominal attributes   *    * @param value	the number of values   */  public void setNumNominalValues(int value) {    m_NumNominalValues = value;  }    /**   * returns the current number of values for nominal attributes   *    * @return 		the number of values   */  public int getNumNominalValues() {    return m_NumNominalValues;  }    /**   * sets the number of numeric attributes   *    * @param value 	the number of numeric attributes   */  public void setNumNumeric(int value) {    m_NumNumeric = value;  }    /**   * returns the current number of numeric attributes   *    * @return 		the number of numeric attributes   */  public int getNumNumeric() {    return m_NumNumeric;  }    /**   * sets the number of string attributes   *    * @param value 	the number of string attributes   */  public void setNumString(int value) {    m_NumString = value;  }    /**   * returns the current number of string attributes   *    * @return 		the number of string attributes   */  public int getNumString() {    return m_NumString;  }  /**   * turns the comma-separated list into an array   *    * @param value	the list to process   * @return		the list as array   */  protected static String[] listToArray(String value) {    StringTokenizer	tok;    Vector		list;        list = new Vector();    tok = new StringTokenizer(value, ",");    while (tok.hasMoreTokens())      list.add(tok.nextToken());        return (String[]) list.toArray(new String[list.size()]);  }    /**   * turns the array into a comma-separated list   *    * @param value	the array to process   * @return		the array as list   */  protected static String arrayToList(String[] value) {    String	result;    int		i;        result = "";        for (i = 0; i < value.length; i++) {      if (i > 0)	result += ",";      result += value[i];    }        return result;  }    /**   * Sets the comma-separated list of words to use for generating strings. The   * list must contain at least 2 words, otherwise an exception will be thrown.   *    * @param value			the list of words   * @throws IllegalArgumentException	if not at least 2 words are provided   */  public void setWords(String value) {    if (listToArray(value).length < 2)      throw new IllegalArgumentException("At least 2 words must be provided!");        m_Words = listToArray(value);  }    /**   * returns the words used for assembling strings in a comma-separated list.   *    * @return		the words as comma-separated list   */  public String getWords() {    return arrayToList(m_Words);  }  /**   * sets the word separators (chars) to use for assembling strings.   *    * @param value	the characters to use as separators   */  public void setWordSeparators(String value) {    m_WordSeparators = value;  }    /**   * returns the word separators (chars) to use for assembling strings.   *    * @return		the current separators   */  public String getWordSeparators() {    return m_WordSeparators;  }    /**   * sets the number of data attributes   *    * @param value	the number of date attributes   */  public void setNumDate(int value) {    m_NumDate = value;  }    /**   * returns the current number of date attributes   *    * @return		the number of date attributes   */  public int getNumDate() {    return m_NumDate;  }    /**   * sets the number of relational attributes   *    * @param value	the number of relational attributes   */  public void setNumRelational(int value) {    m_NumRelational = value;    m_RelationalFormat = new Instances[value];  }    /**   * returns the current number of relational attributes   *    * @return		the number of relational attributes   */  public int getNumRelational() {    return m_NumRelational;  }    /**   * sets the number of instances in relational/bag attributes to produce   *    * @param value	the number of instances   */  public void setNumInstancesRelational(int value) {    m_NumInstancesRelational = value;  }    /**   * returns the current number of instances in relational/bag attributes to produce   *    * @return		the number of instances   */  public int getNumInstancesRelational() {    return m_NumInstancesRelational;  }  /**   * sets whether multi-instance data should be generated (with a fixed   * data structure)   *    * @param value	whether multi-instance data is generated   */  public void setMultiInstance(boolean value) {    m_MultiInstance = value;  }    /**   * Gets whether multi-instance data (with a fixed structure) is generated   *    * @return		true if multi-instance data is generated   */  public boolean getMultiInstance() {    return m_MultiInstance;  }    /**   * sets the structure for the bags for the relational attribute   *    * @param index       the index of the relational attribute   * @param value       the new structure   */  public void setRelationalFormat(int index, Instances value) {    if (value != null)      m_RelationalFormat[index] = new Instances(value, 0);    else      m_RelationalFormat[index] = null;  }    /**   * returns the format for the specified relational attribute, can be null   *    * @param index       the index of the relational attribute   * @return            the current structure   */  public Instances getRelationalFormat(int index) {    return m_RelationalFormat[index];  }  /**   * sets the structure for the relational class attribute   *    * @param value	the structure for the relational attribute   */  public void setRelationalClassFormat(Instances value) {    if (value != null)      m_RelationalClassFormat = new Instances(value, 0);    else      m_RelationalClassFormat = null;  }

⌨️ 快捷键说明

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