python in learning math

  1. limit behavior of transition probability of a given markov chain

    P.S. Note that below code use @ operator which requires python 3.5 or above, see matrix_operator.

>>> import numpy as np
>>> np.set_printoptions(precision=4)
>>> g = lambda trans_mat, cnt=20: reduce(lambda x1, x2: print(x1) or x1@x2, (trans_mat for _ in range(cnt)), np.eye(len(trans_mat)))
>>> t, t1 = np.array([[.5,.4,.1],[.3,.4,.3],[.2,.3,.5]]), \
        np.array([[.7,0,.3,0],[.5,0,.5,0],[0,.4,0,.6],[0,.2,0,.8]])
>>> g(t,10)
[[ 1.  0.  0.]
 [ 0.  1.  0.]
 [ 0.  0.  1.]]
[[ 0.5  0.4  0.1]
 [ 0.3  0.4  0.3]
 [ 0.2  0.3  0.5]]
[[ 0.39  0.39  0.22]
 [ 0.33  0.37  0.3 ]
 [ 0.29  0.35  0.36]]
[[ 0.356  0.378  0.266]
 [ 0.336  0.37   0.294]
 [ 0.322  0.364  0.314]]
[[ 0.3446  0.3734  0.282 ]
 [ 0.3378  0.3706  0.2916]
 [ 0.333   0.3686  0.2984]]
[[ 0.3407  0.3718  0.2875]
 [ 0.3384  0.3708  0.2908]
 [ 0.3368  0.3702  0.2931]]
[[ 0.3394  0.3713  0.2894]
 [ 0.3386  0.3709  0.2905]
 [ 0.338   0.3707  0.2913]]
[[ 0.3389  0.3711  0.29  ]
 [ 0.3387  0.371   0.2904]
 [ 0.3385  0.3709  0.2906]]
[[ 0.3388  0.371   0.2902]
 [ 0.3387  0.371   0.2903]
 [ 0.3386  0.3709  0.2904]]
[[ 0.3387  0.371   0.2903]
 [ 0.3387  0.371   0.2903]
 [ 0.3387  0.371   0.2904]]
Out[20]: 
array([[ 0.3387,  0.371 ,  0.2903],
       [ 0.3387,  0.371 ,  0.2903],
       [ 0.3387,  0.371 ,  0.2903]])
  1. plot a sequence of function with different hyperparameter
    Given f(x)=xa1ex/b (which is integrand of gamma function when b=1, see Gamma Function, we can plot a series of plots of functions.
import numpy as np
from sympy import *
%matplotlib inline
x = Symbol('x')
def g(a=2.,b=1.):
    return x**(a-1) * exp(-x/b)
for v in np.linspace(0.5,2,6):
    plot(g(v),(x,0,v-1+4),title = 'a=%s, b=1.0' % v)

the output is show as

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
As an AI language model, I can suggest the following steps to learn deep learning: 1. Learn the basics of machine learning: Before diving into deep learning, it is essential to understand the basics of machine learning, including supervised and unsupervised learning, regression, clustering, and classification. 2. Learn programming languages: To work with deep learning, one needs to have a strong foundation in programming languages such as Python and R, as most of the deep learning libraries are written in these languages. 3. Understand the mathematics behind deep learning: Deep learning involves a lot of math, including linear algebra, calculus, and probability. Understanding these concepts will help you better understand the algorithms used in deep learning. 4. Choose a deep learning framework: Popular deep learning frameworks include Tensorflow, Keras, PyTorch, and Caffe. Choose one and learn it. 5. Practice with datasets: Work with datasets to understand how deep learning works in practice. Kaggle is a great platform to get started with real-world datasets. 6. Read research papers: Read research papers to stay up-to-date with the latest advancements in deep learning. 7. Join communities: Join online communities such as Reddit, Discord, or GitHub to connect with other deep learning enthusiasts and learn from them. 8. Build projects: Building projects is the best way to learn deep learning. Start with simple projects and gradually move on to more complex ones. Remember, deep learning is a vast field, and it takes time and effort to master it. Keep practicing, and you will get there.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值