
Python
RivenDong
这个作者很懒,什么都没留下…
展开
-
matplotlib画图显示中文字体-RuntimeWarning: Glyph xxxxx missing from current font.
文章目录1. 针对问题2. 确定当前环境字体库位置3. 下载SimHei字体4. 修改matplotlibrc配置文件5. 删除matplotlib缓存列表6. 重启python环境,并设置SimHei字体1. 针对问题用matplotlib画图显示中文乱码问题:RuntimeWarning: Glyph 40664 missing from current font. font.set_text(s, 0.0, flags=flags)2. 确定当前环境字体库位置import matpl原创 2021-07-22 09:31:28 · 1465 阅读 · 6 评论 -
基于Miniconda3安装Tensorflow
文章目录1. 下载Miniconda32. 安装完成后进行换源3. 创建Tensorflow环境3.1 创建一个虚拟环境3.2 激活创建的环境3.3 安装tensorflow4. 使用Pycharm设置tensorflow环境1. 下载Miniconda3Miniconda3下载地址2. 安装完成后进行换源使用管理员权限打开CMD窗口conda config --set show_channel_urls yes修改.condarc文件,将其内容更改为:channels: - defau原创 2020-05-25 10:41:42 · 3353 阅读 · 0 评论 -
Scikit-Learn & TensorFlow 第三章源代码
以下代码为Scikit-Learn & TensorFlow 原书第三章代码,关于MNIST数据集可以看上一篇博客:https://blog.youkuaiyun.com/RivenDong/article/details/100163831from sklearn.datasets import fetch_mldataimport matplotlibimport matplotlib.py...原创 2019-09-01 13:46:22 · 937 阅读 · 1 评论 -
MNIST数据集获取失败
MNIST数据集下载链接: https://download.youkuaiyun.com/download/rivendong/11644463、由于MNIST数据集属于国外资源,所以无法获取到链接,上面已经附上MNIST数据集的下载链接,代码需要稍作修改:from sklearn.datasets import fetch_mldataif __name__ == '__main__': ...原创 2019-08-30 18:13:04 · 1160 阅读 · 0 评论 -
Scikit-Learn & TensorFlow 第二章源代码
以下代码为Scikit-Learn & TensorFlow 原书第二章代码,本文根据新版本的Sklearn库对部分代码做了修正,并对关键步骤加以注释,如有问题欢迎留言讨论。import osimport tarfileimport pandas as pdimport numpy as npfrom six.moves import urllibimport matplotl...原创 2019-08-29 13:24:06 · 907 阅读 · 0 评论 -
LabelEncoder、LabelBinarizer、OneHotEncoder三者的区别
LabelEncoder、LabelBinarizer、OneHotEncoder三者的区别import numpy as npfrom sklearn.preprocessing import LabelEncoder, LabelBinarizer, OneHotEncodertest_data = np.array(["a", "b", "c", "d", "a"])print(L...原创 2019-08-28 15:38:07 · 1969 阅读 · 0 评论 -
Python学习之#coding:utf-8的位置
1.必须要在第一行或者第二行。2.必须要在可执行代码和中文注释的前面。3.如果页面没有中文,那么它只是一个普通注释,位置任意都行。原创 2018-02-01 19:33:00 · 986 阅读 · 0 评论 -
np.c_和np.r_的区别
np.c_和np.r_的区别np.c_是矩阵按行“相加”a = np.array([[1, 2, 3], [7, 8, 9]])b = np.array([[4, 5, 6], [1, 2, 3]])print(np.c_[a, b])输出结果:[[1 2 3 4 5 6][7 8 9 1 2 3]]c = np.array([1, 2, 3])d = np.array([4,...原创 2019-08-27 13:25:32 · 1676 阅读 · 0 评论 -
kNN分类算法的Python实现
1.k-近邻算法实现from numpy import *import operatordef createDataSet(): group = array([[1.0, 1.1], [2.0, 2.0], [0, 0], [4.1, 5.1]]) labels = ['A', 'B', 'C', 'D'] return group, labelsdef...原创 2019-01-09 20:12:50 · 1868 阅读 · 1 评论 -
Python-Numpy-tile函数
1.函数的定义说明def tile(A, reps): """ :param A: 输入的初始状态,几乎所有类型都可以 :param reps: 控制输出的格式(比如:几行,几列) :return: """2.Python实例import numpyprint(numpy.tile([0, 0], 3)) # 3列默认一行...原创 2019-01-09 19:12:11 · 870 阅读 · 0 评论