日撸java_day63-65

文章目录

  • Booster
    • 代码
    • 运行截图

Booster

代码

package machineLearning.adaboosting;import weka.core.Instances;import java.io.FileReader;
import java.util.Arrays;/*** ClassName: WeightedInstances* Package: machineLearning.adaboosting* Description:Weighted instances.** @Author: luv_x_c* @Create: 2023/8/13 15:12*/
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.*/public WeightedInstances(FileReader paraFileReader) throws Exception {super(paraFileReader);setClassIndex(numAttributes() - 1);//Initialize weights.weights = new double[numInstances()];double tempAverage = 1.0 / numInstances();Arrays.fill(weights, tempAverage);System.out.println("Instances weights are: " + Arrays.toString(weights));}//Of the first constructor/*** The second constructor.** @param paraInstances The given instances.*/public WeightedInstances(Instances paraInstances) {super(paraInstances);setClassIndex(numAttributes() - 1);// Initialize weights.weights = new double[numInstances()];double tempAverage = 1.0 / numInstances();Arrays.fill(weights, tempAverage);System.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 instance have been correctly classify.* @param paraAlpha        The weight of the last classifier.*/public void adjustWeights(boolean[] paraCorrectArray, double paraAlpha) {//Step1. Calculate alpha.double tempIncrease = Math.exp(paraAlpha);// Step2. Adjust.double tempWeightsSum = 0;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// Step3. 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()];Arrays.fill(tempCorrectArray, true);double tempWeightError = 0.3;adjustWeights(tempCorrectArray, tempWeightError);System.out.println("After adjusting: ");System.out.println(toString());}// Of adjustWeightsTest@Overridepublic 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/*** @param args Not provided.*/public static void main(String[] args) {WeightedInstances tempWeightInstances = null;String tempFileName = "E:\\java_code\\data\\sampledata\\iris.arff";try {FileReader fileReader = new FileReader(tempFileName);tempWeightInstances = new WeightedInstances(fileReader);fileReader.close();} catch (Exception ee) {System.out.println("Cannot read the file: " + tempFileName + "\r\n" + ee);System.exit(0);}//Of trySystem.out.println(tempWeightInstances.toString());tempWeightInstances.adjustWeightsTest();}//Of main
}//OF class WeightedInstances
package machineLearning.adaboosting;import weka.core.Instance;import java.io.FileReader;
import java.util.Arrays;/*** ClassName: StumpClassifier* Package: machineLearning.adaboosting* Description:The stump classifier.** @Author: luv_x_c* @Create: 2023/8/17 20:37*/
public class StumpClassifier extends SimpleClassifier {/*** The best cut for the current attribute on weightInstances.*/double bestCut;/*** The class label for attribute value less than bestCut.*/int leftLeafLabel;/*** The class label for attribute value no less than bestCut.*/int rightLeafLabel;/*** The only constructor.** @param paraWeightedInstances The given instances.*/public StumpClassifier(WeightedInstances paraWeightedInstances) {super(paraWeightedInstances);}//Of the only constructorpublic void train() {//Step1. Randomly choose an attribute.selectedAttribute = random.nextInt(numConditions);//Step2. Find all attributes values and sort.double[] tempValuesArray = new double[numInstances];for (int i = 0; i < tempValuesArray.length; i++) {tempValuesArray[i] = weightedInstances.instance(i).value(selectedAttribute);}//Of for iArrays.sort(tempValuesArray);//Step3. Initialize, classify all instances as the same with the original cut.int tempNumLabels = numClasses;double[] tempLabelCountArray = new double[tempNumLabels];int tempCurrentLabel;//Step3.1 Scan all labels to obtain their counts.for (int i = 0; i < numInstances; i++) {// The label of the ith instancetempCurrentLabel = (int) weightedInstances.instance(i).classValue();tempLabelCountArray[tempCurrentLabel] += weightedInstances.getWeight(i);}//Of for i//Step3.2 Find the label with the maximal count.double tempMaxCorrect = 0;int tempBestLabel = -1;for (int i = 0; i < tempLabelCountArray.length; i++) {if (tempMaxCorrect < tempLabelCountArray[i]) {tempMaxCorrect = tempLabelCountArray[i];tempBestLabel = i;}//Of if}//Of for i//Steep3.3 The cut is a little  smaller than the minimal value.bestCut = tempValuesArray[0] - 0.1;leftLeafLabel = tempBestLabel;rightLeafLabel = tempBestLabel;// Step4. Check candidate cuts one by one.// Step4.1 To handle multi-class data, left and right.double tempCut;double[][] tempLabelCountMatrix = new double[2][tempNumLabels];for (int i = 0; i < tempValuesArray.length - 1; i++) {// Step4.1 Some attribute values are identical, ignore them.if (tempValuesArray[i] == tempValuesArray[i + 1]) {continue;}//Of iftempCut = (tempValuesArray[i] + tempValuesArray[i + 1]) / 2;// Step4.2 Scan all labels to obtain their counts wrt, the cut .// Initialize again since it is used many times.for (int j = 0; j < 2; j++) {for (int k = 0; k < tempNumLabels; k++) {tempLabelCountMatrix[j][k] = 0;}//Of for k}//Of for jfor (int j = 0; j < numInstances; j++) {// The label of the jth instance.tempCurrentLabel = (int) weightedInstances.instance(j).classValue();if (weightedInstances.instance(j).value(selectedAttribute) < tempCut) {tempLabelCountMatrix[0][tempCurrentLabel] += weightedInstances.getWeight(j);} else {tempLabelCountMatrix[1][tempCurrentLabel] += weightedInstances.getWeight(j);}//Of if}//Of for j// Step4.3 Left leafdouble tempLeftMaxCorrect = 0;int tempLeftBestLabel = 0;for (int j = 0; j < tempLabelCountMatrix[0].length; j++) {if (tempLeftMaxCorrect < tempLabelCountMatrix[0][j]) {tempLeftMaxCorrect = tempLabelCountMatrix[0][j];tempLeftBestLabel = j;}//Of if}//Of for j// Step 4.4 Right leafdouble tempRightMaxCorrect = 0;int tempRightBestLabel = 0;for (int j = 0; j < tempLabelCountMatrix[0].length; j++) {if (tempRightMaxCorrect < tempLabelCountMatrix[1][j]) {tempRightMaxCorrect = tempLabelCountMatrix[1][j];tempRightBestLabel = j;}//Of if}//Of for j// Step 4.5 Compare with the current bestif (tempMaxCorrect < tempLeftMaxCorrect + tempRightMaxCorrect) {tempMaxCorrect = tempLeftMaxCorrect + tempRightMaxCorrect;bestCut = tempCut;leftLeafLabel = tempLeftBestLabel;rightLeafLabel = tempRightBestLabel;}//Of if}//Of for iSystem.out.println("Attribute = " + selectedAttribute + ", cut =" + bestCut + ", " +"leftLeafLabel = " + leftLeafLabel + ", rightLeafLabel" + rightLeafLabel);}//Of train@Overridepublic int classify(Instance paraInstance) {int resultLabel = -1;if (paraInstance.value(selectedAttribute) < bestCut) {resultLabel = leftLeafLabel;} else {resultLabel = rightLeafLabel;}//Of ifreturn resultLabel;}//Of classify@Overridepublic String toString() {return "I am a stump classifier.\r\n" + "I choose attribute #" + selectedAttribute+ " with cut value " + bestCut + ".\r\n" + "The left and right leaf labels are " + leftLeafLabel+ " and " + rightLeafLabel + ", respectively.\r\n" + "My weighted error is: " + computeWeightedError()+ ".\r\n" + "My weighted accuracy is : " + computeTrainingAccuracy() + ".";}//Of toString/*** For unit test.** @param args Not used.*/public static void main(String[] args) {WeightedInstances tempWeightedInstance = null;String tempFileName = "E:\\java_code\\data\\sampledata\\iris.arff";try {FileReader fileReader = new FileReader(tempFileName);tempWeightedInstance = new WeightedInstances(fileReader);fileReader.close();} catch (Exception e) {System.out.println("Cannot read the file: " + tempFileName + "\r\n" + e);System.exit(0);}//OF tryStumpClassifier tempClassifier = new StumpClassifier(tempWeightedInstance);tempClassifier.train();System.out.println(tempClassifier);System.out.println(Arrays.toString(tempClassifier.computeCorrectnessArray()));}//OF main
}//Of class StumpClassifier
package machineLearning.adaboosting;import weka.core.Instance;import java.util.Random;/*** ClassName: SimpleClassifier* Package: machineLearning.adaboosting* Description:The super class of any simple classifier.** @Author: luv_x_c* @Create: 2023/8/14 13:43*/
public abstract class SimpleClassifier {/*** The index of the current attribute.*/int selectedAttribute;/*** Weighted data.*/WeightedInstances weightedInstances;/*** The accuracy on the training set.*/double trainingAccuracy;/*** The number of instances.*/int numInstances;/*** The number of instances.*/int numClasses;/*** The number of conditional attributes.*/int numConditions;Random random = new Random();/*** The first constructor.** @param paraWeightedInstances The given instances.*/public SimpleClassifier(WeightedInstances paraWeightedInstances) {weightedInstances = paraWeightedInstances;numConditions = weightedInstances.numAttributes() - 1;numInstances = weightedInstances.numInstances();numClasses = weightedInstances.classAttribute().numValues();}// Of the first constructor/*** Train the classifier.*/public abstract void train();/*** Classify an instance.** @param paraInstance The given instance.* @return Predicted label.*/public abstract int classify(Instance paraInstance);/*** Which instance in the  training set are correctly classified.** @return The correctness array.*/public boolean[] computeCorrectnessArray() {boolean[] resultCorrectnessArray = new boolean[weightedInstances.numInstances()];for (int i = 0; i < resultCorrectnessArray.length; i++) {Instance tempInstance = weightedInstances.instance(i);if ((int) (tempInstance.classValue()) == classify(tempInstance)) {resultCorrectnessArray[i] = true;}// OF if}//Of for ireturn resultCorrectnessArray;}//Of computeCorrectnessArray/*** Compute the accuracy on the training set.** @return The training accuracy.*/public double computeTrainingAccuracy() {double tempCorrect = 0;boolean[] tempCorrectnessArray = computeCorrectnessArray();for (int i = 0; i < tempCorrectnessArray.length; i++) {if (tempCorrectnessArray[i]) {tempCorrect++;}//Of if}//Of for idouble resultAccuracy = tempCorrect / tempCorrectnessArray.length;return resultAccuracy;}//Of computeTrainingAccuracypublic double computeWeightedError(){double resultError=0;boolean[]tempCorrectnessArray=computeCorrectnessArray();for (int i = 0; i < tempCorrectnessArray.length; i++) {if(!tempCorrectnessArray[i]){resultError+=weightedInstances.getWeight(i);}//Of if}//Of for iif(resultError<1e-6){resultError=1e-6;}//Of ifreturn resultError;}//Of computeWeightedError
}//Of class SimpleClassifier
package machineLearning.adaboosting;import weka.core.Instance;
import weka.core.Instances;import java.io.FileReader;
import java.io.IOException;/*** ClassName: Booster* Package: machineLearning.adaboosting* Description: The booster which ensembles base classifiers.** @Author: luv_x_c* @Create: 2023/8/18 14:34*/
public class Booster {/*** Classifiers.*/SimpleClassifier[] classifiers;/*** Number of classifiers.*/int numClassifiers;/*** Whether stop after the training error is 0.*/boolean stopAfterConverge = false;/*** The weights of classifier.*/double[] classifierWeights;/*** The training data.*/Instances trainingData;/*** The testing data.*/Instances testingData;/*** The first constructor. The testing set is the same as the training data.** @param paraTrainingFileName The data file name.*/public Booster(String paraTrainingFileName) {// Step1. Read the training set.try {FileReader fileReader = new FileReader(paraTrainingFileName);trainingData = new Instances(fileReader);fileReader.close();} catch (IOException e) {System.out.println("Cannot read the file: " + paraTrainingFileName + "\r\n" + e);System.exit(0);}//Of try// Step2. Set the last attribute as the class indextrainingData.setClassIndex(trainingData.numAttributes() - 1);// Step3. The testing data is the same as the training datatestingData = trainingData;stopAfterConverge = true;System.out.println("****************Data**********\r\n" + trainingData);}//Of the first constructor/*** Set the number of base classifier, and allocate space for them.** @param paraNumBaseClassifiers The number of base classifier.*/public void setNumBaseClassifiers(int paraNumBaseClassifiers) {numClassifiers = paraNumBaseClassifiers;// Step1. Allocate space for classifiersclassifiers = new SimpleClassifier[numClassifiers];// Step2. Initialize classifier weightsclassifierWeights = new double[numClassifiers];}//Of setNumBaseClassifiers/*** Train the booster.*/public void train() {// Step1. Initialize.WeightedInstances tempWeightedInstances = null;double tempError;numClassifiers = 0;// Step2. Build other classifier.for (int i = 0; i < classifiers.length; i++) {// Step2.1 Key code: Construct or adjust the weightedInstancesif (i == 0) {tempWeightedInstances = new WeightedInstances(trainingData);} else {// Adjust the weights of the datatempWeightedInstances.adjustWeights(classifiers[i - 1].computeCorrectnessArray(),classifierWeights[i - 1]);}//Of if// Step 2.2 Train the next classifier.classifiers[i] = new StumpClassifier(tempWeightedInstances);classifiers[i].train();tempError = classifiers[i].computeWeightedError();// Key code: Set the classifier weight.classifierWeights[i] = 0.5 * Math.log(1 / tempError - 1);if (classifierWeights[i] < 1e-6) {classifierWeights[i] = 0;}//Of ifSystem.out.println("Classifier #" + i + " , weighted error = " + tempError + " , " +"weight = " + classifierWeights[i] + "\r\n");numClassifiers++;// The accuracy is enough.if (stopAfterConverge) {double tempTrainAccuracy = computeTrainingAccuracy();System.out.println("The accuracy of the booster is: " + tempTrainAccuracy + "\r\n");if (tempTrainAccuracy > 0.99999) {System.out.println("Stop at the round: " + i + " due to converge.\r\n");break;}//Of if}//of if}//Of for i}//Of for train/*** Classify an instance** @param paraInstance The given instance* @return The predicted label*/public int classify(Instance paraInstance) {double[] tempLabelCountArray = new double[testingData.classAttribute().numValues()];for (int i = 0; i < numClassifiers; i++) {int tempLabel = classifiers[i].classify(paraInstance);tempLabelCountArray[tempLabel] += classifierWeights[i];}//Of for iint resultLabel = -1;double tempMax = -1;for (int i = 0; i < tempLabelCountArray.length; i++) {if (tempMax < tempLabelCountArray[i]) {tempMax = tempLabelCountArray[i];resultLabel = i;}//Of if}//Of for ireturn resultLabel;}//Of classify/*** Test the booster on the training data.** @return The classification accuracy.*/public double test() {System.out.println("Testing on " + testingData.numInstances() + " instances\r\n");return test(testingData);}//Of test/*** Test the booster.** @param paraInstances The testing set.* @return The classification accuracy.*/public double test(Instances paraInstances) {double tempCorrect = 0;paraInstances.setClassIndex(paraInstances.numAttributes() - 1);for (int i = 0; i < paraInstances.numInstances(); i++) {Instance tempInstance = paraInstances.instance(i);if (classify(tempInstance) == (int) tempInstance.classValue()) {tempCorrect++;}//Of if}//Of for idouble resultAccuracy = tempCorrect / paraInstances.numInstances();System.out.println("The accuracy is: " + resultAccuracy);return resultAccuracy;}//Of test/*** Compute the training accuracy of the booster. It is not weighted.** @return The training accuracy.*/public double computeTrainingAccuracy() {double tempCorrect = 0;for (int i = 0; i < trainingData.numInstances(); i++) {if (classify(trainingData.instance(i)) == (int) trainingData.instance(i).classValue()) {tempCorrect++;}//Of if}//Of for idouble tempAccuracy = tempCorrect / trainingData.numInstances();return tempAccuracy;}//Of computeTrainingAccuracy/*** The entrance of the program.** @param args Not used now.*/public static void main(String[] args) {System.out.println("Starting Adaboosting ..");Booster tempBooster = new Booster("E:\\java_code\\data\\sampledata\\iris.arff");tempBooster.setNumBaseClassifiers(5);tempBooster.train();System.out.println("The training accuracy is: " + tempBooster.computeTrainingAccuracy());tempBooster.test();}//Of main
}//Of class Booster

运行截图

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/50457.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Vue+Axios搭建二次元动态登录页面(mp4视频格式)

最近想做一个前端登录页面&#xff0c;背景好看的&#xff0c;格式中规中矩的&#xff0c;这么难&#xff1f;我自己创一个吧&#xff01; 效果图如下&#xff1a; 源码可以参考我的github&#xff0c;复制源码即可用&#xff1a;gym02/loginPage_Vue: 使用VueAxios搭建的动态…

五、Spring MVC 接收请求参数以及数据回显、乱码问题

文章目录 一、Spring MVC 接收请求参数二、Spring MVC 数据回显三、SpringMVC 返回中文乱码问题 一、Spring MVC 接收请求参数 客户端或者前端通过 URL 请求传递过来的参数&#xff0c;在控制器中如何接收&#xff1f; 1、当参数和 Controller 中的方法参数一致时&#xff0c;无…

python pipenv环境部署django项目实践

将代码上传到服务器&#xff1a; 安装pipenv&#xff1a; pip3 install pipenv 安装项目虚拟环境&#xff1a; cd /www/wwwroot/python-django pipenv install 如果提示python版本问题&#xff0c;修改Pipfile文件内的python版本即可。 然后进入虚拟环境安装依赖包&#x…

appium2.0+ 单点触控和多点触控新的解决方案

在 appium2.0 之前&#xff0c;在移动端设备上的触屏操作&#xff0c;单手指触屏和多手指触屏分别是由 TouchAction 类&#xff0c;Multiaction 类实现的。 在 appium2.0 之后&#xff0c;这 2 个方法将会被舍弃。 "[Deprecated] TouchAction action is deprecated. Ple…

使用swoole实现实时消息推送给客户端

一. 测试服务端 //测试服务端public function testServer(){$server new Server(192.168.0.144, 9501, SWOOLE_BASE, SWOOLE_SOCK_TCP);$server->on(request, function ($request, $response) {$response->header(Content-Type, text/plain);$response->end("He…

Python快速入门体验

Python快速入门体验 一、环境信息1.1 硬件信息1.2 软件信息 二、Conda安装2.1 Conda介绍2.1.1 Conda简介2.1.2 Conda、Anaconda及Miniconda及的关系 2.2 Conda安装包下载2.2.1 Miniconda下载2.2.2 Anconda下载 2.3 Conda安装2.3.1 Miniconda安装2.3.2 Anconda安装 2.4 Conda初始…

【排序】插入排序 希尔排序(改进)

文章目录 插入排序时间复杂度空间复杂度 代码希尔排序时间复杂度空间复杂度 代码 以从小到大排序为例进行说明。 插入排序 插入排序就是从前向后&#xff08;i1开始&#xff09;进行选择&#xff0c;如果找到在i之前&#xff08;分配一个j下标进行寻找&#xff09;有比array[i…

多环境开发

多环境 1、多环境开发&#xff08;YAML版&#xff09; 小结&#xff1a; 多环境开发需要设置若干种常用环境&#xff0c;例如开发、生产、测试环境yaml格式中设置多环境使用—区分环境设置边界每种环境的区别在于加载的配置属性不同启用某种环境时需要指定启动时使用该环境 …

linux————LVS集群

目录 一、集群概述 一、负载均衡技术类型 二、负载均衡实现方式 二、LVS结构 一、三层结构 二、架构对象 三、LVS工作模式 四、负载均衡算法 一、静态负载均衡 二、动态负载 五、ipvsadm命令详解 六、LVS配置 一、基础配置 二、实现NAT模型搭建 配置IP地址 安装…

redis高级----------主从复制

redis的四种模式&#xff1a;单例模式&#xff1b;主从模式&#xff1b;哨兵模式&#xff0c;集群模式 一、主从模式 单例模式虽然操作简单&#xff0c;但是不具备高可用 缺点&#xff1a; 单点的宕机引来的服务的灾难、数据丢失单点服务器内存瓶颈&#xff0c;无法无限纵向扩…

NO.08 MyBatis创建逆向工程

目录 1、前言 2、添加依赖和插件 3、创建MyBatis的核心配置文件 4、创建逆向工程的配置文件 5、执行MBG插件的generate目标 1、前言 工程的创建有正向工程和逆向工程之分。正向工程&#xff1a;先创建Java实体类&#xff0c;由框架负责根据实体类生成数据库表&#xff0c;如…

Windows上安装Hugo的环境

Hugo是一个使用Go编写的静态站点生成器&#xff0c;即网站构建工具。 静态的意思是指在内容在网站上呈现之前需要全部编译成HTML文件。而动态的站点生成器是请求哪个页面就编译生成哪个HTML页面。 在Windows上可以选用包管理器Chocolatey、Scoop、Winget来安装Hugo。 这里我…

Rancher证书更新

一、环境 主机名 IP地址 操作系统 rancher版本 K8s-Master 192.168.10.236 Centos 7 2.5.9 二、更新证书 1、查看当前证书到期时间 2、进行证书轮换 [rootK8s-Master ~]# docker ps |grep rancher/rancher d581da2b7c4e rancher/rancher:v2.5.9 …

CGAL 点云分类

文章目录 一、简介二、实现代码三、实现效果参考资料一、简介 点云分类一直是点云数据应用的永恒课题,它包含很多,如地面点分类、建筑物分类、植被分类等。CGAL中也为我们提供了一种点云分类的方式,其具体的计算过程如下所述: 首先,使用点云中所携带的一些几何特征来对数据…

小梦C嘎嘎——启航篇】C++STL 中 list日常使用的接口介绍

小梦C嘎嘎——启航篇】CSTL 中 list日常使用的接口介绍&#x1f60e; 前言&#x1f64c;什么是list&#xff1f;常用的函数接口无参的构造函数接口拷贝构造接口赋值运算符重载 总结撒花&#x1f49e; &#x1f60e;博客昵称&#xff1a;博客小梦 &#x1f60a;最喜欢的座右铭&a…

云服务器(Centos7系统)配置JAVA+mysql+tomcat 环境

文章主要内容来源云服务器&#xff08;Centos7系统&#xff09;部署javaweb项目&#xff08;二&#xff09;配置JAVAmysqltomcat 环境_man_zuo的博客-CSDN博客 模仿途中遇到的问题 连接无效 有时连接无法下载&#xff0c;可能是过期了&#xff0c;将其更换为官网给的下载连接即…

WiFi天线和NB-IoT天线不通用

表面看起来完全一样。但是把WiFi天线插到NB-IoT设备后&#xff0c;信号弱了很多。还导致设备反复重启

代码随想录算法训练营之JAVA|第三十三天|738. 单调递增的数字

今天是第33天刷leetcode&#xff0c;立个flag&#xff0c;打卡60天&#xff0c;如果做不到&#xff0c;完成一件评论区点赞最高的挑战。 算法挑战链接 738. 单调递增的数字https://leetcode.cn/problems/monotone-increasing-digits/ 第一想法 题目理解&#xff1a;找到一个…

【Unity细节】Unity制作汽车时,为什么汽车会被弹飞?为什么汽车会一直抖动?

&#x1f468;‍&#x1f4bb;个人主页&#xff1a;元宇宙-秩沅 hallo 欢迎 点赞&#x1f44d; 收藏⭐ 留言&#x1f4dd; 加关注✅! 本文由 秩沅 原创 &#x1f636;‍&#x1f32b;️收录于专栏&#xff1a;unity细节和bug &#x1f636;‍&#x1f32b;️优质专栏 ⭐【…

MYSQL 统计停车时长百分比

SELECTCOUNT(*) AS 数量,subquery.total_count AS 总数,COUNT(*) * 100 / subquery.total_count AS 百分比,CASEWHEN park_long < 900 THEN 15分钟以内WHEN park_long > 900 AND park_long < 3600 THEN 15-60分钟WHEN park_long > 3600 AND park_long < 10800 T…