- 博客(34)
- 收藏
- 关注
原创 深度学习:loss损失不下降
这两周写代码遇到了一些问题,在训练深度学习模型时,出现损失不下降的问题。不同的state-of-art模型已经尝试很多种,损失一直维持在0.02~0.04;以下loss下降方法排除 model 影响。损失下降方法原因数据集不够,往往导致在此数据集上,不能很好的训练模型;或者训练样例特征太复杂,难以拟合。学习率太高,loss肉眼可见的上下徘徊。batch size太大,导致loss上下徘徊,难以拟合。尝试不同的优化器,SGD 、 Adam等。dropout用的太多了,适当减少。训练时间不足。
2021-04-18 20:26:29
6107
2
原创 UVaLive 7365
#include <iostream>#include <cstdio>#include <cstring>#include <string>#include <algorithm>#include <cmath>#include <vector>#include <map>using namespace std;typedef long long LL;bool vis[37]
2016-08-16 10:11:28
558
原创 "虹软杯" 中国大学生程序设计竞赛 (杭州赛区)-网络赛水题题解
本次网络赛四大水题:HDU 5832, HDU 5833,HDU 5835,HDU 5842
2016-08-14 18:36:29
2319
原创 HDU 4433 (DP)
/*dp[i][j][k]表示第i个数之前的数全部匹配,第i+1上变化了j,i+2上变化了k的最小值*/#include <iostream>#include <cstdio>#include <cstring>#include <string>#include <algorithm>#include <cmath>#include <queue>#include <stack>
2016-08-11 18:31:56
398
原创 UVa 1330 LA 3029
蓝书第一章的题目,神奇的解法:详细见P50,City Game LA3029, UVa 1330#include <iostream>#include <cstdio>#include <cstring>#include <string>#include <algorithm>#include <cmath>using namespace std;typedef long long L
2016-08-09 11:44:20
379
原创 HDU 3690 bfs+哈希
You must have heard of the Knight's Tour problem. In that problem, a knight is placed on an empty chess board and you are to determine whether it can visit each square on the board exactly once.
2016-08-04 19:17:46
671
原创 HDU 3689 (KMP+DP || 暴力+dp)
由于匹配串比较小,也可暴力 dp[i][j]表示输入第i个字符模式串匹配到第j个字符的概率。 KMP+DP如下:#include <iostream>#include <cstdio>#include <cstring>#include <string>#include <algorithm>using namespace std;typedef long long LL;cons
2016-08-03 21:12:20
1145
转载 由HDU3689,得KMP算法与一个经典概率问题
KMP算法与一个经典概率问题 考虑一个事件,它有两种概率均等的结果。比如掷硬币,出现正面和反面的机会是相等的。现在我们希望知道,如果我不断抛掷硬币,需要多长时间才能得到一个特定的序列。序列一:反面、正面、反面序列二:反面、正面、正面 首先,我反复抛掷硬币,直到最近的三次抛掷结果形成序列一,然后我记下这次我抛掷了多少次才得到了我要的序列。重复执行这个过程,我可以算出得
2016-08-03 20:07:19
657
原创 HDU 3688 并查集
There is a piece of grids land of size n×m. Chandler and his team take responsibility to guard it. There are some searchlights on some pieces and each of them has a capability to lighten a distance towards four
2016-08-03 19:44:53
681
原创 POJ 3172 (dfs写0-1背包)
#include #include #include #include #include #include using namespace std;typedef long long LL;const int maxn = 1007;int n, c, a[maxn], ans;LL sum[maxn];void dfs(int cnt, int w) { //cnt下标,
2016-07-28 20:08:08
714
原创 HDU 4586 Play the Dice 简单思考
题意:给你N个骰子,1-n上标有各自的数,然后掷骰子一次,得到朝上数字数量的钱;再给你m,然后m个数表示,当该数朝上时,你可以得到这么多钱,并且可以继续掷骰子。问你你能得到的钱的期望。思路:若骰子上面的数字和为sum,则掷第一次:sum/n第二次:sum/n*(m/n)第三次:sum/n*(m/n)*(m/n).........第k次:sum/n*(m/n)^k答案为当
2016-07-27 19:17:02
432
原创 HDU 3368 Reversi (简单dfs)
题意:跟小时候在电视机上玩过的黑白棋一模一样,于是题也没读便开始做。给你一副棋盘,让你走一步黑棋,尽可能多的吃掉白棋,求吃掉的个数。思路:一开始想从D开始递归,后来一想不对啊,比如,走的那一步黑棋,可以从多个方向上吃掉白棋,那么从D开始递归会麻烦太多。所以:从*开始dfs,直到遇上D或者*便停止退出递归,把握好递归方向即可。#include #include #include #
2016-07-26 20:03:41
531
原创 HDU 3367 Pseudoforest
题意:给你n,m。m条边,找出一颗最多带一个环的权值最大的子树。思路:模仿生成树的都建方法,用并查集一条边一条边的连起来,用vis[]数组判一下,这棵树是否带环即可。代码如下:#include #include #include #include #include #include using namespace std;typedef long long LL;const
2016-07-26 19:46:07
380
原创 UVa 11178 Morley's Theorem
还是第一次这么认真全神贯注的手打模板,真心费精神。#include #include #include #include #include #include using namespace std;typedef long long LL;const int maxn = 1000 + 7;const double eps = 1e-5;struct Point {
2016-07-25 20:54:51
414
原创 UVa 1629 Cake Slicing (切蛋糕)
有一个n行m列的网格蛋糕上有一些樱桃,要求延网格线切割,并且每块蛋糕上有一个樱桃,问最小的切割长度。#include #include #include #include #include using namespace std;typedef long long LL;const int INF = 0x3f3f3f3f;int dp[21][21][21][21];int
2016-07-14 17:17:05
544
原创 CodeForces 339D
#include #include #include #include #include using namespace std;typedef long long LL;const int maxn = 20;int a[1<<maxn];int n, m, u, v;void Build() { int p = 1 << n, res = 0; while(p) {
2016-07-08 15:22:51
472
原创 UVa 1637 Double Patience (搜索)
题意:36张牌分成9堆,每堆4张牌。每次可以拿走某两堆顶部的牌,但需要点数相同。如果有多种拿法则等概率的随机拿。例如,9堆顶部的牌分别为KS,KH,KD,9H, 8S,8D,7C,7D,6H,则有5种拿法(KS,KH),(KS,KD),(KH,KD),(8S,8D),(7C,7D),每种拿法的概率均为1/5.如果最后拿完所有的牌则游戏成功。按顺序给出每堆牌的4张牌,求成功的概率。思路:用9元组
2016-07-07 13:58:09
620
原创 CodeForces 687C The Values You Can Make
dp[i][j]表示i可以构成j则为true:#include #include #include #include #include #include using namespace std;typedef long long LL;const int maxn = 1000 + 7;int n, k;bool dp[maxn][maxn];int main() {
2016-07-07 10:34:09
652
原创 CodeForces 518B Tanya and Postcard 计数
先来错误代码, Wrong answer test 8:#include #include #include #include #include using namespace std;const int maxn = 200000 + 24;char s[maxn], t[maxn], ans[maxn];map mp;int main() { scanf("%s%s",
2016-07-07 09:46:34
445
原创 Codeforces 518D 概率DP
DP[i][j]表示前i时间内进入j个人的概率,那么期望就是 DP[t][i]*i 的和;DP[i][j] = DP[i-1][j]*(1.0-p) + DP[i-1][j-1]*p;特例:当 j == n时,已经没有人在等待了,说以DP[i][j] = DP[i-1][j] + DP[i-1][j-1]*p;#include #include #include #include
2016-07-07 09:05:38
614
原创 UVa 11988 Broken Keyboard (a.k.a. Beiju Text) 数组模拟
蓝书P244~P245#include #include #include #include #include using namespace std;typedef long long LL;const int INF = 0x3f3f3f3f;const int maxn = 100000 + 24;int Next[maxn], last, cur;char s[ma
2016-07-05 09:45:14
351
原创 POJ 3422 Kaka's Matrix Travels (最小费用流)
POJ 3422 Kaka's Matrix Travels 第一次做最小费用流,参考别人的做法,思考了好久,还是有点不太明白,还是网络流的题目做的太少,不太熟,还得多做几个加深理解才行。/* POJ 3422 Kaka's Matrix Travels 第一次做最小费用流,参考别人的做法,思考了好久,还是有点不太明白, 还是网络流的题目做的太少,不太熟,还得多做
2016-04-22 17:34:27
426
原创 HDU 2874(LCA)
/*题意:给定一张图,包括n个城市,m条路径,q个询问( 图中没有环 )。LCA问题:询问a,b的最短距离.则:ans = dis[a] + dis[b] - dis[father]*2;*/#include #include #include #include #include #include #include #include using namespace st
2016-04-21 19:39:29
467
原创 HDU 4185(二分图匹配)
第一次做二分图匹配,刚开始不知道,读完题便开始贪心, 后来找了好几组测试样例,才知道不能这么做,看网上别人 做的,才知道是二分图匹配,学习了一下。
2016-04-21 17:08:57
454
原创 Start
#include #include #include #include #include #include using namespace std;typedef long long LL;int main() { printf("Hello 优快云!");}
2016-04-21 16:50:19
341
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人