《深度学习入门》(鱼书)笔记 第一章 Python入门

# coding: utf-8

class Man:

    """示例类"""   # 示例类

 

    def __init__(self, name):

        self.name = name

        print("Initilized!")

 

    def hello(self):

        print("Hello " + self.name + "!")

 

    def goodbye(self):

        print("Good-bye " + self.name + "!")

 

m = Man("David")

m.hello()

m.goodbye()

# coding: utf-8

import matplotlib.pyplot as plt

from matplotlib.image import imread

 

img = imread('../dataset/lena.png') #读入图像

plt.imshow(img)

 

plt.show()

# coding: utf-8

import numpy as np

import matplotlib.pyplot as plt

 

# 生成数据

x = np.arange(0, 6, 0.1)

y = np.sin(x)

 

# 绘制图形

plt.plot(x, y)

plt.show()

# coding: utf-8

import numpy as np

import matplotlib.pyplot as plt

 

# 生成数据

x = np.arange(0, 6, 0.1) # 以0.1为单位,生成0到6的数据

y1 = np.sin(x)

y2 = np.cos(x)

 

# 绘制图形

plt.plot(x, y1, label="sin")

plt.plot(x, y2, linestyle = "--", label="cos")

plt.xlabel("x") # x轴的标签

plt.ylabel("y") # y轴的标签

plt.title('sin & cos')

plt.legend()

plt.show()

 

# coding: utf-8

import numpy as np

import matplotlib.pyplot as plt

 

# 生成数据

x = np.arange(0, 6, 0.1) # 以0.1为单位,生成0到6的数据

y = np.sin(x)

 

# 绘制图形

plt.plot(x, y)

plt.show()

 

 

 

你可能感兴趣的:(深度学习,人工智能)