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

做网站哪家公司比较好网站建设做什么会计科目

做网站哪家公司比较好,网站建设做什么会计科目,jquery+html5 网站后台管理页面模板,门户网站建设注意问题代码来自闵老师”日撸 Java 三百行#xff08;61-70天#xff09; 日撸 Java 三百行#xff08;61-70天#xff0c;决策树与集成学习#xff09;_闵帆的博客-CSDN博客 学习过程中理解算法参考了#xff1a;#xff08;十三#xff09;通俗易懂理解——Adaboost算法原… 代码来自闵老师”日撸 Java 三百行61-70天 日撸 Java 三百行61-70天决策树与集成学习_闵帆的博客-CSDN博客 学习过程中理解算法参考了十三通俗易懂理解——Adaboost算法原理 - 知乎 (zhihu.com) 今天的代码的核心是方法adjustWeights(boolean[] paraCorrectArray, double paraAlpha)。分类正确的实例权重调整为原值除以Math.exp(paraAlpha)分类错误的调整为原值乘以Math.exp(paraAlpha)。 测试方法里之所以for循环到tempCorrectArray长度的一半仅仅是为了测试。相当于设置弱分类器分类正确了一半。 package machinelearning.adaboosting;import java.io.FileReader; import java.util.Arrays;import weka.core.Instances;/*** Weighted instances.br* * author WX873**/ public class WeightedInstances extends Instances{/*** Just the requirement of some classes, any number is ok.*/private static final long serialVersionUID 11087456L;/*** Weights*/private double[] weights;/*** *************************************************** The first constructor.* * param paraFileReader The given reader to read data from file.* throws Exception* ***************************************************/public WeightedInstances(FileReader paraFileReader) throws Exception{// TODO Auto-generated constructor stubsuper(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* ***********************************************************/public WeightedInstances(Instances paraInstances) {// TODO Auto-generated constructor stubsuper(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) { //仅仅是测试adjustWeights方法,因为还没有分类器设置分类正确了一半tempCorrectArray[i] true;}//of for idouble tempWeightedError 0.3;adjustWeights(tempCorrectArray, tempWeightedError); //仅仅是测试adjustWeights方法,因为还没有分类器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/*** ************************************************************ The entrance of the program.* * param args* ************************************************************/public static void main(String args[]) {WeightedInstances tempWeightedInstances null;String tempFilename E:/Datasets/UCIdatasets/其他数据集/iris.arff;try {FileReader tempFileReader new FileReader(tempFilename);tempWeightedInstances new WeightedInstances(tempFileReader);tempFileReader.close();} catch (Exception exception1) {// TODO: handle exceptionSystem.out.println(Cannot read the file: tempFilename \r\n exception1);System.exit(0);}//of trySystem.out.println(tempWeightedInstances.toString());tempWeightedInstances.adjustWeightsTest();}//of main}//of WeightedInstances
http://www.sczhlp.com/news/181318/

相关文章:

  • 公司企业网站搭建网站的后期维护工作一般做什么
  • 网站开发好学wordpress重装后404
  • 广州做网站哪个平台好培训心得网站建设
  • 汕头建设工程总公司织梦网站怎么做优化
  • 免费下载建网站教程公司想做网站
  • 锦州做网站哪家好广州新闻最新消息10条
  • 5118网站苏州行业网站建设
  • 专门帮做ppt的网站wordpress菜单链接新窗口
  • 温州市网站优化机械设备网站源码
  • seo网站优化推荐wordpress会员下载插件
  • 自己做的网站怎么被搜索出来网站设计规划高中信息技术
  • 大型网站技术架构核心原理与案例分析大凤号 网站建设
  • 正规营销型网站建设自己做网站 最好的软件下载
  • 微信与网站对接h5制作工具手机版
  • 网站根目录在哪wordpress国家域名管理中心
  • 安徽省省博物馆网站建设wordpress主题开发电子书
  • 网站维护需要哪些知识海口网站开发建设
  • 深圳网站建设定制开发 .超凡科技黑龙江建设网网站
  • 中国icp备案的有多少企业网站推广产品吸引人的句子
  • wordpress上传网站模板辽宁建设工程信息网专家名单
  • 进步与现代化
  • 2025 最新推荐!溴化锂回收公司精选榜单:含制冷机 / 溶液 / 机组回收服务商权威测评及选择指南
  • 使用OpenCvSharp , Emgu.CV 手搓 视觉识别算法 以及 成果展示
  • PKC7300高频电流探头在新能源汽车车载充电机稳态电流测试中的应用方案
  • 国外哪些做问卷的网站网易企业邮箱pop3设置
  • .概述网站建设的基本流程安徽六安有哪些区县
  • 建一个鲜花买卖网站多少钱长沙优化官网公司
  • 政务网站平台建设 招标wordpress竖版图片尺寸
  • 湖南领企信息科技有限公司宁波seo推广优化怎么做
  • 创保网app下载郑州百度搜索优化