当前位置: 首页 > news >正文

底湘西网站制作openshift wordpress 访问

底湘西网站制作,openshift wordpress 访问,php网站虚拟机,平面设计的范围63.1 AdaBoosting基本算法#xff1a;先从初始训练集训练一个弱学习器#xff0c;在根据弱学习器的表现对训练样本进行权重调整#xff0c;经过若干轮之后#xff0c;将得到一组分类器#xff0c;将数据输入这组分类器后会得到一个综合且准确的的分类结果。“三个臭皮匠先从初始训练集训练一个弱学习器在根据弱学习器的表现对训练样本进行权重调整经过若干轮之后将得到一组分类器将数据输入这组分类器后会得到一个综合且准确的的分类结果。“三个臭皮匠顶个诸葛亮”多个这样的弱分类器相互补充最后会变成一个强分类器。 63.2 代码 package dl;import java.io.FileReader; import java.util.Arrays;import weka.core.Instances;/*** Weighted instances.*/ public class WeightedInstances extends Instances {/*** Just the requirement of some classes, any number is ok.*/private static final long serialVersionUID 110;/*** Weights.*/private double[] weights;/********************* The first constructor.** param paraFileReader* The given reader to read data from file.*******************/public WeightedInstances(FileReader paraFileReader) throws Exception {super(paraFileReader);setClassIndex(numAttributes() - 1);// Initialize weightsweights new double[numInstances()];double tempAverage 1.0 / numInstances();for (int i 0; i weights.length; i) {weights[i] tempAverage;} // Of for iSystem.out.println(Instances weights are: Arrays.toString(weights));} // Of the first constructor/********************* The second constructor.** param paraInstances* The given instance.*******************/public WeightedInstances(Instances paraInstances) {super(paraInstances);setClassIndex(numAttributes() - 1);// Initialize weightsweights new double[numInstances()];double tempAverage 1.0 / numInstances();for (int i 0; i weights.length; i) {weights[i] tempAverage;} // Of for iSystem.out.println(Instances weights are: Arrays.toString(weights));} // Of the second constructor/********************* Getter.** param paraIndex* The given index.* return The weight of the given index.*******************/public double getWeight(int paraIndex) {return weights[paraIndex];} // Of getWeight/********************* Adjust the weights.** param paraCorrectArray* Indicate which instances have been correctly classified.* param paraAlpha* The weight of the last classifier.*******************/public void adjustWeights(boolean[] paraCorrectArray, double paraAlpha) {// Step 1. Calculate alpha.double tempIncrease Math.exp(paraAlpha);// Step 2. Adjust.double tempWeightsSum 0; // For normalization.for (int i 0; i weights.length; i) {if (paraCorrectArray[i]) {weights[i] / tempIncrease;} else {weights[i] * tempIncrease;} // Of iftempWeightsSum weights[i];} // Of for i// Step 3. Normalize.for (int i 0; i weights.length; i) {weights[i] / tempWeightsSum;} // Of for iSystem.out.println(After adjusting, instances weights are: Arrays.toString(weights));} // Of adjustWeights/********************* Test the method.*******************/public void adjustWeightsTest() {boolean[] tempCorrectArray new boolean[numInstances()];for (int i 0; i tempCorrectArray.length / 2; i) {tempCorrectArray[i] true;} // Of for idouble tempWeightedError 0.3;adjustWeights(tempCorrectArray, tempWeightedError);System.out.println(After adjusting);System.out.println(toString());} // Of adjustWeightsTest/********************* For display.*******************/public String toString() {String resultString I am a weighted Instances object.\r\n I have numInstances() instances and (numAttributes() - 1) conditional attributes.\r\n My weights are: Arrays.toString(weights) \r\n My data are: \r\n super.toString();return resultString;} // Of toString/********************* For unit test.** param args* Not provided.*******************/public static void main(String args[]) {WeightedInstances tempWeightedInstances null;String tempFilename C:\\Users\\86183\\IdeaProjects\\deepLearning\\src\\main\\java\\resources\\iris.arff;try {FileReader tempFileReader new FileReader(tempFilename);tempWeightedInstances new WeightedInstances(tempFileReader);tempFileReader.close();} catch (Exception exception1) {System.out.println(Cannot read the file: tempFilename \r\n exception1);System.exit(0);} // Of trySystem.out.println(tempWeightedInstances.toString());tempWeightedInstances.adjustWeightsTest();} // Of main} // Of class WeightedInstances63.3 结果部分
http://www.pierceye.com/news/962630/

相关文章:

  • 绍兴手机网站建设wordpress 文字排版
  • 宁波网站设计公司有几家企业网站建设计划书
  • 做微信小程序和网站那个简单给周杰伦做网站
  • 营销型网站建设题库网站制作里面链接怎么做
  • 做网站空间 阿里云h5下一页
  • 怎样才能在百度搜索到自己的网站网站建设制作要学什么
  • 北京网站推广排名外包河南省工程建设业协会网站
  • 桂林市电力建设公司网站野望王绩翻译
  • 网站模版免费网片生产厂家
  • 实用网站设计步骤百度竞价广告代理
  • 怎么在vk网站上做推广网站建设柚子网络科技官网
  • 威海网站优化公司wordpress post title
  • 网站建设验收期安阳后营吧
  • 询盘网站培训机构前端开发
  • 企业如何做网站建站小程序定制开发深圳
  • 创建网站怎么赚钱的视频博客主题wordpress
  • 北京大兴区网站建设如何打造平台
  • 建设公司网站需要多少天棋盘游戏类网站开发
  • 织梦网站logo修改探测器 东莞网站建设
  • 图片网站收录淮北网站建设求职简历
  • 北京建设局投诉网站首页晋江外贸网站建设
  • 如何更改网站模板网站建设这一行业怎样
  • 海口网站排名东网站建设
  • 李连杰做的功夫网站泉州四方网站开发
  • 台州专业网站设计系统简单的购物网站制作
  • 中国建筑信息资讯网网站的优化用什么软件
  • wordpress本地网站打开慢电商网课
  • 仿照别人的网站做违法吗江苏集团网站建设
  • 一家专门做建材的网站找人做个网站大概多少钱
  • 信息展示网站系统网站策划书怎么写