
机器学习
进程击序的媛
身体和灵魂,健身与学习,都在路上。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
k-近邻算法改进约会网站配对效果
from numpy import * import operator def createDataSet(): group = array([[1.0, 1.1], [1.1, 1.0], [0, 0], [0, 0.1]]) labels = ['A', 'A', 'B', 'B'] return group, labels def classify0(inX, d原创 2018-01-10 23:22:51 · 227 阅读 · 0 评论 -
数组图像处理:直方图均衡化
证明: 设r是灰度级,s是均衡化后的灰度级,范围是0-L(L一般是255), 对图像进行统计,设均衡化前的灰度级的随机变量为X,概率密度函数为,均衡化后的随机变量为Y,概率密度函数为。我们通过统计已知X的概率分布,即已经知道了,设变换函数为s = T(r), 那么可以通过知道随机变量Y的分布函数 对(1)式两边求导的 因为均衡化后要求随...原创 2019-04-26 22:08:41 · 1303 阅读 · 0 评论 -
数字图像处理2:通过滑杆控制图像
#include <iostream> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> using namespace std; using namespace cv; const int slider_max = 64; int slider; Mat imag...原创 2019-04-17 18:19:44 · 330 阅读 · 0 评论 -
数组图像处理1:使用迭代器处理图片的像素
#include <iostream> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> using namespace std; using namespace cv; void colorReduce(Mat &inputImage, Mat...原创 2019-04-17 18:16:11 · 266 阅读 · 0 评论 -
数字图像中深度和通道的概念,以及如何遍历各个通道
原博客:https://blog.youkuaiyun.com/u013355826/article/details/64905921 前沿 看了图像处理有一段时间了,但是图像的通道和深度一直不理解,毕竟是比较抽象的概念。现在好好总结下,希望能帮助理解图像的通道和图像的深度。 基于OpenCV3.1.0版本 感谢贾志刚老师的视频以及QQ群 看了xiaowei_cqu的博客 看了毛星云的OpenCV3编程...转载 2019-04-26 14:53:01 · 1211 阅读 · 0 评论 -
数字图像处理3:鼠标控件
#include <iostream> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> using namespace std; using namespace cv; Ma...原创 2019-04-20 23:29:17 · 193 阅读 · 0 评论 -
我搭建的第一个神经网络
import numpy as np import tensorflow as tf x_data = np.random.rand(100).astype(np.float32) y_data = x_data*0.1 + 0.3 Weight = tf.Variable(tf.random_uniform([1],-1.0, 1.0)) biases = tf.Variable(tf.ze...原创 2019-03-21 16:12:42 · 247 阅读 · 0 评论 -
tf.Variable()定义变量
import tensorflow as tf import numpy as np state = tf.Variable(0) #print(state.name),输出 "Counter:0" one = tf.constant(1) new_value = tf.add(state, one) update = tf.assign(state, new_value) init = tf...原创 2018-04-10 22:26:24 · 3810 阅读 · 0 评论 -
用matplotlib注解绘制决策树,机器学习实战第三章
这段代码纠结了很久,也调了很久,算是弄懂了,感觉还是应该写下来,以后可以看看,也方便有同样疑惑的同学节省时间首先贴上treePlotter.py的代码,这个自定义模块实现了所有的函数用于画决策树import matplotlib.pyplot as plt decisionNode = dict(boxstyle='sawtooth', fc='10') leafNode = dict(boxs...原创 2018-01-17 16:00:47 · 4173 阅读 · 4 评论 -
向量表示,投影,协方差矩阵,正交对角化对于降维的作用
原文:http://blog.youkuaiyun.com/songzitea/article/details/18219237引言当面对的数据被抽象为一组向量,那么有必要研究一些向量的数学性质。而这些数学性质将成为PCA的理论基础。理论描述向量运算即:内积。首先,定义两个维数相同的向量的内积为:(a1,a2,⋯,an)T⋅(b1,b2,⋯,bn)T=a1b1+a2b2+⋯+anbn内积运算将两个向量映射为一...转载 2018-02-28 21:18:03 · 1000 阅读 · 0 评论 -
矩阵微分
ContentsNotationDerivatives of Linear ProductsDerivatives of Quadratic ProductsNotationd/dx (y) isa vector whose (i) elementis dy(i)/dxd/dx (y) is a vectorwhose (i) elementis dy/dx(i)d/dx (yT)is a mat...转载 2018-02-28 13:59:52 · 456 阅读 · 0 评论 -
numpy模块的tile函数
tile(A,reps)有两个参数A,reps,返回数组,用于将数组的每个维度进行重复 这个函数是在机器学习实战的k-近邻算法中看到的,下面是我查找的它的文档 Construct an array by repeating A the number of times given by reps. If `reps` has length ``d``, the result will ha原创 2018-01-10 15:17:00 · 201 阅读 · 0 评论 -
机器学习实战第三章,决策树的实现
新建tree.py模块,写入下列代码,这里的所有函数共同完成了建立一个决策树from math import log import numpy as np import matplotlib as plt import operator def calcShannonEnt(dataSet): # 计算给定数据的香农熵 numEntries = len(dataSet)原创 2018-01-18 00:01:21 · 281 阅读 · 0 评论 -
python pickle模块实现决策树长期保存,机器学习实战
定义两个函数,storeTree用于把决策树以二进制形式保存到文件中,grabTree从文件中读出决策树到内存def storeTree(inputTree, filename): ''' 序列化决策树,存入文件 :param inputTree: :param filename: :return: ''' import pickle原创 2018-01-17 23:28:18 · 1992 阅读 · 0 评论 -
python:setattr的迷惑以及函数作为对象添加引用
import sys class A: def __init__(self,str): self.str=str setattr(self.__class__,self.str,self.test) def test(self): print sys._getframe().f_code.co_name print s原创 2018-01-16 11:51:18 · 2091 阅读 · 1 评论 -
k-近邻算法实现手写数字识别
这里的数字存储在一个文本文件中,是由32*32个0或1组成的数字矩阵,背景用0表示,数字用1表示 from numpy import * import operator import os def classify0(inX, dataSet, labels, k): dataSetSize = dataSet.shape[0] diffMat = tile(inX, (dat原创 2018-01-13 12:38:53 · 373 阅读 · 0 评论 -
数组图像处理:直方图规定化
#include <iostream> #include <cmath> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> using namespace std; using namespace cv; void statistics(Mat &...原创 2019-04-27 17:24:21 · 461 阅读 · 0 评论