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

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

?? evaluation.java

?? 一個數據挖掘系統的源碼
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:

	// Classifier was trained incrementally, so we have to
	// reopen the training data in order to test on it.

	// Incremental testing
	train = new Instances (data,1);
	if (classIndex != -1) {
	  train.setClassIndex(classIndex - 1);
	}
        else {
	  train.setClassIndex(train.numAttributes() - 1);
	}
	testTimeStart = System.currentTimeMillis();
	for (int k=0; k<train.numInstances(); k++) {
	  trainingEvaluation.
	  evaluateModelOnce((Classifier)classifier,train.instance(0));
	  train.delete(0);
	}
	testTimeElapsed = System.currentTimeMillis() - testTimeStart;
      }
      else {
	testTimeStart = System.currentTimeMillis();
	trainingEvaluation.evaluateModel(classifier,train);
	testTimeElapsed = System.currentTimeMillis() - testTimeStart;
      }

      // Print the results of the training evaluation
      if (printMargins) {
	return trainingEvaluation.toCumulativeMarginDistributionString();
      }
      else {
	text.append("\nTime taken to build model: " + Utils.doubleToString(trainTimeElapsed / 1000.0,2) +" seconds");
	text.append("\nTime taken to test model on training data: " + Utils.doubleToString(testTimeElapsed / 1000.0,2) + " seconds");
	text.append(trainingEvaluation.toSummaryString("\n\n=== Error on training" + " data ===\n", printComplexityStatistics));
	if (template.classAttribute().isNominal()) {
	  if (classStatistics) {
	    text.append("\n\n" + trainingEvaluation.toClassDetailsString());
	  }
	  text.append("\n\n" + trainingEvaluation.toMatrixString());
	}
      }
    }

    // Compute proper error estimates
    if (testFileName.length() != 0) {
      // Testing is on the supplied test data
      test  = new Instances (testDocument);
      for (int k=0; k < test.numInstances(); k++) {
        testingEvaluation.evaluateModelOnce((Classifier)classifier, test.instance(0));
        test.delete(0);
      }
      text.append("\n\n" + testingEvaluation.
		  toSummaryString("=== Error on test data --- The new version!!!! ===\n",
				  printComplexityStatistics));
    }
    else {
      // Testing is via cross-validation on training data
      random = new Random(seed);
      random.setSeed(seed);
      train.randomize(random);
      testingEvaluation.
	crossValidateModel(classifier, train, folds);
      if (template.classAttribute().isNumeric()) {
	text.append("\n\n\n" + testingEvaluation.
		    toSummaryString("=== Cross-validation ===\n",
				    printComplexityStatistics));
      }
      else {
	text.append("\n\n\n" + testingEvaluation.
		    toSummaryString("=== Stratified " +
				    "cross-validation ===\n",
				    printComplexityStatistics));
      }
    }
    if (template.classAttribute().isNominal()) {
      if (classStatistics) {
	text.append("\n\n" + testingEvaluation.toClassDetailsString());
      }
      text.append("\n\n" + testingEvaluation.toMatrixString());
    }
    return text.toString();
  }


public static String evaluateModelInstancePercentage(Classifier classifier,
				     String[] options, Instances data, int percentage) throws Exception {

    Instances train = null, tempTrain, test = null, template = null;
    int seed = 1, folds = 10, classIndex = -1, percent = 0, sizeOfTrainFile = 0, sizeOfTestFile = 0;
    String 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();
    ObjectInputStream objectInputStream = null;
    Random random;
    CostMatrix costMatrix = null;
    StringBuffer schemeOptionsText = null;
    Range attributesToOutput = null;
    long trainTimeStart = 0, trainTimeElapsed = 0,
      testTimeStart = 0, testTimeElapsed = 0;

    try {
      percent = percentage;
      // Get basic options (options the same for all schemes)
      classIndexString = Utils.getOption('c', options);
      if (classIndexString.length() != 0) {
	classIndex = Integer.parseInt(classIndexString);
      }
      objectInputFileName = Utils.getOption('l', options);
      objectOutputFileName = Utils.getOption('d', options);
      try {
	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 ((classifier instanceof UpdateableClassifier)) {
	  sizeOfTrainFile = data.numInstances() * percent / 100;
          sizeOfTestFile = data.numInstances() - sizeOfTrainFile;
          train =  new Instances (data,0,sizeOfTrainFile);
          test = new Instances (data,sizeOfTrainFile,sizeOfTestFile);
          template = train;
      }
      else {
	  sizeOfTrainFile = data.numInstances() * percent / 100;
          sizeOfTestFile = data.numInstances() - sizeOfTrainFile;
          train =  new Instances (data,0,sizeOfTrainFile);
          test = new Instances (data,sizeOfTrainFile,sizeOfTestFile);
          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");
      }
      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) &&
	(costMatrix == null)) {

      // Build classifier incrementally
      trainingEvaluation.setPriors(train);
      testingEvaluation.setPriors(train);
      trainTimeStart = System.currentTimeMillis();
      if (objectInputFileName.length() == 0) {
	classifier.buildClassifier(train);
      }
      for (int i=0; i<train.numInstances(); i++) {
	trainingEvaluation.updatePriors(train.instance(0));
	testingEvaluation.updatePriors(train.instance(0));
	((UpdateableClassifier)classifier).
	  updateClassifier(train.instance(0));
	train.delete(0);
      }
      trainTimeElapsed = System.currentTimeMillis() - trainTimeStart;

    } 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;
    }

    // Save the classifier if an object output file is provided
    if (objectOutputFileName.length() != 0) {
      OutputStream os = new FileOutputStream(objectOutputFileName);
      if (objectOutputFileName.endsWith(".gz")) {
        os = new GZIPOutputStream(os);
      }
      ObjectOutputStream objectOutputStream = new ObjectOutputStream(os);
      objectOutputStream.writeObject(classifier);
      objectOutputStream.flush();
      objectOutputStream.close();
    }

    // If classifier is drawable output string describing graph
    if ((classifier instanceof Drawable)
	&& (printGraph)){
      return ((Drawable)classifier).graph();
    }

    // Output the classifier as equivalent source
    if ((classifier instanceof Sourcable)
	&& (printSource)){
      return wekaStaticWrapper((Sourcable) classifier, sourceClass);
    }
/*
    // Output test instance predictions only
    if (printClassifications) {
      return printClassifications(classifier, new Instances(template, 0),
				  testFileName, classIndex, attributesToOutput);
    }
*/
    // Output model
    if (!(noOutput || printMargins)) {
      if (classifier instanceof OptionHandler) {
	if (schemeOptionsText != null) {
	  text.append("\nOptions: "+schemeOptionsText);
	  text.append("\n");
	}
      }
      text.append("\n" + classifier.toString() + "\n");
    }

    if (!printMargins && (costMatrix != null)) {
      text.append("\n=== Evaluation Cost Matrix ===\n\n")
        .append(costMatrix.toString());
    }

    // Compute error estimate from training data
    if ((trainStatistics)) {

      if ((classifier instanceof UpdateableClassifier) &&
	  (costMatrix == null)) {

	// Classifier was trained incrementally, so we have to
	// reopen the training data in order to test on it.

	// Incremental testing
	train =  new Instances (data,0,sizeOfTrainFile);
        test = new Instances (data,sizeOfTrainFile,sizeOfTestFile);

	if (classIndex != -1) {
	  train.setClassIndex(classIndex - 1);
	} else {
	  train.setClassIndex(train.numAttributes() - 1);
	}
	testTimeStart = System.currentTimeMillis();
	for (int k=0; k<train.numInstances(); k++) {

	  trainingEvaluation.
	  evaluateModelOnce((Classifier)classifier,
			    train.instance(0));
	  train.delete(0);
	}
	testTimeElapsed = System.currentTimeMillis() - testTimeStart;
      } else {
	testTimeStart = System.currentTimeMillis();
	trainingEvaluation.evaluateModel(classifier,
					 train);
	testTimeElapsed = System.currentTimeMillis() - testTimeStart;
      }

      // Print the results of the training evaluation
      if (printMargins) {
	return trainingEvaluation.toCumulativeMarginDistributionString();
      } else {
	text.append("\nTime taken to build model: " +
		    Utils.doubleToString(trainTimeElapsed / 1000.0,2) +
		    " seconds");
	text.append("\nTime taken to test model on training data: " +
		    Utils.doubleToString(testTimeElapsed / 1000.0,2) +
		    " seconds");
	text.append(trainingEvaluation.
		    toSummaryString("\n\n=== Error on training" +
				    " data ===\n", printComplexityStatistics));
	if (template.classAttribute().isNominal()) {
	  if (classStatistics) {
	    text.append("\n\n" + trainingEvaluation.toClassDetailsString());
	  }
	  text.append("\n\n" + trainingEvaluation.toMatrixString());
	}

      }
    }

    // Compute proper error estimates

      // Testing is on the supplied test data
      for (int j=0; j < test.numInstances(); j++) {
      	testingEvaluation.evaluateModelOnce((Classifier)classifier, test.instance(0));
	test.delete(0);
      }
      text.append("\n\n" + testingEvaluation.toSummaryString("=== Error on test data ===\n",
				  printComplexityStatistics));
    if (template.classAttribute().isNominal()) {
      if (classStatistics) {
	text.append("\n\n" + testingEvaluation.toClassDetailsString());
      }
      text.append("\n\n" + testingEvaluation.toMatrixString());
    }
    return text.toString();
  }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美喷水一区二区| 亚洲一区二区三区四区的 | 日韩精品专区在线影院重磅| 久久九九国产精品| 午夜精品视频在线观看| 成人综合日日夜夜| 精品国产乱码久久久久久影片| 亚洲精品久久久久久国产精华液| 国产乱码精品一区二区三区忘忧草 | 欧美亚洲国产bt| 国产精品国产三级国产有无不卡| 免费xxxx性欧美18vr| 欧美在线短视频| 国产精品成人在线观看| 成人综合在线网站| 久久久欧美精品sm网站| 奇米影视一区二区三区小说| 精品视频在线免费看| 亚洲天堂av一区| a在线欧美一区| 国产精品美女久久久久久2018| 久久疯狂做爰流白浆xx| 日韩你懂的在线观看| 日本免费新一区视频| 69p69国产精品| 日韩精品一卡二卡三卡四卡无卡| 欧美性欧美巨大黑白大战| 亚洲欧美一区二区三区国产精品 | 不卡的av网站| 国产精品视频免费看| 成人午夜av影视| 国产精品久久久久久久久搜平片| 国产乱子伦一区二区三区国色天香| 日韩天堂在线观看| 韩国女主播成人在线观看| 亚洲精品一区二区三区蜜桃下载 | 色综合色狠狠天天综合色| 成人免费一区二区三区在线观看| 99久久免费精品| 亚洲国产另类av| 欧美一区中文字幕| 国产一区二区三区蝌蚪| 国产精品免费丝袜| 91久久线看在观草草青青| 午夜久久久影院| 精品免费一区二区三区| 国产精品18久久久久久久久| 国产精品狼人久久影院观看方式| 97se亚洲国产综合自在线观| 亚洲v精品v日韩v欧美v专区| 欧美电视剧在线观看完整版| 国产大陆a不卡| 亚洲免费观看高清完整版在线观看| 欧美午夜在线观看| 韩国av一区二区| 亚洲精品中文在线| 日韩精品一区二区三区视频在线观看| 国产成人h网站| 亚洲制服欧美中文字幕中文字幕| 日韩欧美在线综合网| 成人a免费在线看| 日韩黄色小视频| 国产精品久久久久久亚洲毛片| 欧美日韩亚州综合| 国产美女一区二区| 亚洲国产乱码最新视频| 久久噜噜亚洲综合| 99久久婷婷国产综合精品| 日本不卡视频在线| 成人免费在线观看入口| 91精品国产aⅴ一区二区| 99热在这里有精品免费| 日韩中文字幕一区二区三区| 国产日韩欧美一区二区三区乱码 | 天天综合日日夜夜精品| 久久精品视频网| 欧美高清视频一二三区| 成人免费视频播放| 日本视频一区二区三区| 一区二区免费看| 欧美国产一区二区在线观看| 欧美一区二区精品在线| 91蝌蚪国产九色| 国产电影精品久久禁18| 日本不卡一区二区三区 | 精品亚洲成a人| 亚洲成人av一区二区| 国产精品传媒在线| 久久久久久9999| 日韩一区二区在线观看视频| 在线观看日韩毛片| 91网站在线播放| 99热精品一区二区| 国产高清精品网站| 精品综合免费视频观看| 亚洲不卡一区二区三区| 亚洲午夜日本在线观看| 亚洲婷婷在线视频| 国产精品色婷婷久久58| 久久久亚洲欧洲日产国码αv| 欧美一区二区黄| 欧美日韩亚洲另类| 欧美色图在线观看| 在线观看视频一区二区欧美日韩| 99精品久久久久久| 色综合久久六月婷婷中文字幕| 丁香婷婷综合五月| 成人av在线看| 91丨九色丨国产丨porny| 99综合影院在线| 91麻豆福利精品推荐| 日本韩国欧美在线| 在线观看欧美黄色| 欧美日韩国产综合视频在线观看| 欧美三区在线观看| 欧美日韩亚洲综合一区二区三区| 欧美日韩亚洲丝袜制服| 69成人精品免费视频| 欧美一区二区精品在线| 精品国产乱码久久久久久闺蜜| 欧美xingq一区二区| 精品国产乱码久久久久久久久 | 成人久久视频在线观看| jizzjizzjizz欧美| 91福利社在线观看| 欧美中文字幕不卡| 日韩一区二区视频在线观看| 精品国免费一区二区三区| 久久久午夜电影| 国产精品美女久久久久久久久 | 欧美一区二区视频在线观看 | 精品国产一区久久| 国产日韩高清在线| 一区二区三区四区高清精品免费观看| 亚洲六月丁香色婷婷综合久久| 亚洲一区二区三区四区五区中文| 手机精品视频在线观看| 国产一区二区三区黄视频| 99精品欧美一区二区蜜桃免费 | 久久99精品国产| 成人免费看视频| 在线观看一区二区视频| 337p粉嫩大胆色噜噜噜噜亚洲| 中文字幕日韩av资源站| 午夜精品影院在线观看| 国产乱码精品一区二区三区忘忧草| 懂色av中文字幕一区二区三区| 在线视频你懂得一区| 日韩美女视频一区二区在线观看| 国产精品美女视频| 日韩激情视频在线观看| youjizz久久| 日韩欧美国产精品一区| 日韩美女视频19| 美女视频黄频大全不卡视频在线播放| 国产福利一区二区三区在线视频| 在线免费不卡电影| 久久久久久久久久美女| 国产精品五月天| 奇米综合一区二区三区精品视频| www.亚洲精品| 日韩欧美国产wwwww| 成人免费小视频| 国产在线日韩欧美| 欧美日本高清视频在线观看| 欧美国产精品专区| 韩国中文字幕2020精品| 欧洲激情一区二区| 中文字幕一区二区三区色视频| 久久国产精品无码网站| 欧美日韩国产影片| 中文字幕在线一区| 国产专区综合网| 欧美日本一区二区三区四区 | 国产日韩欧美一区二区三区综合| 亚洲成人av在线电影| 色综合久久综合中文综合网| 精品毛片乱码1区2区3区 | 一区二区三区中文字幕在线观看| 精品一区二区三区久久久| 欧美精品 日韩| 亚洲综合成人网| 99精品国产91久久久久久 | 亚洲小说欧美激情另类| 成人污视频在线观看| 久久久国产午夜精品| 美洲天堂一区二卡三卡四卡视频| 欧美在线观看视频一区二区| 中文字幕亚洲精品在线观看| 国产成+人+日韩+欧美+亚洲| 精品久久久三级丝袜| 午夜欧美视频在线观看| 欧美日韩成人综合天天影院 | 国产一区二区三区久久悠悠色av | 88在线观看91蜜桃国自产| 亚洲高清免费视频| 欧美亚洲动漫另类| 午夜天堂影视香蕉久久| 欧美久久久影院| 日韩精品电影在线观看|