自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(32)
  • 收藏
  • 关注

原创 新的激活函数swish

Swish激活函数是Google公司在2017年10月提出的新的激活函数。Swish函数的定义为f(x)=x⋅sigmoid(βx),其中β是一个常数或可训练的参数。import tensorflow as tfimport numpy as npx1=np.array([[1,2,3,4,5],[1,2,3,4,5]])x2=np.array([[1,2,3,4,5],[1,2,3,4,...

2019-10-15 21:23:17 1773

原创 我的tensorflow学习日常

在tensorflow中numpy与tensor的互相转化在进行tensorflow运算时,我们常常需要进行tensor与numpy的转换。我们用tensor=tf.convert_to_tensor(numpy)实现numpy转换到tensor用sess.run()转换tensor到numpyimport tensorflow as tfimport numpy as npa=np...

2019-10-15 21:08:55 116

原创 机器学习之python基础库pandas完成读取Excel文件,并进行增删改查的操作

“”"@theme pandas@author lz@time 2019/01/03@content 读取xls文件,并修改io:excel文件,如果命名为中文,在python2.7中,需要使用decode()来解码成unicode字符串,例如: pd.read_excel(‘示例’.decode('utf-8))sheet_name:返回指定的sheet,如果将shee...

2019-01-03 22:27:21 1894

原创 机器学习之python中的pandas

“”"@theme numpy@time 2019.01.03@author lz@content 解非齐次方程组“”"import numpy as npfrom scipy.linalg import solvea=np.array([[1,1],[2,3]])print(a)b=np.array([[3],[4]])print(b)m=s...

2019-01-03 20:06:50 171

原创 机器学习之pyhton基础库pandas

“”"@theme pandas@time 2018/12/24@author lz@content 层次索引series以及Dataframe“”"import pandas as pd#双层索引data=pd.Series([100,200,300],index=[[“苹果”,“香蕉”,“李子”],[“2000”,“3000”,“4000”]])prin...

2018-12-24 23:34:06 87

原创 机器学习之python基础库pandas

“”"@theme pandas@time 2018/12/24@author lz@content 去重,值计数,成员资格“”"import pandas as pd#去重唯一值ser01=pd.Series([‘a’,‘b’,‘c’,‘d’,‘a’,‘b’,‘c’])print(ser01)print(ser01.dtype)print(ser01.uniq...

2018-12-24 22:45:06 127

原创 机器学习之python基础篇pandas

“”"@theme pandas@time 2018/12/17@author lz@content 测试pd.isnull方法和pd.notfull方法@function pd.isnull过滤缺失值得项pd.notnull过滤出不是缺失值得项“”"import pandas as pdfrom pandas import Seriesscores...

2018-12-18 22:48:52 148

原创 机器学习中python爬虫爬取百度贴吧多个数据

“”"@theme 爬虫@time 2018/12/16@author lz@content 爬取python吧的多个页面@step1导入2发出请求3转码4保存@analysis第一个页面 http://tieba.baidu.com/f?kw=python&ie=utf-8&pn=0第2个页面 http://tieba.baidu.com/...

2018-12-16 22:22:54 123

原创 机器学习之python爬虫爬去百度贴吧一个页面

“”"@theme 爬虫@time 2018/12/16@author lz@content 爬取python吧的页面@step1导入2发出请求3转码4保存“”"coding : UTF-8#1导入网络模块from urllib import requesturl=“http://tieba.baidu.com/f?kw=python&ie=utf-8&a...

2018-12-16 21:31:10 161

原创 机器学习之python基础库numpy

“”"@theme numpy@time 2018/12/14@author lz@content no.unique去重“”"import numpy as nparr1=np.array([“java”,“java”,“C语言”,“C++”,“C#”,“Pyhton”])print("-"*10,“原始数据”,"-"*10)for i in arr1:

2018-12-14 12:09:12 161

原创 机器学习之python基础库numpy

“”"@Theme numpy@author lz@Time 2018/12/12@content 创建数组“”"import numpy as np#用列表创建一维数组print(np.array([1,2,3]))#用元组创建一维数组print(np.array((1,2,3)))#创建多维元组,利用列表print(np.array([[1,2,3],[4...

2018-12-13 12:13:22 96

原创 机器学习之python常用库matplotlib

import matplotlib.pyplot as pltimport numpy as npplt.plot([1,4,9],[5,5,5])plt.show()“”"@Theme matplotlib@author lz@Time 2018/12/10@content figure“”"import matplotlib.pyplot as ...

2018-12-11 14:30:00 188

原创 机器学习之python基础

“”"@Theme 类@author lz@Time 2018/12/10@content 访问私有属性的方法“”"class Woman:def init(self,name,age):self.name=name;#定义私有属性self.__age=age;def secret(self):print("%s 的年龄是 %d"%(self.name,sel...

2018-12-10 20:19:51 169

原创 机器学习之python基础

“”"@Theme 类@author lz@Time 2018/12/09@content 封装“”"class Person:def init(self,name,weight):self.name=nameself.weight=weightdef str(self):return(“我的名字叫 %s 我的体重是 %.2f 公斤 “%(self.name...

2018-12-09 21:28:49 94

原创 机器学习之python基础

“”"@Theme class@Author lz@Time 2018/12/9@content str“”"class Cat:def init(self,name):self.name=nameprint("%s 来了"%self.name)def del(self):print("%s 去了"%self.name)def str(self):#_str...

2018-12-09 15:53:33 123

原创 机器学习之python基础篇

“”"@theme 类@time 2018/12/8@author lz@content _del_方法“”"class Cat:def init(self,name):self.name=name;print(“我的 %s 名字是”% self.name)print(1)#在对象结束前,会自动调用_del_方法def del(self):print(...

2018-12-08 22:42:02 91

原创 机器学习之python基础15

“”"@theme 类@time 2018/12/7@author lz@content 初始方法,同时设置初始值“”"class Cat:def init(self,new_name):print(1)#self.属性名=属性的值self.name=new_namedef eat(self): print(2)tom=Cat(“Tom”)pri...

2018-12-07 22:19:08 88

原创 机器学习之python基础篇面向对象

“”"@theme 类的调用@time 2018/12/06@author lz@content 类的调用“”"class Cat:def eat(self):#哪一个对象调用的方法,self就是哪一个对象的引用print(“吃饭”)print("%s 爱吃鱼 “%self.name)def drink(self):print(“喝水”)print(”%s 爱喝水"%...

2018-12-07 09:13:00 250

原创 机器学习之python基础13

“”"@theme 字符串格式化输出@author lz@time 2018/12/05@content format的用法“”"str2=“my name is {name},age is {old}”#以字典的形式赋值,然后格式化输出print(str2.format_map({“name”:“lian”,“old”:“11”}))#以变量的形式赋值,然后...

2018-12-05 12:50:56 94

原创 机器学习之python基础12

str1=“abababcdefababghijkjkjkjk”print(str1.split(“ab”,2))#从左向右依次分割字符串,可以指定分割次数print(str1.rsplit(“a”))#从右向左依次分割字符串,可以指定分割次数print(str1.splitlines())#以换行符为分隔,组合成列表print(str1.partition(“e”))#从右往左以第一个指...

2018-12-05 10:45:10 75

原创 机器学习之python基础篇11

“”"@theme file@time 2018/12/4@author lz@content 读取大文件,需要一行行读取文件的数据,“”"file=open(“readme.txt”)while True:text=file.readline();if not text:breakfile.close()...

2018-12-04 21:54:08 67

原创 机器学习之python基础10

“”"操作文件的步骤:1打开文件2读写文件3关闭文件用到1个函数open3个方法read,write,close先写open,close在写read和write“”"file=open(“readme.txt”)#默认是以只读文件的形式并且返回对象,resdme中不能含有中文否则报错text=file.read()print(text)print("*"*50)file.clo...

2018-12-04 21:10:17 96

原创 机器学习之路之python基础9

“”"在程序开发过程中,如果对某些代码的实行不能确定可以增加语句来捕获异常,以下是完整的异常代码“”"try:num=int(input(“请输入一个整数”))result=8/num;print(result)except ZeroDivisionError:#except 错误类型1就是用来捕获错误类型1这种异常的print(“0不能做除数”)except ValueErr...

2018-12-04 15:49:59 184

原创 机器学习之python基础课8

“”"字典的含义:字典可以用来存储多个数据,通常用来描述一个物体的相关信息,字典可以使用健值存储信息。健是索引,值是数据。健和值之间使用:隔开。“”"xiaoming={“name”:“小明”,“age”:18}print(xiaoming[“name”])#取值xiaoming[“age”]=17#修改值如果有,修改值xiaoming[“gender”]=“男”#修改值如果没有,就...

2018-11-27 21:22:44 128

原创 机器学习之基础篇

“”"@theme tuple@time 2018/11/26@author lz“”"s1=(12,23,12,23,12,12)s2=(“lisi”,14,34)print(s1.index(12))print(s1[0])#取值print(s1+s2)#元祖连接print(s1[1:3])#切片print(len(s1))#len函数求长度print(m...

2018-11-27 10:15:33 122 1

原创 机器学习之python基础篇6

“”"@theme list的取值,增加,删除@time 2018/11/26@author lz“”"name_list=[“zhangsan”,“lisi”,“maliu”];#定义列表name_list[0]=“张三”#修改列表的值name_list.pop()#在末尾删除一个元素name_list.append(“李四”)#在末尾增加一个元素temp_lis...

2018-11-26 21:41:59 168

原创 机器学习之python6循环

sum=0;j=1;i=1;while (i<5):j=j*i;sum=sum+j;i=i+1print(sum)

2018-11-25 23:14:53 126

原创 机器学习之python基础5

“”"火车进站携带刀子,要写if必须成对出现“”"knife_length=30;has_ticket=True;if has_ticket:print(“上车”)if knife_length>20:print(“长度超过 %d 不能上车”%(knife_length-20))else:print(“下车”)...

2018-11-25 22:44:16 97

原创 机器学习python基础篇4多分支语句

day=input(“请输入节日”)if day==“情人节”:print(“玫瑰”)elif day==“平安夜”:print(“吃苹果”)elif day==“生日”:print(“吃蛋糕”)else :print(“吃饭”)...

2018-11-25 20:25:36 161

原创 机器学习之Python基础3

age=int(input(“请输入年龄”))python_score=int(input(“请输入分数”))if age>18 and python_score>50:print(“可以去网吧”)else:print(“不可以”)

2018-11-25 20:07:06 101

原创 机器学习之路的Python基础篇2

@theme print格式化输出@author lz@time 2018/11/25apple_price=float(input(“请输入价格”))#因为input中输入的是系统默认为字符串apple_number=float(input(“苹果的数量”))#因为input中输入的是系统默认为字符串money=apple_number*apple_price;...

2018-11-25 17:14:59 93

原创 机器学习之路之基础Python篇

Python中输入的问题,以及类型转换~~@author lz@time 2018/11/28apple_price=float(input(“请输入价格”))#因为input中输入的是系统默认为字符串apple_number=float(input(“苹果的数量”))#因为input中输入的是系统默认为字符串money=apple_number*apple_price;...

2018-11-25 16:49:20 160

空空如也

空空如也

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

TA关注的人

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