摘要:
import numpy as npfrom matplotlib import pyplot as plt t=np.arange(0.0,2.0,0.1)s=np.sin(t*np.pi)figure,ax=plt.subplots(1,1) ax.plot(t,s,'r*')ax.plot(t 阅读全文
摘要:
1. 引言 我们都知道损失函数有很多种:均方误差(MSE)、SVM的合页损失(hinge loss)、交叉熵(cross entropy)。这几天看论文的时候产生了疑问:为啥损失函数很多用的都是交叉熵(cross entropy)?其背后深层的含义是什么?如果换做均方误差(MSE)会怎么样?下面我们 阅读全文
摘要:
据pytorch的官方文档,torch.nn.functional里的cross_entropy是基于log_softmax和nll_loss实现的。没关系,通过最简单的torch原函数复现,可以较深理解当中的原理。 import torch def my_cross_entropy(input, 阅读全文
摘要:
Today XianYu is too busy with his homework, but the boring GuGu is still disturbing him!!!!!! At the break time, an evil idea arises in XianYu's mind. 阅读全文
摘要:
Problem M. Walking PlanTime Limit: 5000/2500 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 897 Accepted Submission( 阅读全文
摘要:
Cover Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 440 Accepted Submission(s): 65Special Judge 阅读全文
摘要:
题目链接:Gym - 101667E How Many to Be Happy? 题意:给出一含有n个结点和m条边的图G,定义该图中的最小生成树(MST)含有的边为happy,而不在MST中的边为unhappy,对于unhappy的边e,删除最少的边数H(e)使得其变为happy,求H(e)之和。 阅读全文
摘要:
子序列的定义:对于一个序列a=a1 1 ,a2 2 ,......an n 。则非空序列a'=ap1 p1 ,ap2 p2 ......apm pm 为a的一个子序列,其中1<=p1<p2<.....<pm<=n。 例如4,14,2,3和14,1,2,3都为4,13,14,1,2,3的子序列。对于给 阅读全文
摘要:
我们害怕把这道题题面搞得太无聊了,所以我们决定让这题超短。一个序列被称为是不无聊的,仅当它的每个连续子序列存在一个独一无二的数字,即每个子序列里至少存在一个数字只出现一次。给定一个整数序列,请你判断它是不是不无聊的。 我们害怕把这道题题面搞得太无聊了,所以我们决定让这题超短。一个序列被称为是不无聊的 阅读全文
摘要:
Rounddog always has an array a1,a2,⋯,ana1,a2,⋯,an in his right pocket, satisfying 1≤ai≤n1≤ai≤n . A subarray is a non-empty subsegment of the original 阅读全文