Codeforces Round #634 (Div. 3) Apr/13/2020 22:35UTC+8

Vivado FPGA 工程模板:参数化消抖、PWM 与 XDC 约束 这份工程模板解决 FPGA 起步阶段的工程骨架与踩坑问题。含可综合的参数化按键消抖(两级同步消亚稳态)、参数化 PWM(0/满占空比边界修复)、顶层呼吸灯示例、XDC 时钟与 IO 约束模板、Tcl 一键建工程脚本。面向 STM32 开发者向 FPGA 扩展,换 Artix-7/Kintex/Zynq 只需改器件与引脚。 立即下载

比赛链接 https://codeforces.com/contest/1335
比赛记录 https://blog.csdn.net/cheng__yu_/article/details/105395197

A. Candies and Two Sisters(水)

在这里插入图片描述

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=1e5+5,mod=1e9+7;
const int inf=0x3f3f3f3f;
int t,n;

int main()
{
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		int ans;
		if(n&1)
			ans=n/2;
		else
			ans=n/2-1;
		
		printf("%d\n",ans);
	}
	return 0;
}

B. Construct the String(水)

在这里插入图片描述

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=1e5+5,mod=1e9+7;
const int inf=0x3f3f3f3f;
int t,n,a,b;
int main()
{
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d%d%d",&n,&a,&b);
		string s="";
		char x='a';
		int cnt=0;
		while(n--)
		{
			s+=x;
			x++;
			cnt++;
			if(cnt==b)
				cnt=0,x='a';
		}
		cout<<s<<"\n";
	}
	return 0;
}

C. Two Teams Composing

在这里插入图片描述
思路:set记录不同的数的个数a,map找出现次数最大的数b。ans就是min(a,b)。然后b如果比a多2的话,可以补充一个到a里面,ans+1即可

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=1e5+5,mod=1e9+7;
const int inf=0x3f3f3f3f;
int t,n;
set<int> s;
map<int,int> m;

int main()
{
	scanf("%d",&t);
	while(t--)
	{
		s.clear(),m.clear();
		scanf("%d",&n);
		for(int i=1;i<=n;++i)
		{
			int x;
			scanf("%d",&x);
			s.insert(x);
			m[x]++;
		}
		
		int maxx=0,cnt=0;
		for(auto i : m)
		{
			if(i.second>cnt)
			{
				cnt=i.second;
				maxx=i.first;
			}
		}
		
		s.erase(maxx);
		int x=s.size();
		int ans;
		if(x>cnt)
			ans=2*cnt;
		else
		{
			if(x+2<=cnt)
				ans=(x+1)*2;
			else
				ans=x*2;
		}		
		printf("%d\n",ans/2);
	}
	return 0;
}

D. Anti-Sudoku(思维)

在这里插入图片描述

思路:数独的每行、每列、每个 3 × 3 3\times3 3×3的格子都要有两个重复的数。
修改(1,1)(2,4)(3,7)(4,2)(5,5)(6,8)(7,3)(8,6)(9,9)就可以了

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=1e5+5,mod=1e9+7;
const int inf=0x3f3f3f3f;

int t,n;
int a[10][10];

void solve(int i,int j)
{
	if(a[i][j]==1)
		a[i][j]=2;
	else
		a[i][j]=1;
}

int main()
{
	scanf("%d",&t);
	while(t--)
	{
		for(int i=1;i<=9;++i)
			for(int j=1;j<=9;++j)
				scanf("%1d",&a[i][j]);
		
		solve(1,1);
		solve(2,4);
		solve(3,7);
		solve(4,2);
		solve(5,5);
		solve(6,8);
		solve(7,3);
		solve(8,6);
		solve(9,9);
		
				
		for(int i=1;i<=9;++i)
		{
			for(int j=1;j<=9;++j)
				printf("%d",a[i][j]);
			puts("");				
		}
	
	}
	return 0;
}

E2. Three Blocks Palindrome (hard version)(枚举)

在这里插入图片描述

题意:找最长aba形块状回文
比赛体验:做题时就想到了 肯定是枚举每种数字。但最终还是没做出来,因为自己的做法,是先枚举数字a,然后找 a a a 左边出现的位置l,右边出现的位置r。然后统计 [ 1 , l − 1 ] , [ r + 1 , n ] [1,l-1],[r+1,n] [1,l−1],[r+1,n] 出现最多的数字,然后往中间缩。看似没什么问题,但是这种做法默认了枚举的数字要出现偶数次,显然就错误了。
思路:

  • 先统计两边的,枚举每个数字第1个和最后1个,然后找中间出现最多的数字。
  • 然后在枚举这个数字的第2个和倒数第2个,依次类推。

实现:把每个数字的位置存下来。然后对每个数字出现的次数做一个前缀和。这样可以 O ( 1 ) O(1) O(1) 获得 [ l , r ] [l,r] [l,r] 区间某个数字出现的次数

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2e5+5,maxm=1e5+5;
const int mod=1e9+7,inf=0x7f7f7f7f;

int t,n;
int a[maxn];
vector<int> p[maxn];
int pref[210][maxn];

int main()
{
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        for(int i=1;i<=200;++i)
            for(int j=1;j<=n;++j)
                pref[i][j]=0;
        for(int i=1;i<=200;++i)
            p[i].clear();

        for(int i=1;i<=n;++i)
        {
            scanf("%d",&a[i]);
            p[a[i]].push_back(i);
            pref[a[i]][i]=1;
        }
        for(int i=1;i<=200;++i)
            for(int j=1;j<=n;++j)
                pref[i][j]+=pref[i][j-1];
        int ans=0;
        for(int i=1;i<=200;++i)
        	ans=max(ans,(int)p[i].size());
        
        for(int i=1;i<=n;++i)
        {
            int cnt=pref[a[i]][i];
            int l=p[a[i]][cnt-1]+1;
            int x=p[a[i]].size();
            if(x<cnt)
                continue;

            int r=p[a[i]][x-cnt]-1;
            if(l>r)
                continue;
            for(int j=1;j<=200;++j)
                ans=max(ans,pref[j][r]-pref[j][l-1]+2*cnt);
        }
        printf("%d\n",ans);
    }
    return 0;
}
四旋翼无人机模糊自适应PID控制,俯仰姿态控制律设计研究(Matlab代码、Simulink仿真实现) 内容概要:本文围绕四旋翼无人机的俯仰姿态控制问题,深入研究了模糊自适应PID控制律的设计与实现。通过结合模糊逻辑系统的自适应能力与传统PID控制器的稳定性,构建了一种能够在复杂动态环境中有效应对外部扰动和模型不确定性的先进控制策略。研究详细阐述了控制系统的结构设计、模糊规则库的建立、隶属度函数的选取以及PID参数的在线调整机制,并利用Matlab/Simulink工具进行了完整的建模与仿真实验,验证了所提方法在响应速度、超调量和抗干扰能力等方面相较于传统PID控制的显著优越性。; 适合人群:具备自动控制理论基础和Matlab/Simulink仿真经验的自动化、航空航天及相关专业的本科生、研究生及科研人员。; 使用场景及目标:①学习和掌握模糊自适应PID控制器的设计原理与方法;②研究无人机姿态控制算法的性能提升途径;③完成相关课程设计、毕业设计或科研项目的仿真验证工作。; 阅读建议:建议读者结合Matlab代码与Simulink模型,深入理解控制算法的实现细节,并尝试调整系统参数和仿真条件,以探究不同因素对控制性能的影响,从而达到理论与实践相结合的学习目的。 立即下载

相关推荐

复现基于李雅普诺夫的多个欠驱动无人船协同路径跟踪Matlab仿真

内容概要:本文详细介绍了基于李雅普诺夫稳定性理论的多个欠驱动无人船协同路径跟踪控制方法的Matlab仿真研究。通过建立非线性动力学模型,设计分布式协同控制器,并利用李雅普诺夫函数严格证明系统的渐近稳定性,实现了多艘无人船在复杂海洋环境下的高精度路径跟踪与稳定编队保持。文中系统阐述了控制器的设计原理、稳定性分析过程、仿真参数配置及多种典型场景下的仿真实验结果,充分验证了该方法在提升编队协同性、抗外部干扰能力和鲁棒性方面的显著优势。; 适合人群:具备自动控制理论、非线性系统分析基础以及Matlab/Simulink仿真能力的研究生、科研人员,以及从事无人系统、船舶自动化、多智能体协同控制等领域研发工作的工程师。; 使用场景及目标:①用于多智能体系统协同控制算法的研究与教学示范;②为欠驱动船舶的路径跟踪控制、海上集群航行等实际工程应用提供可靠的算法设计思路与仿真验证平台;③支撑相关领域高水平论文撰写、科研项目申报与关键技术攻关。; 阅读建议:建议读者结合提供的Matlab代码逐模块研读,重点关注李雅普诺夫函数的构造技巧与控制器参数的整定方法,并尝试在不同环境扰动(如海流、风浪)下进行仿真实验,以深入理解系统的鲁棒性与适应性。

Codeforces Round #649 (Div. 2) Jun/13/2020 23:05UTC+8

Codeforces Round #649 Div. 2 Jun/13/2020 23:05UTC+8A. XXXXXB. Most socially-distanced subsequenceC. Ehab and Prefix MEXs(构造) 比赛链接 https://codeforces.com/contest/1364 比赛记录 https://blog.csdn.net/cheng__yu_/article/details/105395197 A. XXXXX 题意:给定一个长度为 n 的数组

qq_17080419的博客 2407

无线通信工业级双频大功率无线AP基站:2.4G+5GHz全频段高带宽抗干扰设备在智慧物流与工业自动化场景中的应用

内容概要:斯普莱WiFiSupply WFS7000BDIAC是一款2.4G+5GHz双射频、支持1166Mbps无线速率的电信工业级室外型大功率无线AP基站,具备31dBm×2发射功率、IP68防护等级、-45~85℃宽温工作能力及20万小时MTBF认证,支持TDMA时分多址、AI智能FastRoaming极速漫游(≤30ms)、≤1ms通信延迟等核心技术,适用于复杂电磁环境与恶劣气候下的全天候运行。设备采用4T4R MIMO架构,支持多档频宽调节、链路聚合、高带机量及远距离覆盖(3km以上),选配高增益天线可实现150km以上桥接传输,广泛应用于智慧物流、工业4.0、AGV/AMR、驾考系统、森林防火、车载船载视频等场景。; 适合人群:从事工业无线网络设计、智能制造系统集成、智慧交通与物流信息化的工程技术人员及项目决策者;具备一定网络基础知识并负责无线覆盖方案选型、部署与运维的专业人员。; 使用场景及目标:①在大型仓库、四向穿梭车立体库、PLC产线等工业自动化场景中构建高稳定、低时延无线网络;②为AMR/AGV、堆垛机、无人机、教练车等移动设备提供无缝漫游与实时控制连接;③实现远距离无线桥接与视频回传,如森林防火监控、车载视频传输等;④满足极端环境下(高寒、高温、强电磁干扰)对网络可靠性与安全性的严苛需求; 阅读建议:此文档适用于方案设计前期选型参考,建议结合“产品参数”与“行业应用”章节进行组网模式匹配分析,并重点关注TDMA、FastRoaming、巨量安全隧道等专有技术在实际场景中的适配性,同时核实相关认证信息以确保合规部署。

Codeforces Round #637 (Div. 2) Apr/23/2020 22:45UTC+8

Codeforces Round #637 Div. 2A. Nastya and RiceB. Nastya and DoorC. Nastya and Strange GeneratorD. Nastya and ScoreboardE. Nastya and Unexpected Guest(01BFS) 比赛链接 https://codeforces.com/contest/1341 比赛记录 https://blog.csdn.net/cheng__yu_/article/details/1053

qq_17080419的博客 2282

AI内容安全机制解析:从破甲现象看模型防护与合规边界

AI内容安全机制是保障人工智能模型合规应用的核心技术,其原理基于多层防护体系。通过意图识别、关键词过滤和多模态检测等技术,系统能够实时监控用户输入和模型输出,有效拦截违规内容。这种机制的技术价值在于平衡模型创造力与内容安全性,确保AI生成内容符合伦理规范。在应用场景上,内容安全机制广泛应用于聊天机器人、内容创作平台和企业级AI系统,防止色情、暴力等有害信息的传播。随着破甲等绕过手法的出现,安全机制需要持续进化以应对指令混淆、上下文污染等新型挑战。本文从技术攻防角度深入分析AI内容安全的实现原理与发展趋势,为

1171

水文模型新手必看:用SWAT-CUP做参数率定,如何正确设置预热期、率定期和验证期?(附数据准备避坑指南)

本文详细介绍了使用SWAT-CUP进行水文模型参数率定的完整流程,重点解析了预热期、率定期和验证期的正确设置方法,并提供了数据准备的避坑指南。通过实操步骤和常见问题解决方案,帮助新手快速掌握SWAT-CUP参数率定的核心技巧,提升水文模型模拟精度。

weixin_26875109的博客 384

Codeforces Round #630 (Div. 2) Mar/31/2020 21:35UTC+8

Codeforces Round #630 Div. 2A. Exercising WalkB. Composite ColoringC. K-Complete WordD. Walk on Matrix(构造) 比赛链接 https://codeforces.com/contest/1332 比赛记录 https://blog.csdn.net/cheng__yu_/article/details/105395197 A. Exercising Walk 思路:模拟过程,应该是在同一个方向上面走一步退一

qq_17080419的博客 1012

YOLOv8改进 | 注意力机制 | 添加DAttention (DAT)注意力机制实现极限涨点

本文给大家带来的是YOLOv8改进DAT的教程,其发布于2022年CVPR2022上同时被评选为Best Paper,由此可以证明其是一种十分有效的改进机制,其主要的核心思想是:引入可变形注意力机制和动态采样点(听着是不是和可变形动态卷积DCN挺相似)。同时在网络结构中引入一个DAT计算量由8.9GFLOPs涨到了9.4GFLOPs。本文的讲解主要包含三方面:DAT的网络结构思想、DAttention的代码复现,如何添加DAttention到你的结构中实现涨点,下面先来分享我测试的对比图。

Snu77的博客 1万+

Educational Codeforces Round 87 (Rated for Div. 2) May/17/2020 17:20UTC+8

Educational Codeforces Round 87 Rated for Div. 2A. Alarm ClockB. Ternary StringC1. Simple Polygon EmbeddingC2. Not So Simple Polygon EmbeddingD. MultisetE. Graph Coloring 比赛链接 https://codeforces.com/contest/1354 比赛记录 https://blog.csdn.net/cheng__yu_/articl

qq_17080419的博客 567

网络系统管理专栏-配套练习+知识点详解

网络系统管理专栏-配套练习+知识点详解

bfq05234214的博客 688

SAP ABAP Append structure 介绍

所有在 append structure 上增强的字段都是 append structure 的一部分,这意味着对这些增强所做的任何更改仅仅施加在 append structure 上,而不会影响被增强的 ABAP DDIC 结构。这同样适用于 transport. 激活数据库表或结构时,会找到所有关联的 append structure,并将它们的组件附加到数据库表或结构。Append structure(附加结构)是 ABAP 字典中附加到另一个结构或数据库表并将其组件附加到它们的结构。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 1176

codeforces比赛记录

CF比赛记录 Codeforces Round #641 (Div. 2) May/12/2020 20:35UTC+8 Codeforces Round #639 (Div. 2) May/06/2020 22:35UTC+8 Codeforces Round #638 (Div. 2) May/01/2020 22:35UTC+8 Educational Codeforces Round 86 (Rated for Div. 2) Apr/26/2020 22:35UTC+8 Codeforces Ro

qq_17080419的博客 546

【从零开始学习 SystemVerilog】1.1、SystemVerilog 概述

【从零开始学习 SystemVerilog】1.1、SystemVerilog 概述

努力,加油每一天鸭~ 1042

Codeforces Round #635 (Div. 2) Apr/15/2020 22:35UTC+8

Codeforces Round #635 Div. 2A. Ichihime and Triangle(水)B. Kana and Dragon Quest game(水)C. Linova and Kingdom(BFS + DFS)D. Xenia and Colorful Gems(枚举 + 二分)E. Kaavi and Magic Spell(区间DP) 比赛链接 https://codeforces.com/contest/1337 比赛记录 https://blog.csdn.net/che

qq_17080419的博客 503

无人机:DJI Matrice 200 Series_(13).行业应用案例分析

在前一节中,我们介绍了DJI Matrice 200系列无人机的基本硬件配置和性能参数。本节将通过具体的行业应用案例,分析如何利用DJI Matrice 200系列无人机进行二次开发,以满足不同行业的需求。

zhubeibei168的博客 1453

34、Text2KGBench与GeoQuestions1089:知识图谱生成与地理空间问答的新进展

本文介绍了Text2KGBench和GeoQuestions1089在知识图谱生成与地理空间问答领域的最新进展。Text2KGBench提供了一个开放且可复现的基准,用于从文本生成知识图谱,并结合多个LLM模型和评估工具推动研究。GeoQuestions1089是目前最大的地理空间问答数据集,与GeoQA2系统结合,推动了地理空间问答系统的发展。文章还探讨了技术挑战和未来研究方向,包括多模态知识图谱生成和深度学习优化的地理空间问答系统。

css33的专栏 119

Codeforces Round #646 (Div. 2) May/31/2020 22:35UTC+8

Codeforces Round #646 Div. 2 May/31/2020 22:35UTC+8A. Odd SelectionD. Guess The MaximumsE. Tree ShufflingF. Rotating Substrings 比赛链接 https://codeforces.com/contest/1363 比赛记录 https://blog.csdn.net/cheng__yu_/article/details/105395197 A. Odd Selection 题意:问能

qq_17080419的博客 501

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

Codeforces Global Round 7 Mar/19/2020 22:35UTC+8

Codeforces Global Round 7A. Bad Ugly NumbersB. MaximumsC. Permutation PartitionsD2. Prefix-Suffix Palindrome (Hard version)E. Bombs 比赛链接 比赛记录 https://blog.csdn.net/cheng__yu_/article/details/105395197 A. Bad Ugly Numbers #include <bits/stdc++.h> #d

qq_17080419的博客 488

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

Codeforces Round #629 (Div. 3) Mar/26/2020 22:35UTC+8

Codeforces Round #629 Div. 3A. Divisibility Problem(水)B. K-th Beautiful StringC. Ternary XORD. CarouselF. Make k Equal 比赛链接 https://codeforces.com/contest/1328 比赛记录 https://blog.csdn.net/cheng__yu_/article/details/105395197 A. Divisibility Problem(水) 思路:取

qq_17080419的博客 474

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Educational Codeforces Round 85 (Rated for Div. 2) Apr/10/2020 22:35UTC+8

Educational Codeforces Round 85 Rated for Div. 2A. Level StatisticsB. Middle Class(平均数)C. Circle of Monsters(枚举起点)D. Minimum Euler Cycle(模拟)E. Divisor Paths 比赛链接 https://codeforces.com/contest/1334 比赛记录 https://blog.csdn.net/cheng__yu_/article/details/1053

qq_17080419的博客 470

Codeforces Round #632 (Div. 2) Apr/08/2020 22:35UTC+8

Codeforces Round #632 Div. 2A. Little Artem(水)B. Kind AntonC. Eugene and an array(前缀和零集)D. Challenges in school №41(模拟)E. Road to 1600(构造)F. Kate and imperfection(思维) 比赛链接 https://codeforces.com/contest/1333 比赛记录 https://blog.csdn.net/cheng__yu_/article/de

qq_17080419的博客 466

Educational Codeforces Round 96 Rated for Div. 2 Oct/11/2020 17:05UTC+8

Educational Codeforces Round 96 Rated for Div. 2 Oct/11/2020 17:05UTC+8A. Number of Apartments 比赛链接:https://codeforces.com/contest/1430 比赛记录:https://blog.csdn.net/cheng__yu_/article/details/105395197 A. Number of Apartments 题意: 给定一个 n 问能否由 3 、5 、7 这些数字组成。(

qq_17080419的博客 457

Codeforces Round #636 (Div. 3) Apr/21/2020 22:35UTC+8

Codeforces Round #636 Div. 3A. Candies(水)B. Balanced Array(超级水)C. Alternating Subsequence(实现)D. Constant Palindrome Sum(差分数组)E. Weights Distributing(BFS) 比赛链接 https://codeforces.com/contest/1343 比赛记录 https://blog.csdn.net/cheng__yu_/article/details/1053951

qq_17080419的博客 450

Codeforces Round #638 (Div. 2) May/01/2020 22:35UTC+8

Codeforces Round #638A. Phoenix and Balance(水)B. Phoenix and Beauty(周期)C. Phoenix and Distribution(分类讨论)D. Phoenix and Science(构造)E. Phoenix and Berries(DP)F. Phoenix and Memory(贪心 + 线段树) 比赛链接 https://codeforces.com/contest/1348 比赛记录 https://blog.csdn.net/

qq_17080419的博客 425

Codeforces Round #647 (Div. 2) Jun/04/2020 22:35UTC+8

Codeforces Round #647 Div. 2 Jun/04/2020 22:35UTC+8C. Johnny and Another Rating DropD. Johnny and ContributionE. Johnny and Grandmaster 比赛链接 https://codeforces.com/contest/1362 比赛记录 https://blog.csdn.net/cheng__yu_/article/details/105395197 C. Johnny and A

qq_17080419的博客 418
上一篇: Codeforces Round #635 (Div. 2) Apr/15/2020 22:35UTC+8
下一篇: Codeforces Round #633 (Div. 2) Apr/12/2020 22:05UTC+8
Cheng Yu
博客等级 码龄12年 15粉丝 137原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值