[Udacity] Machine Learning tools

NO IMAGE
1 Star2 Stars3 Stars4 Stars5 Stars 給文章打分!
Loading...

1:quiz 1: matrix times vector 矩陣乘向量

import numpy as np
x=[[],[],[],[]]
y=[]
x=np.array(x)
x.dot(y)

2:quiz 2:differentiate 函式求導

sudo pip install sympy
import sympy
In [2]: x=sympy.Symbol("x")
In [3]: y=sympy.Symbol("y")
In [4]: fx=sympy.exp(x)*x 5*x**2-10
In [5]: fx
Out[5]: 5*x**2   x*exp(x) - 10
In [6]: sympy.diff(fx,x)
Out[6]: x*exp(x)   10*x   exp(x)

3:quiz 3: count words 詞頻統計

import collections 
def count_words(ss,n):
list_ss=ss.split()
dict_ss=collections.defaultdict(int)
for  i in list_ss:
dict_ss[i] =1
tuple_ss=[]
for key,value in dict_ss.items():
tuple_ss.append((value,key))
tuple_ss.sort()
tuple_ss.reverse()
return   tuple_ss[:n]
print (count_words("hello ab ab ab ac ad ad ac ac",3))

4:Quandl 一個開源的大資料資源站點

可以使用Quandl這個python包對這個站的資料進行讀取r操作,學習大資料的必備站點
www.quandl.com

相關文章

人工智慧 最新文章