當前位置: 首頁>>代碼示例>>Java>>正文


Java Utils.backQuoteChars方法代碼示例

本文整理匯總了Java中weka.core.Utils.backQuoteChars方法的典型用法代碼示例。如果您正苦於以下問題:Java Utils.backQuoteChars方法的具體用法?Java Utils.backQuoteChars怎麽用?Java Utils.backQuoteChars使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在weka.core.Utils的用法示例。


在下文中一共展示了Utils.backQuoteChars方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doRunKeys

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Gets the keys for a specified run number. Different run numbers correspond
 * to different randomizations of the data. Keys produced should be sent to
 * the current ResultListener
 * 
 * @param run the run number to get keys for.
 * @throws Exception if a problem occurs while getting the keys
 */
@Override
public void doRunKeys(int run) throws Exception {
  if (m_Instances == null) {
    throw new Exception("No Instances set");
  }

  // Add in some fields to the key like run number, dataset name
  Object[] seKey = m_SplitEvaluator.getKey();
  Object[] key = new Object[seKey.length + 2];
  key[0] = Utils.backQuoteChars(m_Instances.relationName());
  key[1] = "" + run;
  System.arraycopy(seKey, 0, key, 2, seKey.length);
  if (m_ResultListener.isResultRequired(this, key)) {
    try {
      m_ResultListener.acceptResult(this, key, null);
    } catch (Exception ex) {
      // Save the train and test datasets for debugging purposes?
      throw ex;
    }
  }
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:30,代碼來源:ExplicitTestsetResultProducer.java

示例2: doRunKeys

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Gets the keys for a specified run number. Different run numbers correspond
 * to different randomizations of the data. Keys produced should be sent to
 * the current ResultListener
 * 
 * @param run the run number to get keys for.
 * @throws Exception if a problem occurs while getting the keys
 */
@Override
public void doRunKeys(int run) throws Exception {
  if (m_Instances == null) {
    throw new Exception("No Instances set");
  }
  // Add in some fields to the key like run number, dataset name
  Object[] seKey = m_SplitEvaluator.getKey();
  Object[] key = new Object[seKey.length + 2];
  key[0] = Utils.backQuoteChars(m_Instances.relationName());
  key[1] = "" + run;
  System.arraycopy(seKey, 0, key, 2, seKey.length);
  if (m_ResultListener.isResultRequired(this, key)) {
    try {
      m_ResultListener.acceptResult(this, key, null);
    } catch (Exception ex) {
      // Save the train and test datasets for debugging purposes?
      throw ex;
    }
  }
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:29,代碼來源:RandomSplitResultProducer.java

示例3: doRunKeys

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Gets the keys for a specified run number. Different run numbers correspond
 * to different randomizations of the data. Keys produced should be sent to
 * the current ResultListener
 * 
 * @param run the run number to get keys for.
 * @throws Exception if a problem occurs while getting the keys
 */
@Override
public void doRunKeys(int run) throws Exception {
  if (m_Instances == null) {
    throw new Exception("No Instances set");
  }

  // Add in some fields to the key like run and fold number, dataset name
  Object[] seKey = m_SplitEvaluator.getKey();
  Object[] key = new Object[seKey.length + 3];
  key[0] = Utils.backQuoteChars(m_Instances.relationName());
  key[2] = "" + (((run - 1) % m_NumFolds) + 1);
  key[1] = "" + (((run - 1) / m_NumFolds) + 1);
  System.arraycopy(seKey, 0, key, 3, seKey.length);
  if (m_ResultListener.isResultRequired(this, key)) {
    try {
      m_ResultListener.acceptResult(this, key, null);
    } catch (Exception ex) {
      // Save the train and test datasets for debugging purposes?
      throw ex;
    }
  }
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:31,代碼來源:CrossValidationSplitResultProducer.java

示例4: toString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Gets a text descrption of the result producer.
 * 
 * @return a text description of the result producer.
 */
@Override
public String toString() {

  String result = "LearningRateResultProducer: ";
  result += getCompatibilityState();
  if (m_Instances == null) {
    result += ": <null Instances>";
  } else {
    result += ": " + Utils.backQuoteChars(m_Instances.relationName());
  }
  return result;
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:18,代碼來源:LearningRateResultProducer.java

示例5: toString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Gets a text descrption of the result producer.
 * 
 * @return a text description of the result producer.
 */
@Override
public String toString() {

  String result = "DatabaseResultProducer: ";
  result += getCompatibilityState();
  if (m_Instances == null) {
    result += ": <null Instances>";
  } else {
    result += ": " + Utils.backQuoteChars(m_Instances.relationName());
  }
  return result;
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:18,代碼來源:DatabaseResultProducer.java

示例6: doRunKeys

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Gets the keys for a specified run number. Different run numbers correspond
 * to different randomizations of the data. Keys produced should be sent to
 * the current ResultListener
 * 
 * @param run the run number to get keys for.
 * @throws Exception if a problem occurs while getting the keys
 */
@Override
public void doRunKeys(int run) throws Exception {
  if (m_Instances == null) {
    throw new Exception("No Instances set");
  }
  /*
   * // Randomize on a copy of the original dataset Instances runInstances =
   * new Instances(m_Instances); runInstances.randomize(new Random(run)); if
   * (runInstances.classAttribute().isNominal()) {
   * runInstances.stratify(m_NumFolds); }
   */
  for (int fold = 0; fold < m_NumFolds; fold++) {
    // Add in some fields to the key like run and fold number, dataset name
    Object[] seKey = m_SplitEvaluator.getKey();
    Object[] key = new Object[seKey.length + 3];
    key[0] = Utils.backQuoteChars(m_Instances.relationName());
    key[1] = "" + run;
    key[2] = "" + (fold + 1);
    System.arraycopy(seKey, 0, key, 3, seKey.length);
    if (m_ResultListener.isResultRequired(this, key)) {
      try {
        m_ResultListener.acceptResult(this, key, null);
      } catch (Exception ex) {
        // Save the train and test datasets for debugging purposes?
        throw ex;
      }
    }
  }
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:38,代碼來源:CrossValidationResultProducer.java

示例7: toString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Gets a text descrption of the result producer.
 * 
 * @return a text description of the result producer.
 */
@Override
public String toString() {

  String result = "CrossValidationResultProducer: ";
  result += getCompatibilityState();
  if (m_Instances == null) {
    result += ": <null Instances>";
  } else {
    result += ": " + Utils.backQuoteChars(m_Instances.relationName());
  }
  return result;
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:18,代碼來源:CrossValidationResultProducer.java

示例8: toString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Gets a text descrption of the result producer.
 * 
 * @return a text description of the result producer.
 */
@Override
public String toString() {
  String result = "ExplicitTestsetResultProducer: ";
  result += getCompatibilityState();
  if (m_Instances == null) {
    result += ": <null Instances>";
  } else {
    result += ": " + Utils.backQuoteChars(m_Instances.relationName());
  }
  return result;
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:17,代碼來源:ExplicitTestsetResultProducer.java

示例9: toString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Gets a text descrption of the result producer.
 * 
 * @return a text description of the result producer.
 */
@Override
public String toString() {

  String result = "RandomSplitResultProducer: ";
  result += getCompatibilityState();
  if (m_Instances == null) {
    result += ": <null Instances>";
  } else {
    result += ": " + Utils.backQuoteChars(m_Instances.relationName());
  }
  return result;
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:18,代碼來源:RandomSplitResultProducer.java

示例10: toString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Gets a text descrption of the result producer.
 * 
 * @return a text description of the result producer.
 */
@Override
public String toString() {

  String result = "AveragingResultProducer: ";
  result += getCompatibilityState();
  if (m_Instances == null) {
    result += ": <null Instances>";
  } else {
    result += ": " + Utils.backQuoteChars(m_Instances.relationName());
  }
  return result;
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:18,代碼來源:AveragingResultProducer.java

示例11: toString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Gets a text descrption of the result producer.
 * 
 * @return a text description of the result producer.
 */
@Override
public String toString() {

  String result = "CrossValidationSplitResultProducer: ";
  result += getCompatibilityState();
  if (m_Instances == null) {
    result += ": <null Instances>";
  } else {
    result += ": " + Utils.backQuoteChars(m_Instances.relationName());
  }
  return result;
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:18,代碼來源:CrossValidationSplitResultProducer.java

示例12: doRun

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Gets the results for a specified run number. Different run numbers
 * correspond to different randomizations of the data. Results produced should
 * be sent to the current ResultListener
 * 
 * @param run the run number to get results for.
 * @throws Exception if a problem occurs while getting the results
 */
@Override
public void doRun(int run) throws Exception {

  if (getRawOutput()) {
    if (m_ZipDest == null) {
      m_ZipDest = new OutputZipper(m_OutputFile);
    }
  }

  if (m_Instances == null) {
    throw new Exception("No Instances set");
  }
  // Randomize on a copy of the original dataset
  Instances runInstances = new Instances(m_Instances);
  Random random = new Random(run);
  runInstances.randomize(random);
  if (runInstances.classAttribute().isNominal()) {
    runInstances.stratify(m_NumFolds);
  }
  for (int fold = 0; fold < m_NumFolds; fold++) {
    // Add in some fields to the key like run and fold number, dataset name
    Object[] seKey = m_SplitEvaluator.getKey();
    Object[] key = new Object[seKey.length + 3];
    key[0] = Utils.backQuoteChars(m_Instances.relationName());
    key[1] = "" + run;
    key[2] = "" + (fold + 1);
    System.arraycopy(seKey, 0, key, 3, seKey.length);
    if (m_ResultListener.isResultRequired(this, key)) {
      Instances train = runInstances.trainCV(m_NumFolds, fold, random);
      Instances test = runInstances.testCV(m_NumFolds, fold);
      try {
        Object[] seResults = m_SplitEvaluator.getResult(train, test);
        Object[] results = new Object[seResults.length + 1];
        results[0] = getTimestamp();
        System.arraycopy(seResults, 0, results, 1, seResults.length);
        if (m_debugOutput) {
          String resultName = ("" + run + "." + (fold + 1) + "."
            + Utils.backQuoteChars(runInstances.relationName()) + "." + m_SplitEvaluator
            .toString()).replace(' ', '_');
          resultName = Utils.removeSubstring(resultName, "weka.classifiers.");
          resultName = Utils.removeSubstring(resultName, "weka.filters.");
          resultName = Utils.removeSubstring(resultName,
            "weka.attributeSelection.");
          m_ZipDest.zipit(m_SplitEvaluator.getRawResultOutput(), resultName);
        }
        m_ResultListener.acceptResult(this, key, results);
      } catch (Exception ex) {
        // Save the train and test datasets for debugging purposes?
        throw ex;
      }
    }
  }
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:62,代碼來源:CrossValidationResultProducer.java

示例13: doRun

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Gets the results for a specified run number. Different run numbers
 * correspond to different randomizations of the data. Results produced should
 * be sent to the current ResultListener
 * 
 * @param run the run number to get results for.
 * @throws Exception if a problem occurs while getting the results
 */
@Override
public void doRun(int run) throws Exception {

  if (getRawOutput()) {
    if (m_ZipDest == null) {
      m_ZipDest = new OutputZipper(m_OutputFile);
    }
  }

  if (m_Instances == null) {
    throw new Exception("No Instances set");
  }

  // Compute run and fold number from given run
  int fold = (run - 1) % m_NumFolds;
  run = ((run - 1) / m_NumFolds) + 1;

  // Randomize on a copy of the original dataset
  Instances runInstances = new Instances(m_Instances);
  Random random = new Random(run);
  runInstances.randomize(random);
  if (runInstances.classAttribute().isNominal()) {
    runInstances.stratify(m_NumFolds);
  }

  // Add in some fields to the key like run and fold number, dataset name
  Object[] seKey = m_SplitEvaluator.getKey();
  Object[] key = new Object[seKey.length + 3];
  key[0] = Utils.backQuoteChars(m_Instances.relationName());
  key[1] = "" + run;
  key[2] = "" + (fold + 1);
  System.arraycopy(seKey, 0, key, 3, seKey.length);
  if (m_ResultListener.isResultRequired(this, key)) {

    // Just to make behaviour absolutely consistent with
    // CrossValidationResultProducer
    for (int tempFold = 0; tempFold < fold; tempFold++) {
      runInstances.trainCV(m_NumFolds, tempFold, random);
    }

    Instances train = runInstances.trainCV(m_NumFolds, fold, random);
    Instances test = runInstances.testCV(m_NumFolds, fold);
    try {
      Object[] seResults = m_SplitEvaluator.getResult(train, test);
      Object[] results = new Object[seResults.length + 1];
      results[0] = getTimestamp();
      System.arraycopy(seResults, 0, results, 1, seResults.length);
      if (m_debugOutput) {
        String resultName = ("" + run + "." + (fold + 1) + "."
          + Utils.backQuoteChars(runInstances.relationName()) + "." + m_SplitEvaluator
          .toString()).replace(' ', '_');
        resultName = Utils.removeSubstring(resultName, "weka.classifiers.");
        resultName = Utils.removeSubstring(resultName, "weka.filters.");
        resultName = Utils.removeSubstring(resultName,
          "weka.attributeSelection.");
        m_ZipDest.zipit(m_SplitEvaluator.getRawResultOutput(), resultName);
      }
      m_ResultListener.acceptResult(this, key, results);
    } catch (Exception ex) {
      // Save the train and test datasets for debugging purposes?
      throw ex;
    }
  }
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:73,代碼來源:CrossValidationSplitResultProducer.java

示例14: getFieldSeparator

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Returns the character used as column separator.
 * 
 * @return the character to use
 */
public String getFieldSeparator() {
  return Utils.backQuoteChars(m_FieldSeparator);
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:9,代碼來源:CSVSaver.java

示例15: getFieldSeparator

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Returns the character used as column separator.
 *
 * @return the character to use
 */
public String getFieldSeparator() {
  return Utils.backQuoteChars(m_FieldSeparator);
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:9,代碼來源:CSVLoader.java


注:本文中的weka.core.Utils.backQuoteChars方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。