- 博客(7)
- 收藏
- 关注
原创 keras中的metrics作用
在深度学习中,通过梯度下降的方法进行反向传播。 这里使用的loss指标必须是可导的,比如mse。 但是在评价模型的性能时,一般还会查看其他指标,例如mape。所以keras的compile一般这样的形式。 model.compile(loss='mse', optimizer='adam',metrics=['mape']) 定义metrics的作用,一方面是在训练的时候,可以直接观察到要评价的指标变化情况。另一方面是可以加入EarlyStopping早停机制,监控metrics的指标。例如,当指标不再下
2020-08-11 00:34:36
4838
原创 python- 如何对一个二维数组去重
先对数组中每个一维数组内的元素排序,然后对数组遍历,把不重复的元素放入一个新的数组里。 arr = [[1,2,3], [1,2,4], [2,3,1], [3,1,2], [4,1,2]] for i in arr: i.sort() res = [] for i in arr: if i not in res: res.append(i) print(res) ...
2020-04-16 13:11:26
2388
原创 Leetcode刷题11. 盛最多水的容器
来源leetcode 方法1 暴力求解 两次for循环 下面展示一些 内联代码片。 class Solution: def maxArea(self, height: List[int]) -> int: max_area = -99 for i in range(len(height)-1): #第一个到倒数第二个 for j...
2020-04-16 11:12:45
237
原创 Leetcode刷题283- 移动零
(来源leetcode) 方法1:把数组中j个非零元素存放在数组的前j项,之后把后边的元素设置为0即可,如下: class Solution: def moveZeroes(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. ...
2020-04-16 09:49:13
207
原创 ubuntu18.04安装tensorflo后,import tensorflow出现/usr/local/lib/python3.6/dist-packages/tensorflow/python/
问题:import tensorflow 之后出现这些提示符 /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:493: FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a fu...
2019-09-02 18:10:07
9815
原创 python 出现 AttributeError: matplotlib' object has no attribute 'to_rgba'
碰到这个问题的话,我们需要升级matplotlib的版本。 首先卸载matplotlib: sudo pip uninstal matplotlib 之后,安装新版本的matplotlib:(在这里还是使用清华大学镜像) sudo python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple matplotlib==2.2.0 ...
2019-05-21 22:37:38
1492
原创 ubuntu系统,安装tensorflow-gpu 解决pip过慢、卡死情况
在这里假设您已经在ubuntu系统下安装好了NVIDAI、CUDA、cudnn等前提条件。 验证是否成功的代码: 检查驱动的命令 nvidia-smi 验证CUDA的命令 nvcc -V 查看cudnn的命令 cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2 之后可以通过下面一条命令可以快速安装tensorflow: sudo ...
2019-05-17 17:55:21
3038
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅