HDU 1080 Human Gene Functions(LCS变形)

嵌入式笔试面试题库 250 题|13 章从 C 语言到 FreeRTOS,每题带追问 面试里有两类问题。第一类问「static 有几个作用」,第二类问「串口丢数据你怎么查」。第一类决定你能不能进二面,第二类决定二面之后还有没有下文。 这份合并版 250 题、13 章,把上篇与下篇收在一本: · 上篇 130 题(一至六章):单片机与体系结构、C 语言关键字、指针与内存、位运算与寄存器、中断与并发、编译链接与内存布局; · 下篇 120 题(七至十三章):GPIO 与时钟、定时器与 ADC、串口 I2C SPI、DMA 与中断、FreeRTOS、通信协议与总线、项目与工程实践。 每题结构一致:一段分点参考答案(①②③ 给要点骨架),紧跟一条追问,写明面试官往下会挖哪一层。答案尽量落到三层——现象、根因、验证方法。比如「PWM 出不来波形」,不只列六项检查顺序,还说清为什么 TIM1 容易漏掉 MOE 这一位、怎么用示波器确认。 三个附录:A 是 40 天复习路线(每天 40 分钟,标每天题量与当章重点);B 是十三章自测评分表(现象 / 根因 / 验证三列打分);C 是按现象查题的排障索引,遇到具体问题直接定位到题号。 交付:Word 可编辑版 + PDF 打印版(A4 / 70 页)+ 使用说明。题号连续 Q001–Q250,目录与附录各一套,跨篇追问能顺着查。 说明:寄存器位定义与分频关系按 STM32F103 系列整理,换 F4/F7/G0 需按对应手册核对;FreeRTOS 部分按 10.x 之后接口描述。题库不替代动手调试。 立即下载

Human Gene Functions

Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 19   Accepted Submission(s) : 14
Font: Times New Roman | Verdana | Georgia
Font Size: ← →

Problem Description

It is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four letters, A, C, G, and T. Biologists have been interested in identifying human genes and determining their functions, because these can be used to diagnose human diseases and to design new drugs for them. 

A human gene can be identified through a series of time-consuming biological experiments, often with the help of computer programs. Once a sequence of a gene is obtained, the next job is to determine its function. One of the methods for biologists to use in determining the function of a new gene sequence that they have just identified is to search a database with the new gene as a query. The database to be searched stores many gene sequences and their functions – many researchers have been submitting their genes and functions to the database and the database is freely accessible through the Internet. 

A database search will return a list of gene sequences from the database that are similar to the query gene. Biologists assume that sequence similarity often implies functional similarity. So, the function of the new gene might be one of the functions that the genes from the list have. To exactly determine which one is the right one another series of biological experiments will be needed. 

Your job is to make a program that compares two genes and determines their similarity as explained below. Your program may be used as a part of the database search if you can provide an efficient one. 

Given two genes AGTGATG and GTTAG, how similar are they? One of the methods to measure the similarity of two genes is called alignment. In an alignment, spaces are inserted, if necessary, in appropriate positions of the genes to make them equally long and score the resulting genes according to a scoring matrix. 

For example, one space is inserted into AGTGATG to result in AGTGAT-G, and three spaces are inserted into GTTAG to result in –GT--TAG. A space is denoted by a minus sign (-). The two genes are now of equal length. These two strings are aligned: 

AGTGAT-G 
-GT--TAG 

In this alignment, there are four matches, namely, G in the second position, T in the third, T in the sixth, and G in the eighth. Each pair of aligned characters is assigned a score according to the following scoring matrix.

* denotes that a space-space match is not allowed. The score of the alignment above is (-3)+5+5+(-2)+(-3)+5+(-3)+5=9. 

Of course, many other alignments are possible. One is shown below (a different number of spaces are inserted into different positions): 

AGTGATG 
-GTTA-G 

This alignment gives a score of (-3)+5+5+(-2)+5+(-1) +5=14. So, this one is better than the previous one. As a matter of fact, this one is optimal since no other alignment can have a higher score. So, it is said that the similarity of the two genes is 14.

Input

The input consists of T test cases. The number of test cases ) (T is given in the first line of the input. Each test case consists of two lines: each line contains an integer, the length of a gene, followed by a gene sequence. The length of each gene sequence is at least one and does not exceed 100. 

Output

The output should print the similarity of each test case, one per line. 

Sample Input

2 
7 AGTGATG 
5 GTTAG 
7 AGCTATT 
9 AGCTTTAAA 

Sample Output

14 
21 

Source

Asia 2001, Taejon (South Korea)


挺难的,不解释了,自己想象把。


#include <iostream>
#include <cstdio>
#include <cmath>
#include <queue>
#include <cstring>
using namespace std;
const int inf = 0x3f3f3f3f;
int l1,l2;
int dp[111][111];
char s1[111],s2[111];
int d[333][333];


void gao()
{
    memset(dp,0,sizeof dp);
    for(int i=1; i<=l1; i++)
    {
        for(int j=1; j<=l2; j++)
        {
            dp[i][j]=-inf;
        }
    }
    dp[0][0]=0;
    for(int i=1; i<=l1; i++)
        dp[i][0]=dp[i-1][0]+d[s1[i]]['-'];
    for(int j=1;j<=l2;j++)
        dp[0][j]=dp[0][j-1]+d[s2[j]]['-'];
    for(int i=1;i<=l1;i++)
    {
        for(int j=1;j<=l2;j++)
        {
            dp[i][j]=max(dp[i][j],dp[i-1][j]+d[s1[i]]['-']);
            dp[i][j]=max(dp[i][j],dp[i][j-1]+d['-'][s2[j]]);
            dp[i][j]=max(dp[i][j],dp[i-1][j-1]+d[s1[i]][s2[j]]);
        }
    }
    printf("%d\n",dp[l1][l2]);

}
int main()
{
    d['A']['A']=5;
d['A']['C']=-1;
d['A']['G']=-2;
d['G']['A']=-2;
d['G']['C']=-3;
d['G']['G']=5;
d['G']['T']=-2;
d['G']['-']=-2;
d['T']['A']=-1;
d['T']['C']=-2;
d['T']['G']=-2;
d['T']['T']=5;
d['T']['-']=-1;
d['-']['A']=-3;
d['-']['C']=-4;
d['-']['G']=-2;
d['-']['T']=-1;
d['-']['-']=-inf;
d['A']['T']=-1;
d['A']['-']=-3;
d['C']['A']=-1;
d['C']['C']=5;
d['C']['G']=-3;
d['C']['T']=-2;
d['C']['-']=-4;
    int T;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d%s%d%s",&l1,s1+1,&l2,s2+1);
        gao();
    }


}



政府科技管理者如何提升科技成果评估的准确性与透明度?.docx 政府科技管理者如何提升科技成果评估的准确性与透明度? 立即下载

相关推荐

双闭环PWM整流器VOC控制 +SVPWM调制仿真(Simulink仿真实现)

内容概要:本文详细介绍了基于Simulink平台构建的双闭环PWM整流器VOC(虚拟磁链定向控制)与SVPWM(空间矢量脉宽调制)相结合的仿真模型,系统阐述了三相电压型PWM整流器在电压定向控制策略下的建模方法与控制实现。通过设计外环直流电压控制与内环电流控制的双闭环结构,实现了对整流器的高功率因数运行、能量双向流动及动态性能优化的精确调控。结合SVPWM调制技术,有效提升了直流侧电压利用率并显著降低输出电流谐波含量,增强了系统的整体效率与稳定性。该仿真模型适用于新能源发电、电动汽车充电系统、微电网等高性能电能变换应用场景,文档还配套提供了丰富的学习资源与技术支持渠道,便于深入研究与工程实践。; 适合人群:面向电气工程、自动化、电力电子及相关专业的高校学生、科研人员以及从事新能源、智能电网、电力传动等领域研发工作的工程师;尤其适合已具备自动控制理论、电力电子变换技术和MATLAB/Simulink仿真基础的专业人士进一步深化学习与应用。; 使用场景及目标:①深入理解PWM整流器的工作机理及其双闭环控制系统的架构设计;②掌握VOC控制与SVPWM调制的协同工作机制,提升系统动静态响应性能;③支撑科研课题、课程设计、毕业设计或实际工程项目中的整流器控制系统开发与验证;④作为高级电能变换技术的学习范例,促进对现代电力电子系统控制策略的综合理解与创新能力培养。; 阅读建议:建议结合文中提供的百度网盘链接与公众号资源,下载完整的Simulink仿真模型进行实操演练,在MATLAB环境中调整控制器参数并观察仿真结果,深入剖析控制逻辑与系统响应特性;同时可参考同系列资源如PI双闭环控制、电网不平衡工况下的控制策略等案例,开展对比分析与拓展研究,全面提升系统建模与控制设计的综合能力。

hdu1080 Human Gene Functions————LCS变形

It is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four letters, A, C, G, and T. Biologists have been interested in identi...

连长少尉 192

两路半桥LLC谐振变换器软开关Simulink仿真(模拟谐振参数不同、分裂电容)

内容概要:本文围绕两路半桥LLC谐振变换器的软开关技术展开,基于Simulink平台构建了详细的仿真模型,重点研究了不同谐振参数(如谐振电感、谐振电容)以及分裂电容结构对系统性能的影响。通过开环与闭环控制策略的对比分析,探讨了变换器在启动过程中的动态响应特性与稳定性,并实现了软启动设计,有效降低了启动冲击。仿真内容涵盖谐振腔的工作模态、ZVS(零电压开关)与ZCS(零电流开关)的实现条件,以及分裂电容对电压均衡和效率的优化作用,全面展示了LLC变换器在高频高效电源中的应用潜力。; 适合人群:电力电子、电气工程及相关专业的高校研究生、科研人员及从事开关电源设计的工程技术人员。; 使用场景及目标:①用于深入理解LLC谐振变换器的工作原理与软开关实现机制;②为高频高效率DC-DC变换器的研发提供仿真验证平台;③支撑科研项目中的拓扑优化与控制算法设计,尤其适用于需要分裂电容结构提升性能的场合。; 阅读建议:建议结合电力电子基础理论,先掌握LLC谐振变换器的基本工作模态,再逐步深入仿真模型细节,重点关注参数扫描与闭环动态响应的仿真结果,以实现理论与实践的有效结合。

hdu1080 Human Gene Functions(LCS变形)

Human Gene Functions Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1338Accepted Submission(s): 767 Problem Description It is well ...

angtongyou1893的博客 295

双Buck电路并联VDCM下垂控制(Simulink仿真实现)

内容概要:本文提供了一个基于Plecs软件的全桥LLC谐振变换器高精度仿真模型,旨在通过系统化建模与仿真手段深入剖析LLC谐振变换器的工作原理、动态响应特性及关键参数设计方法。该模型完整涵盖主电路拓扑结构、软开关实现机制、谐振参数配置与闭环控制策略等核心内容,支持对变换器的效率优化、电压调节能力、谐波抑制性能及瞬态响应等关键指标进行全面评估,适用于电力电子领域的科研分析、工程设计与教学实践。; 适合人群:具备电力电子技术基础及相关仿真经验的高校研究生、科研机构研究人员以及从事高频开关电源、DC-DC变换器开发的工程技术人员。; 使用场景及目标:①深入理解全桥LLC谐振变换器的软开关实现机理与谐振腔参数(如Lr、Cr、Lm)的设计方法;②验证并优化电压/频率闭环控制策略,提升系统动态性能与稳定性;③作为高校课程或培训项目的教学案例,帮助学生掌握高频谐振变换器的建模、仿真与分析流程。; 其他说明:该仿真模型可与MATLAB/Simulink等工具联合使用,便于进行控制系统算法开发与系统级协同仿真;建议使用者结合理论计算、仿真调试与实验验证,形成“设计-仿真-验证”的完整闭环,以全面提升对LLC变换器系统级理解与工程应用能力。

【大模型智能体】高频面试题解析:核心技术与多场景应用系统设计

内容概要:本文档是一份大模型与智能体领域的高频面试题集,系统梳理了从Python基础、数据结构与算法、机器学习、深度学习、NLP到大模型核心技术(如Transformer、LayerNorm、LoRA、RAG、Agent)的完整知识体系。文档通过23个实战项目(如智能客服、商品图谱、RAG问答系统等)串联理论,涵盖项目周期、技术架构、实现流程、核心模块与技术细节,深入探讨了分布式训练、模型微调、函数调用、记忆管理等前沿技术,旨在帮助开发者掌握大模型应用开发与面试应对的综合能力。; 适合人群:具备一定编程基础,工作1-3年的研发人员。; 使用场景及目标:①系统掌握大模型与智能体的核心技术栈,为求职面试做准备;②学习如何将理论知识应用于实际项目,如构建智能客服、RAG系统和多智能体协作平台。; 阅读建议:此资源以开发简化版Spring学习其原理和内核,不仅是代码编写实现也更注重内容上的需求分析和方案设计,所以在学习的过程要结合这些内容一起来实践,并调试对应的代码。

HDU 1080 Human Gene Functions(变形的LCS)

这题一开始写成了先算出LCS长度,然后往回跑,把公共子串剔除,然后算值,最后发现这样做答案就固定了= =,无法求出最大值了。 后来看到题解,恍然大悟,发现自己实在太蠢了,这题三种选择,对应字符匹配,上字符对应-,下字符对应-,然后LCS框架上去了就可以了。#include #include #include #include #include using namespace std; const

qq_33901573的博客 245

产业园区运营负责人如何解决入驻企业技术需求与本地优质科研资源对接不畅的问题?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

HDU 1080 Human Gene Functions LCS变形问题

点击打开链接     Human Gene Functions Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1709    Accepted Submission(s): 961 Problem Descrip

代码改变世界,keep coding。 1188

【Linux系统】Linux rm命令详解

内容概要:本文详细介绍了Linux系统中的rm命令,包括其基本语法、常用选项及其功能,强调了该命令在删除文件或目录时的高效性与高风险性。文章指出rm命令会永久删除数据且难以恢复,特别警示使用-rf等参数时的危险性,并列举了rm -rf /可能带来的灾难性后果。同时,提供了多个使用示例,涵盖普通文件删除、交互式确认、递归删除目录及处理特殊命名文件等情况。此外,文章还介绍了误删后的数据恢复方法,如通过lsof查找未释放的文件句柄或使用extundelete、TestDisk等工具尝试恢复,并对比了rm与unlink命令的区别。最后,提出了多项安全使用建议,如设置别名、使用trash-cli替代rm、定期备份等,旨在帮助用户安全、规范地使用rm命令。; 适合人群:Linux系统管理员、运维工程师及具备基础Linux操作能力的开发者;尤其适用于需要频繁进行文件管理与清理工作的技术人员; 使用场景及目标:①掌握rm命令的核心用法与常见选项组合;②理解其潜在风险并学习如何避免误操作导致的数据丢失;③在实际工作中应用安全策略,提升系统操作的安全性与可靠性; 阅读建议:此资源不仅讲解命令本身,更侧重于安全意识培养与最佳实践指导,建议结合实验环境动手练习,重点理解-i、-r、-f等关键选项的影响,并配置alias和trash-cli等防护措施,强化操作前的确认流程。

【XR硬件介绍】PICO Space Pro(Project Swan)深度解析:字节 2026 旗舰 MR 头显延期背后

内部代号 Project Swan 的 PICO 年度旗舰 MR 头显正式定名PICO Space Pro,原本计划 2026 年 9 月对外发布,官方官宣推迟至 2026 年第四季度上市。硬件层面已经完成 FCC 认证,硬件成熟度较高,延期核心目标是打磨 PICO OS 6 空间操作系统,补齐空间计算软件能力。本文从产品背景、硬件架构、软件生态、延期逻辑、行业竞争格局几个维度拆解这款国产高端 MR 设备,分析它对国内 XR 产业的意义与待解的问题。

houdou112358的博客 1169

hdu 1080 Human Gene Functions (LCS的变形)

题意:有一个基因配对表,基因序列任意位置可插入空位‘-’使两段基因序列相等,求按最佳方案插入空位后得到的             两段基因序列的最大匹配值。 分析:类似于最长公共子序列。 dp方程:dp[i][j]=max(dp[i-1][j-1]+solve(s1[i],s2[j]),dp[i-1][j]+solve(s1[i],'-'),dp[i][j-1]+solve('-',s2[j

虽然冲动永远比坚持容易~ 875

512分辨率万能遮罩模型实战指南:从下载到高精度应用

本文提供了512分辨率万能遮罩模型的完整实战指南。该模型经过超过540万次迭代,专门优化了对头发、手、眼睛等复杂区域的识别。文章详细介绍了从可靠渠道下载、环境部署、使用DF_ICE工具批量应用遮罩,到利用XSeg Editor进行高精度精修的全流程,旨在帮助用户显著提升AI换脸合成视频的质量与效率。

y2z3a4b5c的博客 1162

hdu 1080 Human Gene Functions --- LCS问题变形

题意: 两个字符串 包含 A T C G - 五种字符 两两之间对应一个数值 给两个字符串 可以向其中添加一定的-  要使两字符串对应分值和最大 求该值 很好的LCS变形。。 dp[i][j]表示s1前i位和s2前j位所能构成的最大值 那么 如何递推呢 根据题意 比较到 i j 位时 此时可以有三种情况 1、s1[i] 对应 - 2、s2[j] 对应 - 3、s1[i]

Unknown 957

黑猫带你学UFS协议第12篇:UFS标志(Flags)和属性(Atrributes)详解

UFS中的标志其实就是一些开关,布尔型,非0即1,打开或者关闭。这些标志可以用来使能或者禁止UFS设备的一些功能、模式或者状态。 简单来说,flag和attribute、discriptor一样,都是ufs的寄存器罢了。只不过spec将这些寄存器分类了,分成这三种大的类型了而已。 标志可以被清除、复位、设置、触发、读。 主机也是通过设备管理器的Query Request UPIU来读取或者写标志。

黑猫奥利奥的博客 2083

Windows窗口编程中的WM_PAINT、WM_ERASEBKGND、InvalidateRect、UpdateWindow、BeginPaint和EndPaint等函数详解

Windows窗口编程中的WM_PAINT、WM_ERASEBKGND、InvalidateRect、UpdateWindow、BeginPaint和EndPaint等函数详解

dvlinker的技术专栏 7165

HDU 1080 Human Gene Functions(LCS变形)

Human Gene Functions Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2661    Accepted Submission(s): 1504 Problem Description It is

左眼皮跳跳 636

【Halcon 】Halcon 实战:如何为 XLD 模板添加极性信息以提升匹配精度?

本文介绍了Halcon中为XLD轮廓模板添加极性信息的实用技巧。通过先以"ignore_local_polarity"模式创建模板,首次匹配获得位置后,使用set_shape_model_metric运算符结合真实图像为模板注入极性信息(边缘明暗方向)。这种方法弥补了XLD模板初始不支持极性的缺陷,可显著提升后续匹配的精度和抗干扰能力。实验显示,添加极性信息后的模板匹配效果明显优于无极性的匹配结果。该技术特别适用于基于手动绘制或处理后的XLD轮廓创建模板的场景。

songhuangong123的博客 750

hdu 1080 Human Gene Functions (LCS变形)

Human Gene Functions Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2453    Accepted Submission(s): 1393 Problem Description It is wel

24小时的程序员 489

OpenCV实现文档扫描OCR识别(基于Python + OpenCV,含完整代码)

在当今数字化时代,文档处理的自动化需求日益增长。文档扫描OCR(Optical Character Recognition,光学字符识别)技术成为了将纸质文档转换为可编辑电子文本的关键手段。通过Python与OpenCV库的结合,我们能够实现高效、准确的文档扫描OCR识别。这一技术在办公自动化、数字图书馆、档案管理等众多领域都有着广泛的应用。

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 2030

基于Simulink的无线充电系统LCC补偿网络建模与控制

本文详细介绍了基于Simulink的无线充电系统LCC补偿网络建模与控制方法。首先分析了LCC补偿网络的恒流输出、软开关实现和抗偏移能力等优势,并对比了不同补偿拓扑特性。随后分步骤讲解了Simulink建模流程,包括LCC主电路构建、关键参数设计、双闭环控制系统实现等核心环节。重点阐述了移相控制策略和软开关验证方法,提供了系统效率计算和抗偏移测试的调试技巧。最后展示了仿真结果,在耦合系数变化20%时,闭环系统仍能保持输出电压稳定在±2%波动范围内。文章还探讨了工程扩展方向,并针对常见问题给出了解决方案,为无

xiaoheshang_123的博客 539

hdu 1080 Human Gene Functions (LCS变形)

Human Gene Functions Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2402    Accepted Submission(s): 1360 Problem Description It is

Coding A World 773

【华为OD机试真题】4、字符统计及重排 | 机试真题+思路参考+代码解析(C++、Java、Py)

题目描述 >给出一个仅包含字母的字符串,不包含空格,统计字符串中各个字母(区分大小写)出现的次数, 并按照字母出现次数从大到小的顺序。输出各个字母及其出现次数。 如果次数相同,按照自然顺序进行排序,且小写字母在大写字母之前

KJ.JK 3289

POJ 1080 Human Gene Functions(求两字符串相似度:LCS变形)

POJ 1080 Human Gene Functions(求两字符串相似度:LCS变形) http://poj.org/problem?id=1080 题意: 给你两个由字符A,C,G,T构造的字符串s1和s2, 现在你可以在这两个字符串中插入空格, 使得两串长相等(但是不能使得s1的空格对应s2的空格位置). 然后给你s1的特定字符对应s2中特定字符所能获得的分数矩阵: 问你最后两个字符串所能获得的最大分数是多少? 分析: 本题很类似于求字符串最短编辑距离或者求

code 1315

深度学习工具包 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'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('DeepLearnToolbox'));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('state',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'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',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 = 'sigm';%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, 'Too big error');```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('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';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)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';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, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% 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'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 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, 'Too big error');```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('state',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, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',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, 'Too big error');%% ex3 neural net with dropoutrand('state',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, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % 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, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % 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, 'Too big error');%% 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('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % 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, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

HDU 1080 Human Gene Functions 带权的最长公共子序列

点击打开链接 题意:给定两个字符串 s1 和 s2 ,在两个串中都可以插入空格,使两个串的长度最后相等,然后开始匹配,怎样插入空格由匹配规则得到的值最大。 分析:LCS的变形 d[i][j]=max(d[i-1][j-1]+match[ s1[i] ][ s2[j] ] , d[i-1][j]+match[ s1[i] ][ '-' ] , d[i][j-1]+match[ '-' ][ s

became_a_wolf的专栏 558

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

HDU 1080 Human Gene Functions - 最长公共子序列(变形)

传送门 题目大意: 将两个字符串对齐(只包含ACGT,可以用'-'占位),按照对齐分数表(参见题目)来计算最后的分数之和,输出最大的和。 例如:AGTGATG 和 GTTAG ,对齐后就是(为了表达对齐,这里我用m表示'-') AGTGATG mGTTAmG 题目分析: 首先看出这道题与LCS有关,下面来考虑转移: 当t1[i]==t2[j]时,和LCS一样,\(dp[i][j] = dp[i...

weixin_30648587的博客 133

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

上一篇: HDU 2601 An easy problem(求因数)
下一篇: HDU 1025 Constructing Roads In JGShining's Kingdom(最长递增子序列)
Mr_Treeeee
博客等级 码龄10年 38粉丝 551原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值