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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? evaluation.java

?? 一個數(shù)據(jù)挖掘系統(tǒng)的源碼
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:
       throws Exception {

    crossValidateModel(Classifier.forName(classifierString, options),
		       data, numFolds);
  }

  /**
   * Evaluates a classifier with the options given in an array of
   * strings. <p>
   *
   * Valid options are: <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 detailed 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>
   *
   * @param classifierString class of machine learning classifier as a string
   * @param options the array of string containing the options
   * @exception Exception if model could not be evaluated successfully
   * @return a string describing the results
   */
  public static String evaluateModel(String classifierString,
				     String [] options) throws Exception {

    Classifier classifier;

    // Create classifier
    try {
      classifier =
      (Classifier)Class.forName(classifierString).newInstance();
    } catch (Exception e) {
      throw new Exception("Can't find class with name "
			  + classifierString + '.');
    }
    return evaluateModel(classifier, options);
  }

  /**
   * A test method for this class. Just extracts the first command line
   * argument as a classifier class name and calls evaluateModel.
   * @param args an array of command line arguments, the first of which
   * must be the class name of a classifier.
   */
/*
  public static void main(String [] args) {

    try {
      if (args.length == 0) {
	throw new Exception("The first argument must be the class name"
2			    + " of a classifier");
      }
      String classifier = args[0];
      args[0] = "";
      System.out.println(evaluateModel(classifier, args));
    } catch (Exception ex) {
      ex.printStackTrace();
      System.err.println(ex.getMessage());
    }
  }
*/
  /**
   * Evaluates a classifier with the options given in an array of
   * strings. <p>
   *
   * Valid options are: <p>
   *
   * -t name of training file <br>
   * Name of the file with the training data. (required) <p>
   *
   * -T name of test file <br>
   * Name of the file with the test data. If missing a cross-validation
   * is performed. <p>
   *
   * -c class index <br>
   * Index of the class attribute (1, 2, ...; default: last). <p>
   *
   * -x number of folds <br>
   * The number of folds for the cross-validation (default: 10). <p>
   *
   * -s random number seed <br>
   * Random number seed for the cross-validation (default: 1). <p>
   *
   * -m file with cost matrix <br>
   * The name of a file containing a cost matrix. <p>
   *
   * -l name of model input file <br>
   * Loads classifier from the given file. <p>
   *
   * -d name of model output file <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 detailed information-retrieval statistics per class. <p>
   *
   * -k <br>
   * Outputs information-theoretic statistics. <p>
   *
   * -p <br>
   * Outputs predictions for test instances (and nothing else). <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>
   *
   * @param classifier machine learning classifier
   * @param options the array of string containing the options
   * @exception Exception if model could not be evaluated successfully
   * @return a string describing the results */

  public static String evaluateModel(Classifier classifier,
				     String [] options) throws Exception {

    Instances train = null, tempTrain, test = null, template = null;
    int seed = 1, folds = 10, classIndex = -1;
    String trainFileName, testFileName, sourceClass,
      classIndexString, seedString, foldsString, objectInputFileName,
      objectOutputFileName, attributeRangeString;
    boolean IRstatistics = false, noOutput = false,
      printClassifications = false, trainStatistics = true,
      printMargins = false, printComplexityStatistics = false,
      printGraph = false, classStatistics = false, printSource = false;
    StringBuffer text = new StringBuffer();
    BufferedReader trainReader = null, testReader = null;
    ObjectInputStream objectInputStream = null;
    Random random;
    CostMatrix costMatrix = null;
    StringBuffer schemeOptionsText = null;
    Range attributesToOutput = null;
    long trainTimeStart = 0, trainTimeElapsed = 0,
      testTimeStart = 0, testTimeElapsed = 0;

    try {

      // Get basic options (options the same for all schemes)
      classIndexString = Utils.getOption('c', options);
      if (classIndexString.length() != 0) {
	classIndex = Integer.parseInt(classIndexString);
      }
      trainFileName = Utils.getOption('t', options);
      objectInputFileName = Utils.getOption('l', options);
      objectOutputFileName = Utils.getOption('d', options);
      testFileName = Utils.getOption('T', options);
      if (trainFileName.length() == 0) {
	if (objectInputFileName.length() == 0) {
	  throw new Exception("No training file and no object "+
			      "input file given.");
	}
	if (testFileName.length() == 0) {
	  throw new Exception("No training file and no test "+
			      "file given.");
	}
      } else if ((objectInputFileName.length() != 0) &&
		 ((!(classifier instanceof UpdateableClassifier)) ||
		 (testFileName.length() == 0))) {
	throw new Exception("Classifier not incremental, or no " +
			    "test file provided: can't "+
			    "use both train and model file.");
      }
      try {
	if (trainFileName.length() != 0) {
	  trainReader = new BufferedReader(new FileReader(trainFileName));
	}
	if (testFileName.length() != 0) {
	  testReader = new BufferedReader(new FileReader(testFileName));
	}
	if (objectInputFileName.length() != 0) {
          InputStream is = new FileInputStream(objectInputFileName);
          if (objectInputFileName.endsWith(".gz")) {
            is = new GZIPInputStream(is);
          }
	  objectInputStream = new ObjectInputStream(is);
	}
      }
      catch (Exception e) {
	throw new Exception("Can't open file " + e.getMessage() + '.');
      }
      if (testFileName.length() != 0) {
	template = test = new Instances(testReader, 1);
	if (classIndex != -1) {
	  test.setClassIndex(classIndex - 1);
	}
        else {
	  test.setClassIndex(test.numAttributes() - 1);
	}
	if (classIndex > test.numAttributes()) {
	  throw new Exception("Index of class attribute too large.");
	}
      }
      if (trainFileName.length() != 0) {
	if ((classifier instanceof UpdateableClassifier) &&
	    (testFileName.length() != 0)) {
	  train = new Instances(trainReader, 1);
	}
        else {
	  train = new Instances(trainReader);
	}
        template = train;
	if (classIndex != -1) {
	  train.setClassIndex(classIndex - 1);
	}
        else {
	  train.setClassIndex(train.numAttributes() - 1);
	}
	if (classIndex > train.numAttributes()) {
	  throw new Exception("Index of class attribute too large.");
	}
	//train = new Instances(train);
      }
      if (template == null) {
        throw new Exception("No actual dataset provided to use as template");
      }
      seedString = Utils.getOption('s', options);
      if (seedString.length() != 0) {
	seed = Integer.parseInt(seedString);
      }
      foldsString = Utils.getOption('x', options);
      if (foldsString.length() != 0) {
	folds = Integer.parseInt(foldsString);
      }
      costMatrix = handleCostOption(Utils.getOption('m', options), template.numClasses());

      classStatistics = Utils.getFlag('i', options);
      noOutput = Utils.getFlag('o', options);
      trainStatistics = !Utils.getFlag('v', options);
      printComplexityStatistics = Utils.getFlag('k', options);
      printMargins = Utils.getFlag('r', options);
      printGraph = Utils.getFlag('g', options);
      sourceClass = Utils.getOption('z', options);
      printSource = (sourceClass.length() != 0);

      // Check -p option
      try {
	attributeRangeString = Utils.getOption('p', options);
      }
      catch (Exception e) {
	throw new Exception(e.getMessage() + "\nNOTE: the -p option has changed. " +
			    "It now expects a parameter specifying a range of attributes " +
			    "to list with the predictions. Use '-p 0' for none.");
      }
      if (attributeRangeString.length() != 0) {
	printClassifications = true;
	if (!attributeRangeString.equals("0"))
	  attributesToOutput = new Range(attributeRangeString);
      }

      // If a model file is given, we can't process
      // scheme-specific options
      if (objectInputFileName.length() != 0) {
	Utils.checkForRemainingOptions(options);
      }
      else {
	// Set options for classifier
	if (classifier instanceof OptionHandler) {
	  for (int i = 0; i < options.length; i++) {
	    if (options[i].length() != 0) {
	      if (schemeOptionsText == null) {
		schemeOptionsText = new StringBuffer();
	      }
	      if (options[i].indexOf(' ') != -1) {
		schemeOptionsText.append('"' + options[i] + "\" ");
	      } else {
		schemeOptionsText.append(options[i] + " ");
	      }
	    }
	  }
	  ((OptionHandler)classifier).setOptions(options);
	}
      }
      Utils.checkForRemainingOptions(options);
    }
    catch (Exception e) {
      throw new Exception("\nWeka exception: " + e.getMessage()
			   + makeOptionString(classifier));
    }


    // Setup up evaluation objects
    Evaluation trainingEvaluation = new Evaluation(new Instances(template, 0), costMatrix);
    Evaluation testingEvaluation = new Evaluation(new Instances(template, 0), costMatrix);

    if (objectInputFileName.length() != 0) {

      // Load classifier from file
      classifier = (Classifier) objectInputStream.readObject();
      objectInputStream.close();
    }

    // Build the classifier if no object file provided
    if ((classifier instanceof UpdateableClassifier) &&
	(testFileName.length() != 0) &&
	(costMatrix == null) &&
	(trainFileName.length() != 0)) {

      // Build classifier incrementally
      trainingEvaluation.setPriors(train);
      testingEvaluation.setPriors(train);
      trainTimeStart = System.currentTimeMillis();
      if (objectInputFileName.length() == 0) {
	classifier.buildClassifier(train);
      }
      while (train.readInstance(trainReader)) {
	trainingEvaluation.updatePriors(train.instance(0));
	testingEvaluation.updatePriors(train.instance(0));
	((UpdateableClassifier)classifier).
	  updateClassifier(train.instance(0));
	train.delete(0);
      }
      trainTimeElapsed = System.currentTimeMillis() - trainTimeStart;
      trainReader.close();
    } else if (objectInputFileName.length() == 0) {

      // Build classifier in one go
      tempTrain = new Instances(train);
      trainingEvaluation.setPriors(tempTrain);
      testingEvaluation.setPriors(tempTrain);
      trainTimeStart = System.currentTimeMillis();
      classifier.buildClassifier(tempTrain);
      trainTimeElapsed = System.currentTimeMillis() - trainTimeStart;
    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品一区二区在线观看网站| 在线影院国内精品| 欧美精品一区二区三区在线播放| 日韩av一二三| 欧美白人最猛性xxxxx69交| 国产真实乱对白精彩久久| 久久精品亚洲乱码伦伦中文| 国产成人免费网站| 18成人在线观看| 欧美肥大bbwbbw高潮| 久久国产精品一区二区| 久久久精品黄色| 91首页免费视频| 无码av免费一区二区三区试看| 日韩欧美视频在线| 丁香另类激情小说| 亚洲成人av一区二区| 亚洲精品一区二区三区香蕉| 韩国av一区二区三区四区| 中文字幕亚洲不卡| 欧美一级欧美一级在线播放| 国产乱国产乱300精品| 韩国女主播一区二区三区| 亚洲成人777| 制服丝袜中文字幕亚洲| 久久疯狂做爰流白浆xx| 亚洲欧洲日韩av| 91.xcao| 国产精品1区2区3区| 一级女性全黄久久生活片免费| 欧美日韩国产一级二级| 国产精品自产自拍| 一区二区高清免费观看影视大全| 欧美成人一级视频| 欧洲一区在线观看| 岛国精品一区二区| 麻豆精品新av中文字幕| 18成人在线视频| 久久免费的精品国产v∧| 欧美日韩一区二区在线观看视频| 国产在线国偷精品产拍免费yy| 一区二区三区精品| 国产日产精品1区| 日韩三级.com| 欧美嫩在线观看| 午夜精品久久久久久久蜜桃app| 国产欧美综合色| 欧美日韩精品一区视频| 成人一区二区视频| 久久超碰97中文字幕| 亚洲午夜私人影院| 亚洲精品五月天| 日本一区二区三区国色天香| 日韩一区二区免费高清| 色婷婷av一区二区三区软件 | 亚洲精品一区二区三区香蕉| 欧美自拍偷拍一区| 97精品国产露脸对白| 国产精品2024| 国产在线精品一区在线观看麻豆| 亚洲成年人网站在线观看| 亚洲激情图片一区| 亚洲天堂2016| 亚洲欧洲三级电影| 亚洲婷婷在线视频| 亚洲欧美中日韩| 亚洲欧洲av在线| 国产精品国产三级国产专播品爱网| 久久久天堂av| 久久精品综合网| 欧美经典一区二区三区| 26uuu国产一区二区三区| 欧美电影免费观看高清完整版在线 | 福利一区二区在线| 国产一区二区精品久久99| 蜜臂av日日欢夜夜爽一区| 视频一区在线视频| 日一区二区三区| 日本vs亚洲vs韩国一区三区二区 | 精品久久久久久久久久久院品网 | 久久久久免费观看| 国产蜜臀97一区二区三区 | 国产精品毛片久久久久久久| 国产日韩精品一区二区三区在线| 久久久久久久免费视频了| 久久久精品人体av艺术| 国产精品你懂的在线| 国产精品欧美精品| 玉足女爽爽91| 日日欢夜夜爽一区| 激情伊人五月天久久综合| 精品中文av资源站在线观看| 久久综合综合久久综合| 国产成人午夜高潮毛片| 91亚洲精华国产精华精华液| 在线观看免费成人| 日韩免费高清av| 欧美韩日一区二区三区四区| 综合久久一区二区三区| 午夜精品一区二区三区免费视频| 日本中文字幕一区二区视频| 久久91精品国产91久久小草| 风间由美性色一区二区三区| 91网站在线观看视频| 666欧美在线视频| 久久日韩精品一区二区五区| 国产精品久久久一本精品| 亚洲一区成人在线| 国产一区二三区| 91在线免费视频观看| 在线不卡a资源高清| 久久人人97超碰com| 一区二区三区日韩精品| 久久精品国产一区二区| 91首页免费视频| 欧美一区二区三区爱爱| 中文字幕一区二区视频| 首页亚洲欧美制服丝腿| 国产很黄免费观看久久| 欧美视频在线一区| 国产欧美日韩不卡| 图片区小说区区亚洲影院| 国产成人免费av在线| 欧美日韩精品一区二区在线播放| 国产亚洲精品bt天堂精选| 亚洲一级二级三级在线免费观看| 精品一二三四在线| 欧美人狂配大交3d怪物一区| 国产日产欧美一区二区视频| 五月激情综合色| 91小视频在线观看| 久久久久久久国产精品影院| 亚洲丰满少妇videoshd| 成人精品视频一区二区三区| 欧美日韩精品一二三区| 中文字幕在线不卡一区| 老汉av免费一区二区三区 | 精品国产三级a在线观看| 一个色综合网站| k8久久久一区二区三区| 精品88久久久久88久久久| 亚洲午夜精品网| 99久久99久久精品免费看蜜桃| 亚洲精品在线三区| 图片区小说区国产精品视频| 91国偷自产一区二区三区成为亚洲经典| 精品少妇一区二区三区免费观看 | 久久综合国产精品| 丝袜诱惑制服诱惑色一区在线观看| 成人激情开心网| 国产午夜精品一区二区| 精品亚洲成a人| 精品国产自在久精品国产| 日韩av一级片| 3atv一区二区三区| 午夜精品久久久久久久99水蜜桃| 97久久精品人人做人人爽50路| 国产午夜精品久久久久久久| 国产最新精品免费| 精品国偷自产国产一区| 看片的网站亚洲| 精品国产青草久久久久福利| 麻豆成人av在线| 欧美成人高清电影在线| 久久久国际精品| 欧美曰成人黄网| 欧美一二三区在线观看| 日韩一区欧美二区| 欧美久久婷婷综合色| 日韩精品乱码av一区二区| 欧美欧美午夜aⅴ在线观看| 亚洲国产人成综合网站| 欧美日韩亚洲国产综合| 香蕉久久一区二区不卡无毒影院| 欧美日韩亚洲丝袜制服| 亚洲香肠在线观看| 欧美色综合久久| 午夜精品免费在线观看| 91精品国产福利| 精品一区二区在线免费观看| 久久久高清一区二区三区| 国产高清精品网站| 欧美激情一区二区在线| 91在线视频免费观看| 亚洲成人免费视频| 精品美女在线观看| 成人精品高清在线| 亚洲日韩欧美一区二区在线| 欧美性大战久久| 麻豆国产精品视频| 中文欧美字幕免费| 欧美日韩一区二区三区在线| 久久成人麻豆午夜电影| 国产嫩草影院久久久久| 色视频一区二区| 久久超碰97中文字幕| 性做久久久久久免费观看| 日韩一区精品字幕| 日韩成人一区二区三区在线观看| 欧美亚洲国产bt|