HDU 6208 ac自动机 hash sam 后缀数组

两相交错并联BuckBoost变换器仿真模型(Simulink仿真实现) 内容概要:本文档系统整合了电力电子与新能源领域的Simulink仿真资源,聚焦于两相交错并联Buck-Boost变换器的双闭环PWM控制建模与仿真,同时涵盖多种典型拓扑结构,包括交错并联Boost、PFC功率因数校正、LLC谐振变换器、双向CLLC、DAB变换器、VIENNA整流器等。资源体系完整,包含仿真模型、设计报告、计算书、PPT说明文档及Matlab/Python代码,覆盖从基础建模到高级控制策略(如软开关技术、谐波抑制、状态估计、双闭环控制)的全流程。此外,还拓展至状态估计(卡尔曼滤波、粒子滤波)、智能优化算法、机器学习、信号处理、路径规划等多个交叉学科方向,构建了一个面向科研与工程应用的综合性技术平台。; 适合人群:电气工程、自动化、电力电子、新能源科学与工程等专业的硕士博士研究生、高校科研人员,以及从事新能源发电、智能电网、电动汽车、电力传动等领域技术研发的工程师。; 使用场景及目标:①开展电力电子变换器(如Buck-Boost、LLC、DAB、PFC等)的建模、控制与仿真研究;②支撑课程设计、学位论文、科研项目中的系统仿真与算法验证;③学习并复现高水平期刊(如EI)提出的先进控制策略,如基于KKT条件的最优控制、扩展移相调制、恒压恒流双环竞争控制等;④结合智能算法(如粒子群、秃鹰算法)进行微电网调度、储能配置、路径规划等多目标优化问题的研究与快速原型开发。; 阅读建议:建议依据提供的资源目录循序渐进地查阅资料,优先选取与自身研究方向高度契合的内容进行深入学习;应结合仿真模型与配套文档动手实践,调试参数并分析结果,充分利用百度网盘与公众号渠道获取完整资源,提升科研工作的系统性、规范性与创新性。 立即下载

太可惜了:基本什么方法都能过..我们老是想着sam..

简略题意:问是否存在一个串,其他串都是他的子串

ac自动机: (输入挂很重要..)

#include<bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i = a; i <= b; ++i)
#define FOR(i,a,b) for(int i = a; i < b; ++i)
#define mem(a,b) memset(a,b,sizeof(a))
#define MP make_pair
typedef long long LL;
typedef pair<int,int> pii;

namespace FastIO {
#define BUF_SIZE 100010 //缓冲区大小可修改
    bool IOError = 0; //IOError == false 时表示处理到文件结尾
    inline char NextChar() {
        static char buf[BUF_SIZE], *p1 = buf + BUF_SIZE, *pend = buf + BUF_SIZE;
        if(p1 == pend) {
            p1 = buf;
            pend = buf + fread(buf, 1, BUF_SIZE, stdin);
            if(pend == p1) {
                IOError = 1;
                return -1;
            }
        }
        return *p1++;
    }
    inline bool Blank(char c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t';
    }

    inline void read(int &x){
        bool sign=0; char ch=NextChar(); x=0;
        for (;Blank(ch);ch=NextChar());
        if (IOError)return;
        if (ch=='-')sign=1,ch=NextChar();
        for (;ch>='0'&&ch<='9';ch=NextChar())x=x*10+ch-'0';
        if (sign)x=-x;
    }
    inline void read(long long &x){
        bool sign=0; char ch=NextChar(); x=0;
        for (;Blank(ch);ch=NextChar());
        if (IOError)return;
        if (ch=='-')sign=1,ch=NextChar();
        for (;ch>='0'&&ch<='9';ch=NextChar())x=x*10+ch-'0';
        if (sign)x=-x;
    }
    inline void read(double &x){
        bool sign=0; char ch = NextChar(); x=0;
        for (;Blank(ch);ch = NextChar());
        if (IOError)return;
        if (ch=='-')sign=1,ch=NextChar();
        for (;ch>='0'&&ch<='9';ch=NextChar())x=x*10+ch-'0';
        if (ch=='.'){
            double tmp=1; ch=NextChar();
            for (;ch>='0'&&ch<='9';ch=NextChar())tmp/=10.0,x+=tmp*(ch-'0');
        }
        if (sign)x=-x;
    }
    inline void read(char *s){
        char ch=NextChar();
        for (;Blank(ch);ch=NextChar());
        if (IOError)return;
        for (;!Blank(ch)&&!IOError;ch=NextChar())*s++=ch;
        *s=0;
    }
    inline void read(char &c){
        for (c=NextChar();Blank(c);c=NextChar());
        if (IOError){c=-1;return;}
    }
}
using namespace FastIO;

const int maxn = 100000;
const int maxnode = 100000, c_sz = 26;

bool vist[maxn + 5];

struct Tire {
    int top;
    int nex[maxnode + 5][c_sz], val[maxnode + 5];
    int go[maxnode + 5], go_len[maxnode + 5];
    int fail[maxnode + 5], last[maxnode + 5];
    void clear() {
        top = val[0] = 0;
        mem(nex[0], 0);
    }
    inline int c_id(char c) { return c - 'a'; }
    bool Insert(char *a, int len, int vv) {
        int u = 0, t;
        for(int i = 0; i < len; ++i) {
            t = c_id(a[i]);
            if(!nex[u][t]) {
                nex[u][t] = (++top), val[top] = 0;
                mem(nex[top], 0);
            }
            u = nex[u][t];
        }
        if(val[u])
            vist[vv] = 1;
        else
            val[u] = vv;
    }
    void GetFail() {
        fail[0] = last[0] = 0;
        queue<int> q;
        for(int i = 0; i < c_sz; ++i) if(int &t = nex[0][i]) {
            fail[t] = last[t] = 0;
            q.push(t);
        }
        while(!q.empty()) {
            int x = q.front(); q.pop();
            for(int i = 0; i < c_sz; ++i) {
                int u = nex[x][i];
                if(!u) { nex[x][i] = nex[fail[x]][i]; continue; }
                q.push(u);
                int v = fail[x];
                while(v && !nex[v][i]) v = fail[v];
                fail[u] = nex[v][i];
                last[u] = val[fail[u]] ? fail[u] : last[fail[u]];
            }
        }
    }
    void find(int x) {
        if(x) {
            vist[val[x]] = 1;
            find(last[x]);
        }
    }
    void Run(char *a, int len) {
        int u = 0;
        for(int i = 0; i < len; ++i) {
            int t = c_id(a[i]);
            u = nex[u][t];
            vist[val[u]] = 1;
            find(last[u]);
        }
    }
} AC;

int llen[maxn + 5], pos[maxn + 5];
char str[maxn + 5];

int main() {
    int xx, ll, n, T;
    //scanf("%d", &T);
    read(T);
    while(T--) {
        //scanf("%d", &n);
        read(n);
        pos[0] = 0, llen[0] = 0;
        xx = 0, ll = 0;
        AC.clear();
        for(int i = 1; i <= n; ++i) {
            vist[i] = 0;
            pos[i] = pos[i - 1] + llen[i - 1];
            //scanf("%s", str + pos[i]);
            read(str + pos[i]);
            llen[i] = strlen(str + pos[i]);
            AC.Insert(str + pos[i], llen[i], i);
            if(ll < llen[i])
                xx = i, ll = llen[i];
        }
        AC.GetFail();
        AC.Run(str + pos[xx], ll);
        int fg = 1;
        for(int i = 1; i <= n; ++i) {
            if(!vist[i]) {
                fg = 0;
                break;
            }
        }
        if(fg) {
            for(int i = 0; i < ll; ++i)
                printf("%c", *(str + pos[xx] + i));
            printf("\n");
        }
        else printf("No\n");
    }
    return 0;
}

ac自动机(2):

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#define ms(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
const int N = 100010;
const int M = 26;

struct AC
{
    int ch[N][M], fail[N], val[N];
    int sz;
    void init()
    {
        sz = 1;
        memset(ch[0], 0, sizeof(ch[0]));
        memset(val, 0, sizeof(val));
    }
    int idx(char c)
    {
        return c - 'a';
    }
    void add(char *s)
    {
        int n, now = 0;
        n = strlen(s);
        for (int i = 0; i < n; i++)
        {
            int id = idx(s[i]);
            if (ch[now][id] == 0)
            {
                memset(ch[sz], 0, sizeof(ch[sz]));
                ch[now][id] = sz++;
            }
            now = ch[now][id];
        }
        val[now]++;
    }
    void Build()
    {
        queue<int>que;
        fail[0] = 0;
        for (int i = 0; i < M; i++)
        {
            int u = ch[0][i];
            if (u)
            {
                fail[u] = 0;
                que.push(u);
            }
        }
        while (!que.empty())
        {
            int r = que.front();
            que.pop();
            for (int c = 0; c < M; c++)
            {
                int u = ch[r][c];
                if (!u)
                {
                    continue;
                }
                que.push(u);
                int v = fail[r];
                while (v && !ch[v][c])
                {
                    v = fail[v];
                }
                fail[u] = ch[v][c];
            }
        }
    }
    int Query(char *s)
    {
        int n, now = 0, ans = 0;
        n = strlen(s);
        for (int i = 0; i < n; i++)
        {
            int id = idx(s[i]);
            while (now && !ch[now][id])
            {
                now = fail[now];
            }
            now = ch[now][id];
            int t = now;
            while (t && val[t] != -1)
            {
                ans += val[t];
                val[t] = -1;
                t = fail[t];
            }
        }
        return ans;
    }

} ac;
char s[100010], a[100010];
int main()
{
    ios::sync_with_stdio(false);
    int T, n;
    cin >> T;
    while (T--)
    {
        cin >> n;
        if (n == 0)
        {
            cout << "No" << endl;
            continue;
        }
        int maxx = 0, hh = n, len;
        ac.init();
        while (hh--)
        {
            cin >> a;
            len = strlen(a);
            ac.add(a);
            if (len > maxx)
            {
                maxx = len;
                strcpy(s, a);
                s[len] = '\0';
            }
        }
        ac.Build();
        if (ac.Query(s) == n)
        {
            cout << s << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    return 0;
}

sam:

#include <stdio.h>
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>

using namespace std;

const int MAXN = 110005;

struct SAM_Node{
    int mxn;int ch[26];
    int par;int right;
    void init(){
        mxn = 0,par = -1,right = -1;
        memset(ch, -1, sizeof(ch));
    }
} sampool[170005];
int samtot;
inline int samlen(int x){
    if(sampool[x].par != -1) return sampool[x].mxn - sampool[sampool[x].par].mxn;
    return sampool[x].mxn;
}
inline int samalloc(){
    sampool[samtot].init();
    return samtot++;
}
inline void samclone(int src,int dst){
    sampool[dst] = sampool[src];
}
inline void saminit(){
    samtot = 0;
    sampool[samtot++].init();
}
int samappend(int lst,int x){
    x -= 'a';
    int p = lst;
    int np = samalloc();
    sampool[np].mxn = sampool[p].mxn + 1;
    while(p != -1 && sampool[p].ch[x] == -1){
        sampool[p].ch[x] = np;
        p = sampool[p].par;
    }
    if(p != -1){
        int q = sampool[p].ch[x];
        if(sampool[q].mxn == sampool[p].mxn + 1){
            sampool[np].par = q;
        }else{
            int nq = samalloc();
            samclone(q,nq);
            sampool[nq].right = -1;
            sampool[nq].mxn = sampool[p].mxn + 1;
            sampool[q].par = sampool[np].par = nq;
            while(q != -1 && sampool[p].ch[x] == q){
                sampool[p].ch[x] = nq;
                p = sampool[p].par;
            }
        }
    }else{
        sampool[np].par = 0;
    }
    return np;
}

int N;
char buf[MAXN];
struct String{
    int l;int r;
    int len(){
        return r-l+1;
    }
    bool operator < (const String &b) const{
        return (r-l+1) < (b.r-b.l+1);
    }
} str[MAXN];
int tot = 0;

int main(){

    int caseCnt = 0;
    scanf(" %d",&caseCnt);
    for(int __ = 1; __ <= caseCnt; ++__){
        scanf(" %d",&N);
        tot = 0;
        for(int i = 1;i <= N; i++){
            scanf(" %s",buf+tot);
            str[i].l = tot;
            tot += strlen(buf+tot);
            str[i].r = tot-1;
        }
        sort(str+1,str+1+N);
        saminit();
        int lst = 0;
        for(int i = str[N].l; i <= str[N].r; i++){
            lst = samappend(lst,buf[i]);
        }
        bool pass = true;
        for(int i = 1;i < N; i++){
            int cur = 0;
            for(int j = str[i].l; j <= str[i].r; j++){
                if(sampool[cur].ch[buf[j]-'a'] == -1){
                    pass = false;
                    break;
                }
                cur = sampool[cur].ch[buf[j]-'a'];
            }
            if(!pass) break;
        }
        if(pass){
            for(int i = str[N].l; i <= str[N].r; i++){
                putchar(buf[i]);
            }
            puts("");
        }else{
            puts("No");
        }
    }

    return 0;
}

kmp

//#include<bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
#define sf scanf
#define pf printf
#define mem(a,b) memset(a,b,sizeof(a));
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define MP make_pair
#define ULL unsigned long long
#define LL   long long
#define inf 0x3f3f3f3f
#define md ((ll+rr)>>1)
#define ls (i<<1)
#define rs (ls|1)
#define eps 1e-5
#define ree freopen("in.txt","r",stdin);
#define bug pf("----------------");
#define N 100010
#define M 1000020
int n;

int f[N];
void getfail(char *p){
    f[0]=f[1]=0;
    int len=strlen(p);
    for(int i=1;i<len;++i){
        int j=f[i];
        while(j&&p[j]!=p[i])j=f[j];
        f[i+1]= p[i]==p[j]?j+1:0;
    }
}
int  kmp(char *s,char *p){
    int lenp=strlen(p);
    int lens=strlen(s);
    getfail(p);
    int j=0;
    for(int i=0;i<lens;++i){
        while(j&&s[i]!=p[j])j=f[j];
        if(s[i]==p[j])j++;
        if(j==lenp)return 1;
    }
    return 0;
}
char *pos[N];
char str[N*100];
char *s;

int main(){
    //ree
    int T;sf("%d",&T);
    while(T--){
        sf("%d",&n);
        char *o=str;
        int fg=1;
        int maxlen=0;
        for(int i=1;i<=n;++i){
            sf("%s",o);
            int len=strlen(o);
            if(len>maxlen){
                maxlen=len;
                s=o;
            }
            pos[i]=o;
            o+=strlen(o)+2;
        }
        for(int i=1;i<=n;++i){
            if(!kmp(s,pos[i])){
                fg=0;break;
            }
        }
        if(fg)puts(s);
        else puts("No");
    }
}

hash

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int MAXN = 100000 + 10;

struct Hash
{
    static const ll key = 137;
    ll H[MAXN], xp[MAXN];
    void init(const char s[], int len)
    {
        H[len] = 0;
        for(int i = len - 1; i >= 0; i--)
            H[i] = H[i + 1] * key + s[i];
        xp[0] = 1;
        for(int i = 1; i <= len; i++)
            xp[i] = xp[i - 1] * key;
    }
    ll get(int pos, int len)
    {
        return H[pos] - H[pos + len] * xp[len];
    }
}ha;
char buf[MAXN];
ll H[MAXN];
vector<int> F[256];
char fst[MAXN];
int L[MAXN];

int main()
{
    int T;
    scanf("%d", &T);
    while(T--)
    {
        int n;
        scanf("%d", &n);
        string str;
        int select = -1;
        for(int i = 0; i < n; ++i)
        {
            scanf("%s", buf);
            int l = strlen(buf);
            fst[i] = buf[0];
            L[i] = l;
            if(str.size() < l)
            {
                str = buf;
                select = i;
            }
            ll h = 0;
            for(int i = l - 1; i >= 0; --i) h = h * 137LL + buf[i];
            H[i] = h;
        }
        ha.init(str.c_str(), str.size());
        for(char c = 'a'; c <= 'z'; ++c) F[c].clear();
        for(int i = 0; i < str.size(); ++i) F[str[i]].push_back(i);
        bool ok = true;
        for(int i = 0; i < n && ok; ++i)
        {
            if(i == select) continue;
            ok = false;
            for(auto p : F[fst[i]])
            {
                if(p + L[i] <= str.size() && ha.get(p, L[i]) == H[i]) {
                    ok = true;
                    break;
                }
            }
        }
        if(ok)
            puts(str.c_str());
        else
            puts("No");
    }
    return 0;
}
移动硬盘报错0x80070570?5分钟搞定CHKDSK修复(附详细参数说明) 本文针对移动硬盘报错0x80070570问题,提供了详细的CHKDSK修复方法。通过5分钟核心修复流程,指导用户使用系统自带工具快速修复文件系统逻辑错误,恢复硬盘访问。文章还深入解析了CHKDSK参数,并提供了备选数据恢复方案与日常防护建议。 阅读详情

相关推荐

手机抽奖页面代码html,html5大转盘抽奖支持手机转盘抽奖代码

特效描述:html5 大转盘抽奖 支持手机 转盘抽奖代码。html5转盘,html5抽奖,手机转盘,手机抽奖,手机转盘抽奖,可配置奖品抽奖。代码结构1. 引入CSS2. 引入JS3. HTML代码大转盘活动var turnplate={restaraunts:[],//大转盘奖品名称colors:[],//大转盘奖品区块对应背景颜色outsideRadius:192,//大转盘外圆的半径textR...

weixin_39628551的博客 1866

hdu6208

比赛用了cin输入,T了一下午 #include #include #include #include #include using namespace std; string s[100005]; char s1[100005]; int main() { int t; scanf("%d",&t); while(t--) { int n,l=0,ind,len; scanf(

qq_38729260的博客 311

基于Kubernetes的ML平台架构设计

本文在Kubernetes开源组件的基础上,对ML平台各部分组件的作用进行了介绍,并且进行了组件选型,初步设计了ML平台的技术架构。

2401_83124266的博客 2052

HDU 6208 AC自动机

题意:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6208 给出n个字符串,要求找到一个字符串包含其他所有的字符串。思路:肯定是最长的那个字符串,如果存在两个不一样的额且长度都是最长的字符串,就肯定找不到。否则就用AC自动机跑一遍所有的串即可。代码:#include <bits/stdc++.h> using namespace std; #def

Bahuia的博客 953

摄像头读取出现VIDIOC_STREAMON: No space left on device 错误

先说下原因,linux中为usb camera提供了一个标准的V4L2的驱动以方便使用,只要符合驱动规范就可以实现即插即用usb camera设备,即免驱动安装。 但市面上的USB 摄像头都是2.0的。usb bus的 bandwidth是有限的,而V4L2驱动采用的是贪心原则,即camera会要求获取最大带宽;因此将两个camera接入一路usb bus,打开第二个camera(尤其是采用YUV...

houge101的博客 9288

大模型面试题52:LLM如果在训练过程中loss值出现spike应该怎么办?

小白急救:停更→回滚→降LR→裁剪梯度,先保住训练不崩溃;进阶排查:查数据→查优化器→查硬件,找到spike的根因并解决;深层预防:预处理保守配置+训练中实时监控,从源头规避spike。先止损,再溯源,最后预防。

叫好与叫座虽然不是对立面,但想在同一个作品中达到双重效果很难。 1169

hdu6208(cin取消同步)

题目题意:要寻找一个串是其他所有串的母串,如果有输出这个串,如果没有就输出No。 题解:(鶸一个,并不会AC自动机。。。。。然后发现了新大陆)string本身自带查找子串的函数,string.find(),但是cin输入30MB的数据绝对会超时,然后就看到了这样一个黑科技:cin.sync_with_stdio(false); 详情看这里:大佬博客orz 然后cin输入数据的速度就大大加快了,

开心铁匠铺 1492

AI工程化之生成式UI & A2UI(一)

本文系统介绍了生成式UI和Google A2UI技术。生成式UI通过AI直接生成前端代码(完全生成式)或DSL(混合式),实现千人千面的动态界面和研发提效。Google A2UI提出组件级和消息级协议,采用JSON规范实现渲染框架解耦,支持多端渲染。文章详细阐述了A2UI的架构设计,包括协议生成、服务端处理和渲染器实现,并对比了与传统前端框架的差异,指出A2UI本质是UI=F(AI(UI)+AI(state))的创新模式。最后通过playground项目展示了A2UI的实践应用。

qq_34306228的博客 589

HDU6208 The Dominator of Strings【字符串比较】

The Dominator of Strings Time Limit: 3000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 4532    Accepted Submission(s): 1543   Problem Description Here you...

海岛Blog 636

[xboard-real6410]39 real6410中的BL1和BL2实验及流程分析

文章目录uboot控制uboot 流程uboot加载kernel uboot控制 uboot 流程 uboot加载kernel

鹰之翔 298

高通平台 Android T 蓝牙技术全解析:架构、代码与实现原理

协议栈、配置文件和服务都运行在一个独立的用户空间进程。

专业开发者的博客,一个从事Android WiFi和蓝牙的工程师 100

HDU 6208【假AC自动机+string方法】

题目链接:http://acm.hdu.edu.cn/listproblem.php?vol=1 The Dominator of Strings Time Limit: 3000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 4746    Accepted Su...

小康的博客 270

apt-get update时出现GPG error:... bionic InRelease:The following signatures were invalid: EXPKEYS解决方案

本文主要介绍了apt-get update时出现W: GPG error: … bionic InRelease: The following signatures were invalid: EXPKEYSIG B7B3B788A8D3785C MySQL Release Engineering E: The repository ‘… bionic InRelease’ is not signed.解决方案,希望能对使用Ubuntu系统的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 11万+

HDU 6208 AC自动机 或 暴力?

简略题意:问是否存在一个串,其他串都是他的子串。看了题目之后,可以明确一点,极限数据的情况下,暴力一定过不了。 有可能成为目标串的一定是最长串,所有串建AC自动机,用最长串去匹配。如果匹配到了所有串,那么答案存在。 具体做法就是每访问到一个节点,都看当前节点是否能匹配到某个串,以及这个节点一直在fail树上跳转到根部的这段路径上是否能匹配上某个串。 这题卡自动机做法主要在两点: 1. 卡读入

即使摸爬滚打,满身泥泞,我也要前进 1070

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

深度学习工具包 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")

后缀数组(SAM)学习笔记

SAM学习笔记定义状态集一些性质后缀链接转移函数性质算法实现核心应用 这篇博客是最近在 SAMSAMSAM 的学习过程中记录下的笔记,很多内容都来自 zjp 以及 hihocoder 因为两篇博客写的都已经很好了,记下的目的也算是展示我的理解。 定义 我们依然引入以上博客的概念。 对于字符串 S="aabbabd"S="aabbabd"S="aabbabd" ,它的后缀自动机是: 对于 SSS ...

weixin_43941332的博客 609

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

hdu 6208 hash字符串水题

The Dominator of Strings Time Limit: 3000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 2694    Accepted Submission(s): 975 Problem Description He

王纪刚的博客 340

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

hdu6208 The Dominator of Strings(AC自动机)

题意: 给定n个串,问其中是否存在一个串,满足其他串都是它的子串。 数据范围:所有串长度不超过1e5

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz 177

HDU 6208 The Dominator of Strings (字符串find函数暴力过)

用string类型的find函数暴力判断是否是子串,因为数据过大,应该用string类型或其他更高效的数据结构存储。

zuzhiang的博客 828

hdu 6208 The Dominator of Strings

The Dominator of Strings Time Limit: 3000/3000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 1530 Accepted Submission(s): 531 Problem Description Here you

Sino_Crazy_Snail的小窝 1612

HDU6208 The Dominator of Strings 字符串匹配 2017 ACM/ICPC Asia Regional Qingdao Online

题目链接:HDU6208 题目思路:题意比较好懂,找到一个长度最长的串,然后判断其他所有串是否能否被这个串包含,也就是是否能够匹配成功,如果成功输出该串,否则输出No; 当时队友用字典树,AC自动机不是MLE 就是TLE 然后刚刚队友突然说,暴力也可以做……我就写了一发暴力……结果还真能过……(以后遇到不会的题目,先暴力再说) ACcode: /* 2017年9月18日20:08:

xyry 596

HDU6208 The Dominator of Strings【字符串】

题意:问是否有一个字符串包含其他字符串 思路:有的话,那一定是最长的那一个。最长的有多个的话,那这几个一定要相同;否则,不存在。跑一下AC自动机,把最长的看成目标串,别的看成模式串,看目标串中出现几次模式串。 #include #include #include #include #include #include #include #include #include #i

狂奔的蜗牛 755

SA 后缀数组 / SAM 后缀自动机 c++ 模板

SA 后缀数组模板 SAM 后缀自动机模板

m0_54646258的博客 873

HDU 6208 The Dominator of Strings [AC自动机]

HDU 6208 The Dominator of Strings [AC自动机]

ACTerminate的博客 1444

hdu 6208 (ac自动机)

Here you have a set of strings. A dominator is a string of the set dominating all strings else. The string SS is dominated by TT if SS is a substring of TT. Input The input contains several test case

黑码 595

HDU - 6208 (ios::sync_with_stdio(false);加速cin cout)

Here you have a set of strings. A dominator is a string of the set dominating all strings else. The string SS is dominated by TT if SS is a substring of TT. Input The input contains several test cas...

an94460061的博客 259

hdu 6208

可以用strstr做,也可以用find,kmp,ac自动机做 strstr要用s.c_str()返回一个指针,问的别人。。 #include using namespace std; int Next[100100]; string str[100010]; string s; int main() { std::ios::sync_with_stdio(false); int

acm退役败犬 准nlp研究生 296
上一篇: HDU 6215 2017Brute Force Sorting 青岛网络赛 队列加链表模拟
下一篇: Codeforces Round #272 (Div. 2) E. Dreamoon and Strings 动态规划
sega_handsome
博客等级 码龄10年 7粉丝 164原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值