摘要:
最近因为想要看漫画,无奈下载的漫画是jpg的格式,网上的转换器还没一个好用的,于是乎就打算用python自己DIY一下:这里主要用了reportlab。开始打算随便写几行,结果为若干坑纠结了挺久,于是乎就想想干脆把代码写好点吧。#实现了以下的几项功能:* 将当前文件夹下的图片保存到一个pdf中,支持...
阅读全文
posted @ 2015-01-30 00:09
mrbean
阅读(2384)
推荐(4)
摘要:
机器学习实战笔记索引 最近通过学习《机器学习实战》把书结合网上的一些博客都完整的看了下,感觉还是很有收获的,稍微总结了下,留着复习吧 "kNN算法python实现和简单数字识别" "决策树的python实现" "朴素贝叶斯算法的python实现" "Logistic回归 python实现" "Log
阅读全文
posted @ 2014-12-10 18:57
mrbean
阅读(2054)
推荐(2)
摘要:
最近需要从多个excel表里面用各种方式整理一些数据,虽然说原来用过java做这类事情,但是由于最近在学python,所以当然就决定用python尝试一下了。发现python果然简洁很多。这里简单记录一下。(由于是用到什么学什么,所以不算太深入,高手勿喷,欢迎指导)一、读excel表读excel要用...
阅读全文
posted @ 2014-05-09 00:25
mrbean
阅读(162089)
推荐(20)
摘要:
一、用途 矩阵的一个重要的用途是进行递归是的计算,最明显的就是快速求数列的某一项的值。本文也是主要讲解这种算法的。二、样例 这方面最简单的就是斐波那契问题了,这个相信是每一位程序员都熟知的,这里就不介绍了。三、快速幂 既然是快速计算那肯定是不能去一步一步慢慢求,这里我们要用到二分的思想。求快速...
阅读全文
posted @ 2014-04-11 00:57
mrbean
阅读(6814)
推荐(3)
摘要:
转onehot one_hot = F.one_hot(label.long(), num_classes=n_classes) 转回来 label = torch.argmax(one_hot, -1)
阅读全文
posted @ 2021-01-12 10:20
mrbean
阅读(883)
推荐(0)
摘要:
这里以onnx为中介进行转换。主要用到 STEP1. 将pytorch 模型转换成onnx模型 注意这里关键是要构造一个模型的输入输入,这里假设模型接受两个输入。 pmodel = PytorchModel() dummy_input = (np.zeros((1, 30), dtype=np.fl
阅读全文
posted @ 2020-12-16 19:50
mrbean
阅读(4140)
推荐(0)
摘要:
以装饰器添加所有代码对应的tensor的信息 https://github.com/zasdfgbnm/TorchSnooper
阅读全文
posted @ 2019-06-24 23:18
mrbean
阅读(301)
推荐(0)
摘要:
Took 0.152364 seconds Took 0.061580 seconds Took 1.016529 seconds Took 0.215403 seconds
阅读全文
posted @ 2018-12-12 09:37
mrbean
阅读(3565)
推荐(0)
摘要:
简介 GloVe是一种非常简单快速的训练词向量的算法。与复杂的word2vec相比,其是一个log双线性模型,仅通过一个简单的损失函数就能够得到很好的结果。 (1)J=∑i,jNf(Xi,j)(viTvj+bi+bj−log(Xi,j))2 其中,vi和vj是i和j的词向量,bi和bj是两个偏差项,
阅读全文
posted @ 2018-04-07 12:57
mrbean
阅读(1204)
推荐(0)
摘要:
为什么卷积层计算量更低paddingStrided convolution多维卷积LeNet 参数卷积网络的好处参数共享稀疏连接经典网络实现LeNet-5AlexNetVGGResNet残差块identity blockconvolutional block残差网络为什么残差网络有用Network in Network & 1*1 convolutionsInception network mot...
阅读全文
posted @ 2018-04-03 10:37
mrbean
阅读(539)
推荐(0)
摘要:
正交化 Orthogonalization单一评价指标保证训练、验证、测试的数据分布一致不同的错误错误分析数据分布不一致迁移学习 transfer learning多任务学习 Multi-task learning端到端的深度学习系统好处坏处Reference 这门课不是具体的技术,而是帮助你决定现在最有价值做的应该是什么 正交化 Orthogonalization 简单的说就是有些调整...
阅读全文
posted @ 2018-04-03 10:36
mrbean
阅读(421)
推荐(0)
摘要:
训练、验证、测试划分的量要保证数据来自一个分布偏差方差分析如果存在high bias如果存在high variance正则化正则化减少过拟合的intuitionDropoutdropout分析其它正则化方法数据增加(data augmentation)early stoppingensemble归一化输入归一化可以加速训练归一化的步骤归一化应该应用于:训练、验证、测试梯度消失/爆炸权重初始化通过数...
阅读全文
posted @ 2018-04-03 10:35
mrbean
阅读(436)
推荐(0)
摘要:
为什么深度学习发展了数据计算算法发展Logistics RegressionNumpyreshape的计算代价很小,所以你不确定数据维度的时候都可以放上一些解决潜在bug的trick做了归一化之后梯度下降更易收敛激活函数对于权值要做随机初始化为什么要深层网络Reference 为什么深度学习发展了 数据 对于小量数据来说,神经网络表现比线性回归、SVM 对于大量数据来说神经网络比SVM好 ...
阅读全文
posted @ 2018-04-03 10:34
mrbean
阅读(366)
推荐(0)
摘要:
使用 谷歌提供了免费的K80的GPU用于训练深度学习的模型。而且最赞的是以notebook的形式提供,完全可以做到开箱即用。你可以从Google driver处打开。或者这里 默认创建的是没有GPU的,我们需要修改,点击“代码执行程序” 然后就会有GPU使用了 挂在Google云盘 执行如下代码 !apt-get install -y -qq software-properti...
阅读全文
posted @ 2018-01-27 17:56
mrbean
阅读(2916)
推荐(0)
摘要:
问题 安装上graphviz和pydot之后调用出现如下问题 解决方案 其实这里是存在一些依赖关系的,首先我们需要安装graphviz的python接口,然后安装graphviz软件本身,最后安装pydot 在Ubuntu下即:
阅读全文
posted @ 2018-01-21 15:47
mrbean
阅读(1043)
推荐(0)
摘要:
另:python 3的open函数可以直接加encoding参数
阅读全文
posted @ 2017-01-23 13:09
mrbean
阅读(322)
推荐(0)
摘要:
python的sort函数使用的时候有一个参数 。一定注意这里返回值要用1和 1。不能True和False!!!
阅读全文
posted @ 2016-11-20 00:41
mrbean
阅读(344)
推荐(0)
摘要:
问题的定义:
首先我们有一个数据是一个m n的numpy矩阵现在我们希望能够进行给他加上一列变成一个m (n+1)的矩阵 import numpy as np a = np.array([[1,2,3],[4,5,6],[7,8,9]]) b = np.ones(3) c = np....
阅读全文
posted @ 2015-09-20 15:07
mrbean
阅读(41734)
推荐(2)
摘要:
#题目简述Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],Your function ...
阅读全文
posted @ 2015-08-25 18:37
mrbean
阅读(294)
推荐(0)
摘要:
图片来自sklearn官网最近事情弄完一部分了,继续开始python data science!
阅读全文
posted @ 2015-05-28 11:22
mrbean
阅读(1435)
推荐(0)
摘要:
#题目简述:Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occur...
阅读全文
posted @ 2015-05-03 15:55
mrbean
阅读(432)
推荐(0)
摘要:
#题目简述Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive in...
阅读全文
posted @ 2015-04-22 11:04
mrbean
阅读(565)
推荐(0)
摘要:
#题目简述:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are fille...
阅读全文
posted @ 2015-04-18 23:43
mrbean
阅读(296)
推荐(0)
摘要:
#题目简述:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".#解题思路: class Solution: # @pa...
阅读全文
posted @ 2015-04-18 19:10
mrbean
阅读(259)
推荐(0)
摘要:
#题目简述Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3...
阅读全文
posted @ 2015-04-18 18:31
mrbean
阅读(221)
推荐(0)
摘要:
#题目描述Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or ...
阅读全文
posted @ 2015-04-18 18:15
mrbean
阅读(248)
推荐(0)
摘要:
#题目简述Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last ...
阅读全文
posted @ 2015-04-18 16:14
mrbean
阅读(272)
推荐(0)
摘要:
#题目简述The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed ...
阅读全文
posted @ 2015-04-18 15:51
mrbean
阅读(270)
推荐(0)
摘要:
#题目简述You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stoppi...
阅读全文
posted @ 2015-04-16 16:53
mrbean
阅读(286)
推荐(0)
摘要:
#感知机(perceptron)##模型:简答的说由输入空间(特征空间)到输出空间的如下函数:$$f(x)=sign(w\cdot x+b)$$称为感知机,其中,$w$和$b$表示的是感知机模型参数,$w \in R^n$叫做权值,$b \in R$叫做偏置(bias)感知机是一种线性分类模型属于判...
阅读全文
posted @ 2015-04-15 14:24
mrbean
阅读(8921)
推荐(1)
posted @ 2015-04-06 12:57
mrbean
阅读(183)
推荐(0)
摘要:
#题目简述:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the near...
阅读全文
posted @ 2015-03-29 21:04
mrbean
阅读(268)
推荐(0)
摘要:
#题目简述:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given ...
阅读全文
posted @ 2015-03-29 20:46
mrbean
阅读(193)
推荐(0)
摘要:
#题目简述:Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm t...
阅读全文
posted @ 2015-03-29 20:11
mrbean
阅读(213)
推荐(0)
摘要:
#题目简述:Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. ...
阅读全文
posted @ 2015-03-29 19:49
mrbean
阅读(201)
推荐(0)
摘要:
#题目简述:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal...
阅读全文
posted @ 2015-03-29 19:06
mrbean
阅读(222)
推荐(0)
摘要:
#题目简述:Write a function to find the longest common prefix string amongst an array of strings.#解题思路: class Solution: # @return a string ...
阅读全文
posted @ 2015-03-29 18:51
mrbean
阅读(203)
推荐(0)
摘要:
#题目简述:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: ...
阅读全文
posted @ 2015-03-26 22:10
mrbean
阅读(250)
推荐(0)
摘要:
#题目描述:Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 int(v2[i]): return 1 ...
阅读全文
posted @ 2015-03-26 19:45
mrbean
阅读(259)
推荐(0)
摘要:
#题目简述:Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], ...
阅读全文
posted @ 2015-03-26 19:21
mrbean
阅读(227)
推荐(0)
摘要:
java安装 首先需要上oracle的网站下载 在lib目录下建立一个jvm文件夹 sudo mkdir /usr/lib/jvm然后解压文件到这个文件夹 sudo tar zxvf jdk-8u40-linux-i586.tar.gz -C /usr/lib/jvm进入解压文件夹 cd /usr/lib/jvm然后为了方便改个名字 sudo mv jdk1.8.0_40 java 打开配...
阅读全文
posted @ 2015-03-21 12:57
mrbean
阅读(966)
推荐(0)
摘要:
#题目描述:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32...
阅读全文
posted @ 2015-03-10 14:56
mrbean
阅读(273)
推荐(0)
摘要:
#题目简述:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Ge...
阅读全文
posted @ 2015-02-10 13:05
mrbean
阅读(265)
推荐(0)
摘要:
#题目描述:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two...
阅读全文
posted @ 2015-02-06 14:08
mrbean
阅读(176)
推荐(0)