K Mean(K 均值聚类)算法用于将数据集分成 K 个簇,K 值是由用户给定的 优点:容易实现 缺点:可能收敛到局部最小值,在大规模数据集上收敛较慢 算法 随机初始化 k 个簇中心点 每个样本分到距离最近的簇 取分到该簇的所有样本的均值做为该簇的新的中心点 重新分配每个样本到距离最近的簇 不断迭代 ...
分类:
其他好文 时间:
2020-03-10 09:13:39
阅读次数:
56
Given a binary tree, find the subtree with maximum average. Return the root of the subtree. Example 1 Input: {1,-5,11,1,2,4,-2} Output:11 Explanation: ...
分类:
其他好文 时间:
2020-03-05 13:42:34
阅读次数:
56
常用curl实例 抓取页面内容到一个文件中 curl -o home.html http://www.sina.com.cn 用 -O(大写的),后面的url要具体到某个文件,不然抓不下来。我们还可以用正则来抓取东西 curl -O http://www.mydomain.com/linux/ind ...
分类:
Web程序 时间:
2020-03-05 13:13:56
阅读次数:
98
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdarg.h> int average(int num, ...); int main() { int averageRes = average(3, 1, ...
分类:
其他好文 时间:
2020-03-03 00:55:53
阅读次数:
52
基本用法12criterion = LossCriterion() loss = criterion(x, y) # 调用标准时也有参数损失函数L1范数损失:L1Loss计算 output 和 target 之差的绝对值。1torch.nn.L1Loss(reduction='mean')参数:re... ...
分类:
其他好文 时间:
2020-02-28 12:23:47
阅读次数:
57
1 #include <stdio.h> 2 3 int main (void) 4 { 5 int i; 6 int sum = 0; 7 int cnt = 0; 8 float avg;//average平均值的缩写 9 10 for (i = 1; i<101; ++i) 11 { 12 i ...
分类:
其他好文 时间:
2020-02-27 20:47:36
阅读次数:
55
简书 原作者 skullfang https://www.jianshu.com/p/9ee85fdad150 分类问题的评价指标是准确率,那么回归算法的评价指标就是MSE,RMSE,MAE、R Squared 1.均方误差(MSE) MSE (Mean Squared Error)叫做均方误差。看 ...
分类:
其他好文 时间:
2020-02-27 00:41:01
阅读次数:
112
totensor方法和normalize方法 数值映射和归一化 待办ToTensor是指把PIL.Image(RGB) 或者numpy.ndarray(H x W x C) 从0到255的值映射到0到1的范围内,并转化成Tensor格式。2.Normalize(mean,std)是通过下面公式实现数... ...
分类:
其他好文 时间:
2020-02-25 23:18:00
阅读次数:
173
一.损失函数的使用 损失函数【也称目标函数或优化评分函数】是编译模型时所需的两个参数之一。 model.compile(loss='mean_squared_error', optimizer='sgd') 或 from keras import losses model.compile(loss= ...
分类:
其他好文 时间:
2020-02-25 17:58:18
阅读次数:
100
nn.MSELoss()得到的是平均到像素的loss nn.MSELoss(size_average=False)得到整个batch所有像素loss和 MSELoss(size_average=False).div(batch_size)得到平均图像loss a=torch.Tensor([[1,1 ...
分类:
其他好文 时间:
2020-02-25 17:34:25
阅读次数:
96