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


Java Utils.doubleToString方法代碼示例

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


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

示例1: toString

import weka.core.Utils; //導入方法依賴的package包/類
/** Display a representation of this estimator */
@Override
public String toString() {

  String result = m_NumValues + " Normal Kernels. \nStandardDev = "
      + Utils.doubleToString(m_StandardDev, 6, 4) + " Precision = "
      + m_Precision;
  if (m_NumValues == 0) {
    result += "  \nMean = 0";
  } else {
    result += "  \nMeans =";
    for (int i = 0; i < m_NumValues; i++) {
      result += " " + m_Values[i];
    }
    if (!m_AllWeightsOne) {
      result += "\nWeights = ";
      for (int i = 0; i < m_NumValues; i++) {
        result += " " + m_Weights[i];
      }
    }
  }
  return result + "\n";
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:24,代碼來源:KernelEstimator.java

示例2: toCumulativeMarginDistributionString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Output the cumulative margin distribution as a string suitable for input
 * for gnuplot or similar package.
 * 
 * @return the cumulative margin distribution
 * @throws Exception if the class attribute is nominal
 */
public String toCumulativeMarginDistributionString() throws Exception {

  if (!m_ClassIsNominal) {
    throw new Exception("Class must be nominal for margin distributions");
  }
  String result = "";
  double cumulativeCount = 0;
  double margin;
  for (int i = 0; i <= k_MarginResolution; i++) {
    if (m_MarginCounts[i] != 0) {
      cumulativeCount += m_MarginCounts[i];
      margin = i * 2.0 / k_MarginResolution - 1.0;
      result =
        result + Utils.doubleToString(margin, 7, 3) + ' '
          + Utils.doubleToString(cumulativeCount * 100 / m_WithClass, 7, 3)
          + '\n';
    } else if (i == 0) {
      result =
        Utils.doubleToString(-1.0, 7, 3) + ' '
          + Utils.doubleToString(0, 7, 3) + '\n';
    }
  }
  return result;
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:32,代碼來源:Evaluation.java

示例3: doubleToString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * returns the given number as string rounded to the given number of decimals.
 * additional necessary 0's are added.
 * 
 * @param d the number to format
 * @param prec the number of decimals after the point
 * @return the formatted number
 */
protected String doubleToString(double d, int prec) {
  String result;
  int currentPrec;
  int i;

  result = Utils.doubleToString(d, prec);

  // decimal point?
  if (result.indexOf(".") == -1) {
    result += ".";
  }

  // precision so far?
  currentPrec = result.length() - result.indexOf(".") - 1;
  for (i = currentPrec; i < prec; i++) {
    result += "0";
  }

  return result;
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:29,代碼來源:ResultMatrix.java

示例4: toString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Returns a string summarising the stats so far.
 *
 * @return the summary string
 */
public String toString() {

  return
    "Count   " + Utils.doubleToString(count, 8) + '\n'
    + "Min     " + Utils.doubleToString(min, 8) + '\n'
    + "Max     " + Utils.doubleToString(max, 8) + '\n'
    + "Sum     " + Utils.doubleToString(sum, 8) + '\n'
    + "SumSq   " + Utils.doubleToString(sumSq, 8) + '\n'
    + "Mean    " + Utils.doubleToString(mean, 8) + '\n'
    + "StdDev  " + Utils.doubleToString(stdDev, 8) + '\n';
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:17,代碼來源:Stats.java

示例5: leafString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Outputs a leaf.
 * 
 * @return the leaf as string
 * @throws Exception if generation fails
 */
protected String leafString() throws Exception {

  double sum = 0, maxCount = 0;
  int maxIndex = 0;
  double classMean = 0;
  double avgError = 0;
  if (m_ClassDistribution != null) {
    if (m_Info.classAttribute().isNominal()) {
      sum = Utils.sum(m_ClassDistribution);
      maxIndex = Utils.maxIndex(m_ClassDistribution);
      maxCount = m_ClassDistribution[maxIndex];
    } else {
      classMean = m_ClassDistribution[0];
      if (m_Distribution[1] > 0) {
        avgError = m_Distribution[0] / m_Distribution[1];
      }
    }
  }

  if (m_Info.classAttribute().isNumeric()) {
    return " : " + Utils.doubleToString(classMean, 2) + " ("
      + Utils.doubleToString(m_Distribution[1], 2) + "/"
      + Utils.doubleToString(avgError, 2) + ")";
  }

  return " : " + m_Info.classAttribute().value(maxIndex) + " ("
    + Utils.doubleToString(sum, 2) + "/"
    + Utils.doubleToString(sum - maxCount, 2) + ")";
}
 
開發者ID:seqcode,項目名稱:seqcode-core,代碼行數:36,代碼來源:AttributeRandomTree.java

示例6: drawHeatMap

import weka.core.Utils; //導入方法依賴的package包/類
private void drawHeatMap(Graphics2D chartGraphics, double[][] data) {
  // Calculate the available size for the heatmap.
  int noYCells = data.length;
  int noXCells = data[0].length;

  // double dataMin = min(data);
  // double dataMax = max(data);

  BufferedImage heatMapImage =
    new BufferedImage(heatMapSize.width, heatMapSize.height,
      BufferedImage.TYPE_INT_ARGB);
  Graphics2D heatMapGraphics = heatMapImage.createGraphics();

  heatMapGraphics.setFont(getAxisValuesFont());
  FontMetrics tempMetrics = heatMapGraphics.getFontMetrics();
  for (int x = 0; x < noXCells; x++) {
    for (int y = 0; y < noYCells; y++) {
      // Set colour depending on zValues.
      heatMapGraphics
        .setColor(getCellColour(data[y][x], lowValue, highValue));

      int cellX = x * cellSize.width;
      int cellY = y * cellSize.height;

      heatMapGraphics.fillRect(cellX, cellY, cellSize.width, cellSize.height);
      String cellVal = Utils.doubleToString(data[y][x], 2);
      heatMapGraphics.setColor(Color.white);
      heatMapGraphics.drawString(cellVal, cellX, cellY
        + (cellSize.height / 2) + (yAxisValuesAscent / 2));
    }
  }

  // Draw the heat map onto the chart.
  chartGraphics.drawImage(heatMapImage, heatMapTL.x, heatMapTL.y,
    heatMapSize.width, heatMapSize.height, null);
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:37,代碼來源:HeatChart.java

示例7: toString

import weka.core.Utils; //導入方法依賴的package包/類
/** Display a representation of this estimator */
@Override
public String toString() {

  if (m_Covariance == null) {
    calculateCovariance();
  }
  String result = "NN Conditional Estimator. " + m_CondValues.size()
    + " data points.  Mean = " + Utils.doubleToString(m_ValueMean, 4, 2)
    + "  Conditional mean = " + Utils.doubleToString(m_CondMean, 4, 2);
  result += "  Covariance Matrix: \n" + m_Covariance;
  return result;
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:14,代碼來源:NNConditionalEstimator.java

示例8: toString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Returns description of the bias-variance decomposition results.
 *
 * @return the bias-variance decomposition results as a string
 */
public String toString() {

    String result = "\nBias-Variance Decomposition Segmentation, Cross Validation\n" +
    "with subsampling.\n";

    if (getClassifier() == null) {
        return "Invalid setup";
    }

    result += "\nClassifier    : " + getClassifier().getClass().getName();
    if (getClassifier() instanceof OptionHandler) {
        result += Utils.joinOptions(((OptionHandler)m_Classifier).getOptions());
    }
    result += "\nData File     : " + getDataFileName();
    result += "\nClass Index   : ";
    if (getClassIndex() == 0) {
        result += "last";
    } else {
        result += getClassIndex();
    }
    result += "\nIterations    : " + getClassifyIterations();
    result += "\np             : " + getP();
    result += "\nTraining Size : " + getTrainSize();
    result += "\nSeed          : " + getSeed();

    result += "\n\nDefinition   : " +"Kohavi and Wolpert";
    result += "\nError         :" + Utils.doubleToString(getError(), 4);
    result += "\nBias^2        :" + Utils.doubleToString(getKWBias(), 4);
    result += "\nVariance      :" + Utils.doubleToString(getKWVariance(), 4);
    result += "\nSigma^2       :" + Utils.doubleToString(getKWSigma(), 4);

    result += "\n\nDefinition   : " +"Webb";
    result += "\nError         :" + Utils.doubleToString(getError(), 4);
    result += "\nBias          :" + Utils.doubleToString(getWBias(), 4);
    result += "\nVariance      :" + Utils.doubleToString(getWVariance(), 4);

    return result;
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:44,代碼來源:BVDecomposeSegCVSub.java

示例9: toString

import weka.core.Utils; //導入方法依賴的package包/類
/** Display a representation of this estimator */
public String toString() {
  
  if (m_CovarianceInverse == null) {
    return "No covariance inverse\n";
  }
  return "Mahalanovis Distribution. Mean = "
  + Utils.doubleToString(m_ValueMean, 4, 2)
  + "  ConditionalOffset = "
  + Utils.doubleToString(m_ConstDelta, 4, 2) + "\n"
  + "Covariance Matrix: Determinant = " + m_Determinant 
  + "  Inverse:\n" + m_CovarianceInverse;
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:14,代碼來源:MahalanobisEstimator.java

示例10: toString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Display a representation of this estimator
 */
@Override
public String toString() {

  return "Normal Distribution. Mean = " + Utils.doubleToString(m_Mean, 4)
      + " StandardDev = " + Utils.doubleToString(m_StandardDev, 4)
      + " WeightSum = " + Utils.doubleToString(m_SumOfWeights, 4)
      + " Precision = " + m_Precision + "\n";
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:12,代碼來源:NormalEstimator.java

示例11: toString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Returns description of the bias-variance decomposition results.
 *
 * @return the bias-variance decomposition results as a string
 */
public String toString() {

  String result = "\nBias-Variance Decomposition\n";

  if (getClassifier() == null) {
    return "Invalid setup";
  }

  result += "\nClassifier   : " + getClassifier().getClass().getName();
  if (getClassifier() instanceof OptionHandler) {
    result += Utils.joinOptions(((OptionHandler)m_Classifier).getOptions());
  }
  result += "\nData File    : " + getDataFileName();
  result += "\nClass Index  : ";
  if (getClassIndex() == 0) {
    result += "last";
  } else {
    result += getClassIndex();
  }
  result += "\nTraining Pool: " + getTrainPoolSize();
  result += "\nIterations   : " + getTrainIterations();
  result += "\nSeed         : " + getSeed();
  result += "\nError        : " + Utils.doubleToString(getError(), 6, 4);
  result += "\nSigma^2      : " + Utils.doubleToString(getSigma(), 6, 4);
  result += "\nBias^2       : " + Utils.doubleToString(getBias(), 6, 4);
  result += "\nVariance     : " + Utils.doubleToString(getVariance(), 6, 4);

  return result + "\n";
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:35,代碼來源:BVDecompose.java

示例12: toString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Returns statistics on the paired comparison.
 *
 * @return the t-test statistics as a string
 */
public String toString() {

  return "Analysis for " + Utils.doubleToString(count, 0)
    + " points:\n"
    + "                "
    + "         Column 1"
    + "         Column 2"
    + "       Difference\n"
    + "Minimums        "
    + Utils.doubleToString(xStats.min, 17, 4)
    + Utils.doubleToString(yStats.min, 17, 4)
    + Utils.doubleToString(differencesStats.min, 17, 4) + '\n'
    + "Maximums        "
    + Utils.doubleToString(xStats.max, 17, 4)
    + Utils.doubleToString(yStats.max, 17, 4)
    + Utils.doubleToString(differencesStats.max, 17, 4) + '\n'
    + "Sums            "
    + Utils.doubleToString(xStats.sum, 17, 4)
    + Utils.doubleToString(yStats.sum, 17, 4)
    + Utils.doubleToString(differencesStats.sum, 17, 4) + '\n'
    + "SumSquares      "
    + Utils.doubleToString(xStats.sumSq, 17, 4)
    + Utils.doubleToString(yStats.sumSq, 17, 4)
    + Utils.doubleToString(differencesStats.sumSq, 17, 4) + '\n'
    + "Means           "
    + Utils.doubleToString(xStats.mean, 17, 4)
    + Utils.doubleToString(yStats.mean, 17, 4)
    + Utils.doubleToString(differencesStats.mean, 17, 4) + '\n'
    + "SDs             "
    + Utils.doubleToString(xStats.stdDev, 17, 4)
    + Utils.doubleToString(yStats.stdDev, 17, 4)
    + Utils.doubleToString(differencesStats.stdDev, 17, 4) + '\n'
    + "Prob(differences) "
    + Utils.doubleToString(differencesProbability, 4)
    + " (sigflag " + differencesSignificance + ")\n"
    + "Correlation       "
    + Utils.doubleToString(correlation,4) + "\n";
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:44,代碼來源:PairedStats.java

示例13: toStringMetric

import weka.core.Utils; //導入方法依賴的package包/類
public String toStringMetric(int premiseSupport, int consequenceSupport,
    int totalSupport, int totalTransactions) {
  return m_stringVal + ":(" + Utils.doubleToString(compute(premiseSupport, consequenceSupport,
      totalSupport, totalTransactions), 2) + ")";
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:6,代碼來源:DefaultAssociationRule.java

示例14: setNumeric

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Sets the legend to be for a numeric variable
 */
protected void setNumeric() {
  m_isNumeric = true;
  /*
   * m_maxC = mxC; m_minC = mnC;
   */

  double min = Double.POSITIVE_INFINITY;
  double max = Double.NEGATIVE_INFINITY;
  double value;

  for (int i = 0; i < m_Instances.numInstances(); i++) {
    if (!m_Instances.instance(i).isMissing(m_cIndex)) {
      value = m_Instances.instance(i).value(m_cIndex);
      if (value < min) {
        min = value;
      }
      if (value > max) {
        max = value;
      }
    }
  }

  // handle case where all values are missing
  if (min == Double.POSITIVE_INFINITY) {
    min = max = 0.0;
  }

  m_minC = min;
  m_maxC = max;

  int whole = (int) Math.abs(m_maxC);
  double decimal = Math.abs(m_maxC) - whole;
  int nondecimal;
  nondecimal = (whole > 0) ? (int) (Math.log(whole) / Math.log(10)) : 1;

  m_precisionC = (decimal > 0) ? (int) Math
    .abs(((Math.log(Math.abs(m_maxC)) / Math.log(10)))) + 2 : 1;
  if (m_precisionC > VisualizeUtils.MAX_PRECISION) {
    m_precisionC = 1;
  }

  String maxStringC = Utils.doubleToString(m_maxC, nondecimal + 1
    + m_precisionC, m_precisionC);
  if (m_labelMetrics != null) {
    m_HorizontalPad = m_labelMetrics.stringWidth(maxStringC);
  }

  whole = (int) Math.abs(m_minC);
  decimal = Math.abs(m_minC) - whole;
  nondecimal = (whole > 0) ? (int) (Math.log(whole) / Math.log(10)) : 1;

  m_precisionC = (decimal > 0) ? (int) Math
    .abs(((Math.log(Math.abs(m_minC)) / Math.log(10)))) + 2 : 1;
  if (m_precisionC > VisualizeUtils.MAX_PRECISION) {
    m_precisionC = 1;
  }

  maxStringC = Utils.doubleToString(m_minC, nondecimal + 1 + m_precisionC,
    m_precisionC);
  if (m_labelMetrics != null) {
    if (m_labelMetrics.stringWidth(maxStringC) > m_HorizontalPad) {
      m_HorizontalPad = m_labelMetrics.stringWidth(maxStringC);
    }
  }

  setOn(true);
  this.repaint();
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:72,代碼來源:ClassPanel.java

示例15: toString

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Prints this antecedent
 * 
 * @return a textual description of this antecedent
 */
@Override
public String toString() {
  String symbol = ((int) value == 0) ? " <= " : " >= ";
  return (att.name() + symbol + Utils.doubleToString(splitPoint, 6));
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:11,代碼來源:JRip.java


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