自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

赛博空间

自己学习pthon,c++,ubuntu,机器学习以及遗传算法的笔记

  • 博客(23)
  • 收藏
  • 关注

原创 python如何使用matplotlib画散点图使不同类别的点有不同的形状和颜色?

文章地址:https://www.chzzz.club/post/239.html我们在使用聚类算法时,希望最后画出的散点图中,不同的类别的点拥有不同的颜色和不同的形状的,但是matplotlib只能让我们使不同类别拥有不同的颜色,而对形状无能为力。下面这段代码就可以实现这个功能:import numpy as npimport matplotlib.pyplot as pltde...

2019-04-09 20:56:51 33751 3

原创 full-speed-python习题解答(九)--异步编程(Asynchronous programming)

 Exercises with asyncio1. Implement an asynchronous coroutine function to add two variables and sleep forthe duration of the sum. Use the asyncio loop to call the function with two numbers.impo...

2019-01-01 11:17:46 186

原创 full-speed-python习题解答(八)-- Coroutines

Python协同(coroutines)类似于生成器,会使用yield关键字,但它不是生成数据,而是通常消费(consume)数据。Exercise with coroutines1. Create a coroutine named “square” that prints the square of any sent value.def square(): print('...

2018-12-26 19:12:35 201

原创 full-speed-python习题解答(七)--生成器

迭代器(iterator)是经常与for循环一起使用的可迭代对象(iterable)。Python中的生成器(generator)是实现迭代器的一种方便方法。生成器不是class,而是使用yield关键字作返回值的函数。  1. Implement a generator called “squares” to yield the square of all numbers from ...

2018-12-26 11:25:56 238

原创 full-speed-python习题解答(六)--迭代器

1.Implement an iterator class to return the square of all numbers from “a” to “b”.class all_number(object): def __init__(self,a,b): self.a = a self.b = b def __iter__(s...

2018-12-24 17:06:30 192

原创 win10下tensorflow-gpu安装过程(2018/12/22)

这次重装系统后重新安装tensorflow-gpu,发现忘了怎么装的了,现在记录下这次的安装过程。安装的tensorflow-gpu版本为1.12.0,是截止目前(2018/12/22)最新版本。不想看安装过程的可直接拉到下面看正文。 由于在网上看到一篇文章介绍说使用conda安装tensorflow-gpu很酸爽,连cuda,cudnn都给你自动装好。我就决定一试。首先,我先去Ana...

2018-12-22 17:29:13 278

原创 史上对tensorflow卷积神经网络中的padding参数最详细解释!

当使用tensorflow创建卷积神经网络时,肯定要用到卷积层和池化层,tendorflow关于建立卷积层和池化层的API都有padding这个参数,如下所示:- tf.nn.conv2d(input,filter,strides,padding)- tf.nn.max_pool(input,ksize,strides,padding)padding有两种可选值:‘VALID’和‘SA...

2018-12-18 17:46:38 4323 1

原创 np.random的几种方法

参考链接:https://www.chzzz.club/post/137.html    numpy.randomDESCRIPTION    ========================    Random Number Generation    ========================        ==================== =========...

2018-10-20 17:46:21 2350

原创 Inheritance and Composition --继承与组合

参考链接:网页链接前言:继承与组合是编程的两种方式。继承完全可以用组合来代替,而且要尽量避免多继承。 继承与组合的概念:继承:一个类可以从另一个类继承属性,类似父子关系,一脉相承但不完全相同。组合:一个类可以由其他类组成,类似车与轮子的关系。 继承可以用组合代替:关于继承,我们知道父类与子类有三种交互方式:子类暗含这父类的行为;子类覆盖父类的行为;子类alter父类...

2018-10-20 17:43:41 201

原创 为你的github上的python项目添加buildpassing徽章?

buildpassing徽章是由Travis CI持续集成服务提供的。下面我们就来利用它对你的python项目进行集成测试。 首先当然是登录了,我们可以使用github帐号授权登录Travis CI。Travis CI的关键就是.travis.yml文件。对于python这个文件的内容格式大致如下:   language: python  python:    - "3....

2018-10-20 17:41:55 1812

原创 full-speed-python 习题解答(五)

项目地址:网页链接full-speed-python书籍地址:https://github.com/joaoventura/full-speed-python参考链接:https://www.chzzz.club/post/17.html 5.2 Exercise with the while statement 1.Implement a function that receiv...

2018-10-20 17:38:34 301

原创 full-speed-python 习题解答(四)

项目地址:网页链接full-speed-python书籍地址:https://github.com/joaoventura/full-speed-python参考链接:https://www.chzzz.club/post/14.html 5.1 Exercise with the for loop 1.Create a function “add” that receives ...

2018-10-20 17:36:45 198

原创 full-speed-python 习题解答(三)

项目地址:网页链接full-speed-python书籍地址:https://github.com/joaoventura/full-speed-python参考链接:https://www.chzzz.club/post/13.html 4.1 Exercise with the math module 1.Find the greatest common divisor of...

2018-10-20 17:34:40 496

原创 full-speed-python 习题解答(二)

项目地址:网页地址full-speed-python书籍地址:https://github.com/joaoventura/full-speed-python3.2 Exercise with strings1.Initialize the string “abc” on a variable named “s”:(a) Use a function to get the length o...

2018-10-20 17:26:30 345

原创 full-speed-python习题解答(一)

项目地址:网页地址full-speed-python书籍地址:https://github.com/joaoventura/full-speed-python3.1 Exercises with numbers 1.Try the following mathematical calculations and guess what is happening: (3/2),(3//2), ...

2018-10-20 17:17:54 820

原创 在ubuntu中使用virtualenv进行python2和python3的切换

    当我们需要使用python2又要使用python3时,由于python的扩展包很重要,假如当你电脑的默认版本是python2时,你安装的扩展包只有python2能够使用,这对你要使用两种版本的python造成很多困扰。    一个好的解决办法就是:当我们建立一个工程时,让这个工程拥有自己的python版本和相关的包,这样我们更新这个工程里python包的版本或者安装其他包时对其他的工程...

2018-10-20 17:09:32 2071

原创 windows下python虚拟环境的使用

windows下使用virtualennv比较麻烦,我推荐virtualwrapper。 安装virtualwrapperpip install virtualwrapper-win 新建虚拟环境mkvirtualenv python3setprojectdir . 这会产生一个叫做python3的文件夹,它是一个内置python,pip,setuptoo...

2018-10-20 17:07:04 724

原创 Ubuntu64位安装WPS

Ubuntu64位安装WPSWPS的deb包下载地址: http://wps-community.org/downloads安装WPS:sudo dpkg -i wps-office_10.1.0.5707~a21_amd64.deb如果出现如下错误: Selecting previously unselected package wps-office. (Reading ...

2018-02-28 21:08:40 511

转载 解决Ubuntu下sublime text3不能输入中文的问题

参考1.http://www.cnblogs.com/zero-zf/p/5866615.html2. https://www.sinosky.org/linux-sublime-text-fcitx.html3.https://jingyan.baidu.com/article/f3ad7d0ff8731609c3345b3b.html1.在home目录下新建sublime_imfix.c文件,在

2017-10-25 11:22:54 5552

原创 ubuntu16.04下使用matplotlib出现`TypeError: Couldn't find foreign struct converter for 'cairo.Context'`解决

博主使用的时ubuntu16.04下的sublime text3配置python2运行环境,已经成功安装numpy,scipy,matplotlib环境,在测试代码 `import numpy as np from scipy.stats import beta from matplotlib.pyplot import hist, plot, showobs = beta.rvs(5, 5,

2017-10-23 20:05:07 1287

原创 Ubuntu16.04终端执行`sudo apt-get update`遇到appstream问题

Ubuntu 16.04 执行sudo apt-get update遇到问题“E:Problem executing scripts APT::Update::Post-Invoke-Success ‘if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh > /de

2017-10-22 10:17:02 2240

原创 c++中cin,cin.get()和cin.getline()的比较

c++中cin,cin.get()和cin.getline()的比较。==================比较表格 序号 cin cin.get() cin.getline() 1 接收all数据类型 接收char类型 接收char类型 2 忽略空格与换行符,对有空格字符串,空格后的字符读取不了 可读取空格 可读取空格 3 读取到行尾丢弃换行符,

2017-10-14 19:51:34 184

原创 模拟退火算法解决工作指派问题(c++代码实现)

最近学习到模拟退火算法,遇到工作指派问题,但是查到网上的c++代码并不能解决问题,于是在它的基础上进行修改,完美解决了4工作4工人工作指派问题。一、问题概述与分析1.工作指派问题:n个工作可以由n个工人分别完成。工人i完成工作j的时间为dij,问如何安排可使总的工作时间达到最小。试按SA思想设计一个该问题的求解算法,并利用计算机语言实现设计的算法。2.分析:(1)假设有

2017-10-04 19:51:18 3183 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除