目錄
一、概述
1.1 從數(shù)據(jù)處理到人工智能
數(shù)據(jù)表示->數(shù)據(jù)清洗->數(shù)據(jù)統(tǒng)計->數(shù)據(jù)可視化->數(shù)據(jù)挖掘->人工智能
二、Python庫之數(shù)據(jù)分析
2.1 numpy
Numpy: 表達N維數(shù)組的最基礎庫,http://www.
- Python接口使用,C語言實現(xiàn),計算速度優(yōu)異
- Python數(shù)據(jù)分析及科學計算的基礎庫,支撐Pandas等
- 提供直接的矩陣運算、廣播函數(shù)、線性代數(shù)等功能
import numpy as np
def np_sum():
a = np.array([0, 1, 2, 3, 4])
b = np.array([9, 8, 7, 6, 5])
c = a**2 b**3
return c
print(np_sum())
[729 513 347 225 141]
def py_sum():
a = [0, 1, 2, 3, 4]
b = [9, 8, 7, 6, 5]
c = []
for i in range(len(a)):
c.append(a[i]**2 b[i]**3)
return c
print(py_sum())
[729, 513, 347, 225, 141]
2.2 pandas
Pandas: Python數(shù)據(jù)分析高層次應用庫,http://pandas.
2.3 scipy
SciPy: 數(shù)學、科學和工程計算功能庫,http://www.
- 提供了一批數(shù)學算法及工程數(shù)據(jù)運算功能
- 類似Matlab,可用于如傅里葉變換、信號處理等應用
- Python最主要的科學計算功能庫,基于Numpy開發(fā)

三、Python庫之數(shù)據(jù)可視化
3.1 matplotlib
Matplotlib: 高質(zhì)量的二維數(shù)據(jù)可視化功能庫,http://
- 提供了超過100種數(shù)據(jù)可視化展示效果
- 通過matplotlib.pyplot子庫調(diào)用各可視化效果
- Python最主要的數(shù)據(jù)可視化功能庫,基于Numpy開發(fā)

3.2 Seaborn
Seaborn: 統(tǒng)計類數(shù)據(jù)可視化功能庫,http://seaborn./
- 提供了一批高層次的統(tǒng)計類數(shù)據(jù)可視化展示效果
- 主要展示數(shù)據(jù)間分布、分類和線性關系等內(nèi)容
- 基于Matplotlib開發(fā),支持Numpy和Pandas

3.3 Mayavi
Mayavi:三維科學數(shù)據(jù)可視化功能庫,http://docs./mayavi/mayavi/
- 提供了一批簡單易用的3D科學計算數(shù)據(jù)可視化展示效果
- 目前版本是Mayavi2,三維可視化最主要的第三方庫
- 支持Numpy、TVTK、Traits、Envisage等第三方庫

四、Python庫之文本處理
4.1 PyPDF2
PyPDF2:用來處理pdf文件的工具集,http://mstamy2./PyPDF2
- 提供了一批處理PDF文件的計算功能
- 支持獲取信息、分隔/整合文件、加密解密等
- 完全Python語言實現(xiàn),不需要額外依賴,功能穩(wěn)定
from PyPDF2 import PdfFileReader, PdfFileMerger
merger = PdfFileMerger()
input1 = open("document1.pdf", "rb")
input2 = open("document2.pdf", "rb")
merger.append(fileobj=input1, pages=(0, 3))
merger.merge(position=2, fileobj=input2, pages=(0, 1))
output = open("document-output.pdf", "wb")
merger.write(output)
4.2 NLTK
NLTK:自然語言文本處理第三方庫,http://www./
- 提供了一批簡單易用的自然語言文本處理功能
- 支持語言文本分類、標記、語法句法、語義分析等
- 最優(yōu)秀的Python自然語言處理庫
from nltk.corpus import treebank
t = treebank.parsed_sents('wsj_0001.mrg')[0]
t.draw()

4.3 Python-docx
Python-docx:創(chuàng)建或更新Microsoft Word文件的第三方庫,http://python-docx./en/latest/index.html
- 提供創(chuàng)建或更新.doc .docx等文件的計算功能
- 增加并配置段落、圖片、表格、文字等,功能全面
from docx import Document
document = Document()
document.add_heading('Document Title', 0)
p = document.add_paragraph('A plain paragraph having some ')
document.add_page_break()
document.save('demo.docx')
五、Python庫之機器學習
5.1 Scikit-learn
Scikit-learn:機器學習方法工具集,與數(shù)據(jù)處理相關的第三方庫,http:///
- 提供一批統(tǒng)一化的機器學習方法功能接口
- 提供聚類、分類、回歸、強化學習等計算功能
- 機器學習最基本且最優(yōu)秀的Python第三方庫

5.2 TensorFlow
TensorFlow:AlphaGo背后的機器學習計算框架,https://www./
- 谷歌公司推動的開源機器學習框架
- 將數(shù)據(jù)流圖作為基礎,圖節(jié)點代表運算,邊代表張量
- 應用機器學習方法的一種方式,支撐谷歌人工智能應用
import tensorflow as tf
init = tf.global_variables_initializer()
sess = tf.Session()
sess.run(init)
res = sess.run(result)
print('result:', res)

5.3 MXNet
MXNet:基于神經(jīng)網(wǎng)絡的深度學習計算框架,https://mxnet.incubator./
- 提供可擴展的神經(jīng)網(wǎng)絡及深度學習計算功能
- 可用于自動駕駛、機器翻譯、語音識別等眾多領域
- Python最重要的深度學習計算框架

六、單元小結
6.1 從數(shù)據(jù)處理到人工智能
- Numpy、Pandas、SciPy
- Matplotlib、Seaborn、Mayavi
- PyPDF2、NLTK、python-docx
- Scikit-learn、TensorFlow、MXNet
來源:https://www./content-1-341051.html
|