
机器学习
xinfeng2005
这个作者很懒,什么都没留下…
展开
-
HMM隐马尔科夫 python库hmmlearn
github:https://github.com/hmmlearn/hmmlearn使用说明:http://hmmlearn.readthedocs.io/en/latest/原创 2016-12-30 09:16:41 · 7967 阅读 · 0 评论 -
TensorFlow 实现MLP
#coding=utf-8import numpy as npfrom numpy.random import RandomStateimport tensorflow as tfw1=tf.Variable(tf.random_normal([2,3],stddev=1,seed=1))b1=tf.Variable(tf.constant(0.1, shape=[2]))w2=t原创 2017-03-16 09:33:14 · 1839 阅读 · 0 评论 -
机器学习 1.回归
线性回归:1.目标函数增加L2正则θ存在解析式:使用梯度下降进行解θ:=>代码:import numpy as npdef regression(data, alpha, lamda): n=len(data[0])-1 theta=np.zeros(n) for i in range(30): for d in data:原创 2017-04-14 10:58:16 · 614 阅读 · 0 评论 -
机器学习 SVM sklearn
SVM回归代码:import numpy as npfrom sklearn import svmimport matplotlib.pyplot as pltN = 50np.random.seed(0)x = np.sort(np.random.uniform(0, 6, N), axis=0)y = 2*np.sin(x) + 0.1*np.random原创 2017-04-16 10:36:13 · 969 阅读 · 0 评论 -
利用kmeans聚类进行颜色量化压缩图像
#coding=utf-8#########################################压缩from skimage import iofrom sklearn.cluster import KMeansimport numpy as npimage = io.imread('test.png')rows = image.shape[0]cols = im原创 2017-04-25 13:59:17 · 3965 阅读 · 2 评论 -
python 朴素贝叶斯简单实现
import reimport maths=['this is yes','this is no']r=[0,1]def tokenize(message): message=message.lower() all_words = re.findall('[a-z0-9]+', message) print(all_words) return set(a原创 2017-12-25 17:47:03 · 352 阅读 · 0 评论