亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? evaluation.java

?? 一個(gè)數(shù)據(jù)挖掘系統(tǒng)的源碼
?? JAVA
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):

/**
 *
 *   AgentAcademy - an open source Data Mining framework for
 *   training intelligent agents
 *
 *   Copyright (C)   2001-2003 AA Consortium.
 *
 *   This library is open source software; you can redistribute it
 *   and/or modify it under the terms of the GNU Lesser General
 *   Public License as published by the Free Software Foundation;
 *   either version 2.0 of the License, or (at your option) any later
 *   version.
 *
 *   This library is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU Lesser General Public
 *   License along with this library; if not, write to the Free
 *   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *   MA  02111-1307 USA
 *
 */

package org.agentacademy.modules.dataminer.classifiers.evaluation;

/**
 * <p>Title: The Data Miner prototype</p>
 * <p>Description: A prototype for the DataMiner (DM), the Agent Academy (AA) module responsible for performing data mining on the contents of the Agent Use Repository (AUR). The extracted knowledge is to be sent back to the AUR in the form of a PMML document.</p>
 * <p>Copyright: Copyright (c) 2002</p>
 * <p>Company: CERTH</p>
 * @author asymeon
 * @version 0.3
 */

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.util.Enumeration;
import java.util.Random;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

import org.agentacademy.modules.dataminer.core.Drawable;
import org.agentacademy.modules.dataminer.core.Instance;
import org.agentacademy.modules.dataminer.core.Instances;
import org.agentacademy.modules.dataminer.core.Option;
import org.agentacademy.modules.dataminer.core.OptionHandler;
import org.agentacademy.modules.dataminer.core.Range;
import org.agentacademy.modules.dataminer.core.Summarizable;
import org.agentacademy.modules.dataminer.core.Utils;

import org.jdom.Document;
import org.jdom.input.SAXBuilder;

import weka.estimators.Estimator;
import weka.estimators.KernelEstimator;

/**
 * Class for evaluating machine learning models. <p>
 *
 * ------------------------------------------------------------------- <p>
 *
 * General options when evaluating a learning scheme from the command-line: <p>
 *
 * -t filename <br>
 * Name of the file with the training data. (required) <p>
 *
 * -T filename <br>
 * Name of the file with the test data. If missing a cross-validation
 * is performed. <p>
 *
 * -c index <br>
 * Index of the class attribute (1, 2, ...; default: last). <p>
 *
 * -x number <br>
 * The number of folds for the cross-validation (default: 10). <p>
 *
 * -s seed <br>
 * Random number seed for the cross-validation (default: 1). <p>
 *
 * -m filename <br>
 * The name of a file containing a cost matrix. <p>
 *
 * -l filename <br>
 * Loads classifier from the given file. <p>
 *
 * -d filename <br>
 * Saves classifier built from the training data into the given file. <p>
 *
 * -v <br>
 * Outputs no statistics for the training data. <p>
 *
 * -o <br>
 * Outputs statistics only, not the classifier. <p>
 *
 * -i <br>
 * Outputs information-retrieval statistics per class. <p>
 *
 * -k <br>
 * Outputs information-theoretic statistics. <p>
 *
 * -p range <br>
 * Outputs predictions for test instances, along with the attributes in
 * the specified range (and nothing else). Use '-p 0' if no attributes are
 * desired. <p>
 *
 * -r <br>
 * Outputs cumulative margin distribution (and nothing else). <p>
 *
 * -g <br>
 * Only for classifiers that implement "Graphable." Outputs
 * the graph representation of the classifier (and nothing
 * else). <p>
 *
 * ------------------------------------------------------------------- <p>
 *
 * Example usage as the main of a classifier (called FunkyClassifier):
 * <code> <pre>
 * public static void main(String [] args) {
 *   try {
 *     Classifier scheme = new FunkyClassifier();
 *     System.out.println(Evaluation.evaluateModel(scheme, args));
 *   } catch (Exception e) {
 *     System.err.println(e.getMessage());
 *   }
 * }
 * </pre> </code>
 * <p>
 *
 * ------------------------------------------------------------------ <p>
 *
 * Example usage from within an application:
 * <code> <pre>
 * Instances trainInstances = ... instances got from somewhere
 * Instances testInstances = ... instances got from somewhere
 * Classifier scheme = ... scheme got from somewhere
 *
 * Evaluation evaluation = new Evaluation(trainInstances);
 * evaluation.evaluateModel(scheme, testInstances);
 * System.out.println(evaluation.toSummaryString());
 * </pre> </code>
 */
public class Evaluation implements Summarizable {

  /** The number of classes. */
  private int m_NumClasses;

  /** The number of folds for a cross-validation. */
  private int m_NumFolds;

  /** The weight of all incorrectly classified instances. */
  private double m_Incorrect;

  /** The weight of all correctly classified instances. */
  private double m_Correct;

  /** The weight of all unclassified instances. */
  private double m_Unclassified;

  /*** The weight of all instances that had no class assigned to them. */
  private double m_MissingClass;

  /** The weight of all instances that had a class assigned to them. */
  private double m_WithClass;

  /** Array for storing the confusion matrix. */
  private double [][] m_ConfusionMatrix;

  /** The names of the classes. */
  private String [] m_ClassNames;

  /** Is the class nominal or numeric? */
  private boolean m_ClassIsNominal;

  /** The prior probabilities of the classes */
  private double [] m_ClassPriors;

  /** The sum of counts for priors */
  private double m_ClassPriorsSum;

  /** The cost matrix (if given). */
  private CostMatrix m_CostMatrix;

  /** The total cost of predictions (includes instance weights) */
  private double m_TotalCost;

  /** Sum of errors. */
  private double m_SumErr;

  /** Sum of absolute errors. */
  private double m_SumAbsErr;

  /** Sum of squared errors. */
  private double m_SumSqrErr;

  /** Sum of class values. */
  private double m_SumClass;

  /** Sum of squared class values. */
  private double m_SumSqrClass;

  /*** Sum of predicted values. */
  private double m_SumPredicted;

  /** Sum of squared predicted values. */
  private double m_SumSqrPredicted;

  /** Sum of predicted * class values. */
  private double m_SumClassPredicted;

  /** Sum of absolute errors of the prior */
  private double m_SumPriorAbsErr;

  /** Sum of absolute errors of the prior */
  private double m_SumPriorSqrErr;

  /** Total Kononenko & Bratko Information */
  private double m_SumKBInfo;

  /*** Resolution of the margin histogram */
  private static int k_MarginResolution = 500;

  /** Cumulative margin distribution */
  private double m_MarginCounts [];

  /** Number of non-missing class training instances seen */
  private int m_NumTrainClassVals;

  /** Array containing all numeric training class values seen */
  private double [] m_TrainClassVals;

  /** Array containing all numeric training class weights */
  private double [] m_TrainClassWeights;

  /** Numeric class error estimator for prior */
  private Estimator m_PriorErrorEstimator;

  /** Numeric class error estimator for scheme */
  private Estimator m_ErrorEstimator;

  /**
   * The minimum probablility accepted from an estimator to avoid
   * taking log(0) in Sf calculations.
   */
  private static final double MIN_SF_PROB = Double.MIN_VALUE;

  /** Total entropy of prior predictions */
  private double m_SumPriorEntropy;

  /** Total entropy of scheme predictions */
  private double m_SumSchemeEntropy;

  /**
   * Initializes all the counters for the evaluation.
   *
   * @param data set of training instances, to get some header
   * information and prior class distribution information
   * @exception Exception if the class is not defined
   */
  public Evaluation(Instances data) throws Exception {

    this(data, null);
  }

  /**
   * Initializes all the counters for the evaluation and also takes a
   * cost matrix as parameter.
   *
   * @param data set of instances, to get some header information
   * @param costMatrix the cost matrix---if null, default costs will be used
   * @exception Exception if cost matrix is not compatible with
   * data, the class is not defined or the class is numeric
   */
  public Evaluation(Instances data, CostMatrix costMatrix)
       throws Exception {

    m_NumClasses = data.numClasses();
    m_NumFolds = 1;
    m_ClassIsNominal = data.classAttribute().isNominal();

    if (m_ClassIsNominal) {
      m_ConfusionMatrix = new double [m_NumClasses][m_NumClasses];
      m_ClassNames = new String [m_NumClasses];
      for(int i = 0; i < m_NumClasses; i++) {
	m_ClassNames[i] = data.classAttribute().value(i);
      }
    }
    m_CostMatrix = costMatrix;
    if (m_CostMatrix != null) {
      if (!m_ClassIsNominal) {
	throw new Exception("Class has to be nominal if cost matrix " +
			    "given!");
      }
      if (m_CostMatrix.size() != m_NumClasses) {
	throw new Exception("Cost matrix not compatible with data!");
      }
    }
    m_ClassPriors = new double [m_NumClasses];
    setPriors(data);
    m_MarginCounts = new double [k_MarginResolution + 1];
  }

  /**
   * Returns a copy of the confusion matrix.
   *
   * @return a copy of the confusion matrix as a two-dimensional array
   */
  public double[][] confusionMatrix() {

    double[][] newMatrix = new double[m_ConfusionMatrix.length][0];

    for (int i = 0; i < m_ConfusionMatrix.length; i++) {
      newMatrix[i] = new double[m_ConfusionMatrix[i].length];
      System.arraycopy(m_ConfusionMatrix[i], 0, newMatrix[i], 0,
		       m_ConfusionMatrix[i].length);
    }
    return newMatrix;
  }

  /**
   * Performs a (stratified if class is nominal) cross-validation
   * for a classifier on a set of instances.
   *
   * @param classifier the classifier with any options set.
   * @param data the data on which the cross-validation is to be
   * performed
   * @param numFolds the number of folds for the cross-validation
   * @exception Exception if a classifier could not be generated
   * successfully or the class is not defined
   */
  public void crossValidateModel(Classifier classifier,
				 Instances data, int numFolds)
    throws Exception {

    // Make a copy of the data we can reorder
    data = new Instances(data);
    if (data.classAttribute().isNominal()) {
      data.stratify(numFolds);
    }
    // Do the folds
    for (int i = 0; i < numFolds; i++) {
      Instances train = data.trainCV(numFolds, i);
      setPriors(train);
      classifier.buildClassifier(train);
      Instances test = data.testCV(numFolds, i);
      evaluateModel(classifier, test);
    }
    m_NumFolds = numFolds;
  }

  /**
   * Performs a (stratified if class is nominal) cross-validation
   * for a classifier on a set of instances.
   *
   * @param classifier a string naming the class of the classifier
   * @param data the data on which the cross-validation is to be
   * performed
   * @param numFolds the number of folds for the cross-validation
   * @param options the options to the classifier. Any options
   * accepted by the classifier will be removed from this array.
   * @exception Exception if a classifier could not be generated
   * successfully or the class is not defined
   */
  public void crossValidateModel(String classifierString,
				 Instances data, int numFolds,
				 String[] options)

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
激情五月婷婷综合| 欧美精品一区二区三区高清aⅴ| 成人av资源下载| 国产九色sp调教91| 国产精品一区二区在线观看网站| 久久成人18免费观看| 日韩av中文字幕一区二区| 日本v片在线高清不卡在线观看| 日本不卡高清视频| 韩国三级电影一区二区| 另类欧美日韩国产在线| 国产综合久久久久久鬼色| 国产精品中文字幕日韩精品 | 国产精品久久久久久久久晋中 | 久久久高清一区二区三区| 久久综合一区二区| wwwwww.欧美系列| 国产精品人妖ts系列视频| 亚洲视频在线观看三级| 一区二区在线看| 视频在线观看一区二区三区| 美腿丝袜在线亚洲一区 | 欧美成人aa大片| 精品美女在线观看| 国产精品无人区| 一区二区三区精品在线观看| 亚洲成人福利片| 全部av―极品视觉盛宴亚洲| 国产精品亚洲一区二区三区妖精| 大尺度一区二区| 欧美性xxxxx极品少妇| 91精品国产色综合久久| 精品粉嫩超白一线天av| 国产精品二三区| 亚洲一区免费视频| 久久精品国产亚洲5555| 成人激情动漫在线观看| 欧美日韩在线观看一区二区 | 亚洲精品一卡二卡| 美女一区二区视频| 大美女一区二区三区| 欧美三级蜜桃2在线观看| 精品久久久久久最新网址| 中文乱码免费一区二区| 午夜视频一区在线观看| 国产精品一区二区三区四区| 色天使久久综合网天天| 欧美变态tickle挠乳网站| 亚洲少妇最新在线视频| 久久精品国产精品亚洲红杏| 不卡电影一区二区三区| 日韩一区二区在线观看视频 | 视频精品一区二区| 国产99久久久国产精品潘金| 欧美综合一区二区| 久久精品在线观看| 日韩精品一级中文字幕精品视频免费观看| 国产精品一区在线观看乱码| 欧美日韩高清一区| 国产精品毛片无遮挡高清| 日本大胆欧美人术艺术动态| 91麻豆免费在线观看| wwww国产精品欧美| 天天av天天翘天天综合网色鬼国产| 国产精品一区二区无线| 欧美日韩不卡在线| 亚洲卡通欧美制服中文| 国产黄色精品视频| 日韩一二三区视频| 亚洲国产精品一区二区久久恐怖片 | 成人午夜精品一区二区三区| 欧美精品一二三四| 亚洲欧美日韩在线| 国产成人免费在线视频| 日韩免费高清电影| 亚洲在线视频免费观看| eeuss鲁片一区二区三区在线观看| 日韩欧美国产高清| 日韩主播视频在线| 在线亚洲人成电影网站色www| 国产亚洲一区字幕| 国模少妇一区二区三区| 欧美一区二区三区婷婷月色| 亚洲国产视频直播| 色偷偷成人一区二区三区91| 国产精品福利一区二区三区| 国产成人精品综合在线观看 | 亚洲欧洲精品一区二区三区不卡 | 欧美不卡一区二区三区四区| 视频精品一区二区| 欧美日本国产视频| 亚洲高清不卡在线观看| 色婷婷久久久久swag精品| 亚洲美女一区二区三区| 99re8在线精品视频免费播放| 日本一区二区三区高清不卡| 国产一区二区三区日韩| 日韩欧美久久久| 三级亚洲高清视频| 在线综合视频播放| 日韩 欧美一区二区三区| 91麻豆精品国产| 日日夜夜一区二区| 日韩一卡二卡三卡| 久久精品国内一区二区三区| 精品国内片67194| 国产一区在线观看视频| 久久这里只有精品视频网| 国产精品一区二区免费不卡| 中文字幕精品综合| 色婷婷综合五月| 亚洲国产精品人人做人人爽| 欧美日本在线播放| 日本成人中文字幕在线视频| 精品久久久久av影院| 国产一区二区三区电影在线观看 | 蜜臀va亚洲va欧美va天堂| 日韩精品最新网址| 国产精品一二三| 日韩理论片网站| 欧美日精品一区视频| 日本v片在线高清不卡在线观看| 日韩免费一区二区三区在线播放| 黑人巨大精品欧美一区| 亚洲国产精品国自产拍av| 色综合天天在线| 性欧美疯狂xxxxbbbb| 精品久久久久久久久久久院品网| 国产白丝精品91爽爽久久| 亚洲三级电影网站| 3atv一区二区三区| 国产不卡免费视频| 亚洲国产精品一区二区www| 日韩女优电影在线观看| 丰满亚洲少妇av| 亚洲一区二区免费视频| 精品日韩在线观看| 99在线视频精品| 日韩高清在线一区| 久久精品视频一区二区三区| 色综合天天综合网国产成人综合天 | 国产精品系列在线观看| 亚洲视频 欧洲视频| 91精品欧美一区二区三区综合在 | 精品久久久久久久久久久久久久久| 国产精品一区二区三区网站| 亚洲精品五月天| 日韩欧美国产一区二区三区| jvid福利写真一区二区三区| 日本中文字幕一区二区有限公司| 久久久精品免费免费| 欧美在线观看视频在线| 国产精品18久久久久| 亚洲国产综合在线| 国产欧美日韩另类视频免费观看| 欧美少妇bbb| 不卡的av电影| 精品无人码麻豆乱码1区2区| 亚洲三级在线观看| 久久精品一区二区三区av| 色噜噜偷拍精品综合在线| 国内精品在线播放| 亚洲成人av电影在线| 中文一区二区在线观看| 欧美一区二区在线观看| 91免费版pro下载短视频| 久草热8精品视频在线观看| 一区二区三区久久久| 欧美激情综合五月色丁香| 欧美一区二区私人影院日本| 91毛片在线观看| 国产mv日韩mv欧美| 麻豆一区二区三| 亚洲 欧美综合在线网络| 亚洲欧洲一区二区三区| 久久久久久久久久久久电影 | 又紧又大又爽精品一区二区| 2020国产成人综合网| 欧美日本一区二区在线观看| 色综合天天综合给合国产| 粉嫩蜜臀av国产精品网站| 精油按摩中文字幕久久| 日韩精品高清不卡| 亚洲一级二级三级| 综合久久国产九一剧情麻豆| 国产日韩一级二级三级| 精品国产乱子伦一区| 宅男噜噜噜66一区二区66| 欧美日韩一区二区在线视频| 一本色道久久综合精品竹菊| 成人午夜短视频| 国产福利不卡视频| 国产乱淫av一区二区三区| 蜜乳av一区二区| 天天综合色天天| 日韩极品在线观看| 日本aⅴ免费视频一区二区三区 | 国产精品一区二区久激情瑜伽| 日韩电影在线免费| 日韩高清在线一区|