Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: luckypoem/tutorials
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: MorvanZhou/tutorials
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.

Commits on Oct 15, 2017

  1. fixed mistake

    MorvanZhou committed Oct 15, 2017
    Copy the full SHA
    1c59f1e View commit details

Commits on Oct 17, 2017

  1. fixed mistake

    MorvanZhou committed Oct 17, 2017
    Copy the full SHA
    782322a View commit details

Commits on Oct 19, 2017

  1. Resolve Error: "AttributeError"

    fix: tk11_msgbox.py
    
    Add a line to resolve "AttributeError" : 
    import tkinter.messagebox
    JNingWei authored Oct 19, 2017
    Copy the full SHA
    577cb2c View commit details
  2. docs : Add Annotations

    docs : Add Annotations
    
    After the code experiment, I add three annotations.
    JNingWei authored Oct 19, 2017
    Copy the full SHA
    409edaa View commit details

Commits on Oct 20, 2017

  1. Merge pull request MorvanZhou#57 from JNingWei/master

    Fix a bug "AttributeError"; Add three annotations.
    MorvanZhou authored Oct 20, 2017
    Copy the full SHA
    44bf664 View commit details

Commits on Oct 23, 2017

  1. fixed mistake

    MorvanZhou committed Oct 23, 2017
    Copy the full SHA
    41a630a View commit details

Commits on Oct 25, 2017

  1. fixed mistake

    MorvanZhou committed Oct 25, 2017
    Copy the full SHA
    3105772 View commit details

Commits on Nov 4, 2017

  1. update

    MorvanZhou committed Nov 4, 2017
    Copy the full SHA
    3e018ce View commit details

Commits on Nov 24, 2017

  1. clean up old code

    chunhuajiang committed Nov 24, 2017
    Copy the full SHA
    2d5d28a View commit details

Commits on Nov 25, 2017

  1. Merge pull request MorvanZhou#60 from tidyjiang8/fix

    clean up old code
    MorvanZhou authored Nov 25, 2017

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    621d289 View commit details

Commits on Nov 29, 2017

  1. update

    MorvanZhou committed Nov 29, 2017
    Copy the full SHA
    b26c095 View commit details
  2. update

    MorvanZhou committed Nov 29, 2017
    Copy the full SHA
    4d6bdaa View commit details
  3. update for new plt

    MorvanZhou committed Nov 29, 2017
    Copy the full SHA
    567cc96 View commit details

Commits on Nov 30, 2017

  1. update

    MorvanZhou committed Nov 30, 2017
    Copy the full SHA
    38bbda8 View commit details

Commits on Dec 16, 2017

  1. update

    MorvanZhou committed Dec 16, 2017
    Copy the full SHA
    69215f3 View commit details

Commits on Dec 29, 2017

  1. update

    MorvanZhou committed Dec 29, 2017
    Copy the full SHA
    7213be1 View commit details

Commits on Dec 30, 2017

  1. update

    MorvanZhou committed Dec 30, 2017
    Copy the full SHA
    0475773 View commit details

Commits on Mar 7, 2018

  1. fix typo

    MorvanZhou committed Mar 7, 2018
    Copy the full SHA
    0036113 View commit details

Commits on Mar 9, 2018

  1. fix typo

    MorvanZhou committed Mar 9, 2018
    Copy the full SHA
    37de6e0 View commit details

Commits on Oct 29, 2020

  1. up

    MorvanZhou committed Oct 29, 2020
    Copy the full SHA
    19081c8 View commit details
  2. update

    MorvanZhou committed Oct 29, 2020
    Copy the full SHA
    6c50656 View commit details

Commits on Oct 31, 2020

  1. up

    MorvanZhou committed Oct 31, 2020
    Copy the full SHA
    c36c899 View commit details
Showing with 1,553 additions and 140 deletions.
  1. +27 −24 README.md
  2. +4 −4 Reinforcement_learning_TUT/README.md
  3. +648 −0 basic/.ipynb_checkpoints/36_regex-checkpoint.ipynb
  4. +9 −6 basic/35_set.py
  5. +110 −0 basic/36_RegEx.py
  6. +648 −0 basic/36_regex.ipynb
  7. +1 −1 kerasTUT/10-save.py
  8. +1 −1 kerasTUT/2-installation.py
  9. +1 −1 kerasTUT/3-backend.py
  10. +1 −1 kerasTUT/4-regressor_example.py
  11. +1 −1 kerasTUT/5-classifier_example.py
  12. +2 −2 kerasTUT/6-CNN_example.py
  13. +1 −1 kerasTUT/7-RNN_Classifier_example.py
  14. +1 −1 kerasTUT/8-RNN_LSTM_Regressor_example.py
  15. +1 −1 kerasTUT/9-Autoencoder_example.py
  16. +10 −10 kerasTUT/README.md
  17. +29 −29 matplotlibTUT/README.md
  18. +4 −4 matplotlibTUT/plt7_legend.py
  19. +3 −2 matplotlibTUT/plt9_tick_visibility.py
  20. +4 −4 pyTorch tutorial/README.md
  21. +23 −23 tensorflowTUT/README.md
  22. BIN tensorflowTUT/tf15_tensorboard/logs/events.out.tfevents.1494075549.Morvan
  23. +2 −1 tensorflowTUT/tf20_RNN2.2/full_code.py
  24. BIN tensorflowTUT/tf20_RNN2.2/logs/events.out.tfevents.1490697566.Morvan
  25. BIN tensorflowTUT/tf20_RNN2.2/logs/events.out.tfevents.1490697588.Morvan
  26. BIN tensorflowTUT/tf20_RNN2.2/logs/events.out.tfevents.1493818356.Morvan
  27. BIN tensorflowTUT/tf20_RNN2.2/logs/events.out.tfevents.1493818411.Morvan
  28. BIN tensorflowTUT/tf20_RNN2.2/logs/events.out.tfevents.1493818762.Morvan
  29. BIN tensorflowTUT/tf20_RNN2.2/logs/events.out.tfevents.1509756112.Morvan
  30. BIN tensorflowTUT/tf20_RNN2.2/logs/events.out.tfevents.1509756156.Morvan
  31. BIN tensorflowTUT/tf20_RNN2/MNIST_data/t10k-images-idx3-ubyte.gz
  32. BIN tensorflowTUT/tf20_RNN2/MNIST_data/t10k-labels-idx1-ubyte.gz
  33. BIN tensorflowTUT/tf20_RNN2/MNIST_data/train-images-idx3-ubyte.gz
  34. BIN tensorflowTUT/tf20_RNN2/MNIST_data/train-labels-idx1-ubyte.gz
  35. +1 −1 tensorflowTUT/tf21_autoencoder/full_code.py
  36. +1 −1 tensorflowTUT/tf22_scope/tf22_RNN_scope.py
  37. +1 −1 tensorflowTUT/tf22_scope/tf22_scope.py
  38. +1 −1 tensorflowTUT/tf23_BN/tf23_BN.py
  39. +0 −2 tensorflowTUT/tf5_example2/full_code.py
  40. +14 −14 theanoTUT/README.md
  41. BIN tkinterTUT/ins.gif
  42. +4 −3 tkinterTUT/tk11_msgbox.py
51 changes: 27 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
<p align="center">
<a href="https://morvanzhou.github.io/tutorials/" target="_blank">
<img width="60%" src="https://github.com/MorvanZhou/tutorials/blob/master/%E7%89%87%E5%A4%B4.png" style="max-width:100%;">
<a href="https://mofanpy.com/tutorials/" target="_blank">
<img width="60%" src="%E7%89%87%E5%A4%B4.png" style="max-width:100%;">
</a>
</p>


<br>

我是 周沫凡, [莫烦Python](https://morvanzhou.github.io/about/) 只是谐音, 我喜欢制作,
分享所学的东西, 所以你能在这里找到很多有用的东西, 少走弯路. 你能在[这里](https://morvanzhou.github.io/about/)找到关于我的所有东西.
我是 周沫凡, [莫烦Python](https://mofanpy.com/) 只是谐音, 我喜欢制作,
分享所学的东西, 所以你能在这里找到很多有用的东西, 少走弯路. 你能在[这里](https://mofanpy.com/about/)找到关于我的所有东西.

## 这个 Python tutorial 的一些内容:

* [Python 基础](https://morvanzhou.github.io/tutorials/python-basic/)
* [基础](https://morvanzhou.github.io/tutorials/python-basic/basic/)
* [多线程 threading](https://morvanzhou.github.io/tutorials/python-basic/threading/)
* [多进程 multiprocessing](https://morvanzhou.github.io/tutorials/python-basic/multiprocessing/)
* [简单窗口 tkinter](https://morvanzhou.github.io/tutorials/python-basic/tkinter/)
* [机器学习](https://morvanzhou.github.io/tutorials/machine-learning/)
* [有趣的机器学习](https://morvanzhou.github.io/tutorials/machine-learning/ML-intro/)
* [强化学习 (Reinforcement Learning)](https://morvanzhou.github.io/tutorials/machine-learning/reinforcement-learning/)
* [进化算法 (Evolutionary Algorithm) 如遗传算法等](https://morvanzhou.github.io/tutorials/machine-learning/evolutionary-algorithm/)
* [Tensorflow (神经网络)](https://morvanzhou.github.io/tutorials/machine-learning/tensorflow/)
* [PyTorch (神经网络)](https://morvanzhou.github.io/tutorials/machine-learning/torch/)
* [Theano (神经网络)](https://morvanzhou.github.io/tutorials/machine-learning/theano/)
* [Keras (快速神经网络)](https://morvanzhou.github.io/tutorials/machine-learning/keras/)
* [Scikit-Learn (机器学习)](https://morvanzhou.github.io/tutorials/machine-learning/sklearn/)
* [数据处理](https://morvanzhou.github.io/tutorials/data-manipulation/)
* [Numpy & Pandas (处理数据)](https://morvanzhou.github.io/tutorials/data-manipulation/np-pd/)
* [Matplotlib (绘图)](https://morvanzhou.github.io/tutorials/data-manipulation/plt/)
* [其他](https://morvanzhou.github.io/tutorials/others/)
* [Git (版本管理)](https://morvanzhou.github.io/tutorials/others/git/)
* [Python 基础](https://mofanpy.com/tutorials/python-basic/)
* [基础](https://mofanpy.com/tutorials/python-basic/basic/)
* [多线程 threading](https://mofanpy.com/tutorials/python-basic/threading/)
* [多进程 multiprocessing](https://mofanpy.com/tutorials/python-basic/multiprocessing/)
* [简单窗口 tkinter](https://mofanpy.com/tutorials/python-basic/tkinter/)
* [机器学习](https://mofanpy.com/tutorials/machine-learning/)
* [有趣的机器学习](https://mofanpy.com/tutorials/machine-learning/ML-intro/)
* [强化学习 (Reinforcement Learning)](https://mofanpy.com/tutorials/machine-learning/reinforcement-learning/)
* [进化算法 (Evolutionary Algorithm) 如遗传算法等](https://mofanpy.com/tutorials/machine-learning/evolutionary-algorithm/)
* [Tensorflow (神经网络)](https://mofanpy.com/tutorials/machine-learning/tensorflow/)
* [PyTorch (神经网络)](https://mofanpy.com/tutorials/machine-learning/torch/)
* [Theano (神经网络)](https://mofanpy.com/tutorials/machine-learning/theano/)
* [Keras (快速神经网络)](https://mofanpy.com/tutorials/machine-learning/keras/)
* [Scikit-Learn (机器学习)](https://mofanpy.com/tutorials/machine-learning/sklearn/)
* [机器学习实战](https://mofanpy.com/tutorials/machine-learning/ML-practice/)
* [数据处理](https://mofanpy.com/tutorials/data-manipulation/)
* [Numpy & Pandas (处理数据)](https://mofanpy.com/tutorials/data-manipulation/np-pd/)
* [Matplotlib (绘图)](https://mofanpy.com/tutorials/data-manipulation/plt/)
* [爬虫](https://mofanpy.com/tutorials/data-manipulation/scraping/)
* [其他](https://mofanpy.com/tutorials/others/)
* [Git (版本管理)](https://mofanpy.com/tutorials/others/git/)
* [Linux 简易教学](https://mofanpy.com/tutorials/others/linux-basic/)

## 赞助和支持

这些 tutorial 都是我用业余时间写出来, 录成视频, 如果你觉得它对你很有帮助, 请你也分享给需要学习的朋友们.
如果你看好我的经验分享, 也请考虑适当的 [赞助打赏](https://morvanzhou.github.io/support/), 让我能继续分享更好的内容给大家.
如果你看好我的经验分享, 也请考虑适当的 [赞助打赏](https://mofanpy.com/support/), 让我能继续分享更好的内容给大家.
8 changes: 4 additions & 4 deletions Reinforcement_learning_TUT/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://www.youtube.com/watch?v=pieI7rOXELI&list=PLXO45tsB95cIplu-fLMpUEEZTwrDNh6Ba" target="_blank">
<img width="60%" src="https://github.com/MorvanZhou/Reinforcement-learning-with-tensorflow/blob/master/RL_cover.jpg?raw=true" style="max-width:100%;">
<img width="60%" src="/MorvanZhou/Reinforcement-learning-with-tensorflow/blob/master/RL_cover.jpg?raw=true" style="max-width:100%;">
</a>
</p>

@@ -10,11 +10,11 @@

# Note! This Reinforcement Learning Tutorial has been moved to anther independent repo:

[https://github.com/MorvanZhou/Reinforcement-learning-with-tensorflow](https://github.com/MorvanZhou/Reinforcement-learning-with-tensorflow)
[/MorvanZhou/Reinforcement-learning-with-tensorflow](/MorvanZhou/Reinforcement-learning-with-tensorflow)

# 请注意! 这个 强化学习 的教程代码已经被移至另一个网页:

[https://github.com/MorvanZhou/Reinforcement-learning-with-tensorflow](https://github.com/MorvanZhou/Reinforcement-learning-with-tensorflow)
[/MorvanZhou/Reinforcement-learning-with-tensorflow](/MorvanZhou/Reinforcement-learning-with-tensorflow)


# Donation
@@ -31,7 +31,7 @@

<div>
<a href="https://www.patreon.com/morvan">
<img src="https://morvanzhou.github.io/static/img/support/patreon.jpg"
<img src="https://mofanpy.com/static/img/support/patreon.jpg"
alt="Patreon"
height=120></a>
</div>
648 changes: 648 additions & 0 deletions basic/.ipynb_checkpoints/36_regex-checkpoint.ipynb

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions basic/35_set.py
Original file line number Diff line number Diff line change
@@ -10,17 +10,20 @@
print(set(char_list))
print(set(sentence))

print(set(char_list+ list(sentence)))
print(set(char_list + list(sentence)))

unique_char = set(char_list)
unique_char.add('x')
unique_char.add(['y', 'z'])
# unique_char.add(['y', 'z']) this is wrong
print(unique_char)

unique_char.remove('x')
print(unique_char)
unique_char.discard('d')
print(unique_char)
unique_char.clear()
print(unique_char)
print(char_list.discard('d'))
print(char_list.remove('d'))

print(char_list.difference({'a', 'e', 'i'}))
print(char_list.intersection({'a', 'e', 'i'}))
unique_char = set(char_list)
print(unique_char.difference({'a', 'e', 'i'}))
print(unique_char.intersection({'a', 'e', 'i'}))
110 changes: 110 additions & 0 deletions basic/36_RegEx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import re

# matching string
pattern1 = "cat"
pattern2 = "bird"
string = "dog runs to cat"
print(pattern1 in string) # True
print(pattern2 in string) # False


# regular expression
pattern1 = "cat"
pattern2 = "bird"
string = "dog runs to cat"
print(re.search(pattern1, string)) # <_sre.SRE_Match object; span=(12, 15), match='cat'>
print(re.search(pattern2, string)) # None


# multiple patterns ("run" or "ran")
ptn = r"r[au]n" # start with "r" means raw string
print(re.search(ptn, "dog runs to cat")) # <_sre.SRE_Match object; span=(4, 7), match='run'>


# continue
print(re.search(r"r[A-Z]n", "dog runs to cat")) # None
print(re.search(r"r[a-z]n", "dog runs to cat")) # <_sre.SRE_Match object; span=(4, 7), match='run'>
print(re.search(r"r[0-9]n", "dog r2ns to cat")) # <_sre.SRE_Match object; span=(4, 7), match='r2n'>
print(re.search(r"r[0-9a-z]n", "dog runs to cat")) # <_sre.SRE_Match object; span=(4, 7), match='run'>


# \d : decimal digit
print(re.search(r"r\dn", "run r4n")) # <_sre.SRE_Match object; span=(4, 7), match='r4n'>
# \D : any non-decimal digit
print(re.search(r"r\Dn", "run r4n")) # <_sre.SRE_Match object; span=(0, 3), match='run'>
# \s : any white space [\t\n\r\f\v]
print(re.search(r"r\sn", "r\nn r4n")) # <_sre.SRE_Match object; span=(0, 3), match='r\nn'>
# \S : opposite to \s, any non-white space
print(re.search(r"r\Sn", "r\nn r4n")) # <_sre.SRE_Match object; span=(4, 7), match='r4n'>
# \w : [a-zA-Z0-9_]
print(re.search(r"r\wn", "r\nn r4n")) # <_sre.SRE_Match object; span=(4, 7), match='r4n'>
# \W : opposite to \w
print(re.search(r"r\Wn", "r\nn r4n")) # <_sre.SRE_Match object; span=(0, 3), match='r\nn'>
# \b : empty string (only at the start or end of the word)
print(re.search(r"\bruns\b", "dog runs to cat")) # <_sre.SRE_Match object; span=(4, 8), match='runs'>
# \B : empty string (but not at the start or end of a word)
print(re.search(r"\B runs \B", "dog runs to cat")) # <_sre.SRE_Match object; span=(8, 14), match=' runs '>
# \\ : match \
print(re.search(r"runs\\", "runs\ to me")) # <_sre.SRE_Match object; span=(0, 5), match='runs\\'>
# . : match anything (except \n)
print(re.search(r"r.n", "r[ns to me")) # <_sre.SRE_Match object; span=(0, 3), match='r[n'>
# ^ : match line beginning
print(re.search(r"^dog", "dog runs to cat")) # <_sre.SRE_Match object; span=(0, 3), match='dog'>
# $ : match line ending
print(re.search(r"cat$", "dog runs to cat")) # <_sre.SRE_Match object; span=(12, 15), match='cat'>
# ? : may or may not occur
print(re.search(r"Mon(day)?", "Monday")) # <_sre.SRE_Match object; span=(0, 6), match='Monday'>
print(re.search(r"Mon(day)?", "Mon")) # <_sre.SRE_Match object; span=(0, 3), match='Mon'>


# multi-line
string = """
dog runs to cat.
I run to dog.
"""
print(re.search(r"^I", string)) # None
print(re.search(r"^I", string, flags=re.M)) # <_sre.SRE_Match object; span=(18, 19), match='I'>


# * : occur 0 or more times
print(re.search(r"ab*", "a")) # <_sre.SRE_Match object; span=(0, 1), match='a'>
print(re.search(r"ab*", "abbbbb")) # <_sre.SRE_Match object; span=(0, 6), match='abbbbb'>

# + : occur 1 or more times
print(re.search(r"ab+", "a")) # None
print(re.search(r"ab+", "abbbbb")) # <_sre.SRE_Match object; span=(0, 6), match='abbbbb'>

# {n, m} : occur n to m times
print(re.search(r"ab{2,10}", "a")) # None
print(re.search(r"ab{2,10}", "abbbbb")) # <_sre.SRE_Match object; span=(0, 6), match='abbbbb'>


# group
match = re.search(r"(\d+), Date: (.+)", "ID: 021523, Date: Feb/12/2017")
print(match.group()) # 021523, Date: Feb/12/2017
print(match.group(1)) # 021523
print(match.group(2)) # Date: Feb/12/2017

match = re.search(r"(?P<id>\d+), Date: (?P<date>.+)", "ID: 021523, Date: Feb/12/2017")
print(match.group('id')) # 021523
print(match.group('date')) # Date: Feb/12/2017

# findall
print(re.findall(r"r[ua]n", "run ran ren")) # ['run', 'ran']

# | : or
print(re.findall(r"(run|ran)", "run ran ren")) # ['run', 'ran']

# re.sub() replace
print(re.sub(r"r[au]ns", "catches", "dog runs to cat")) # dog catches to cat

# re.split()
print(re.split(r"[,;\.]", "a;b,c.d;e")) # ['a', 'b', 'c', 'd', 'e']


# compile
compiled_re = re.compile(r"r[ua]n")
print(compiled_re.search("dog ran to cat")) # <_sre.SRE_Match object; span=(4, 7), match='ran'>



648 changes: 648 additions & 0 deletions basic/36_regex.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion kerasTUT/10-save.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
To know more or get code samples, please visit my website:
https://morvanzhou.github.io/tutorials/
https://mofanpy.com/tutorials/
Or search: 莫烦Python
Thank you for supporting!
"""
2 changes: 1 addition & 1 deletion kerasTUT/2-installation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
To know more or get code samples, please visit my website:
https://morvanzhou.github.io/tutorials/
https://mofanpy.com/tutorials/
Or search: 莫烦Python
Thank you for supporting!
"""
2 changes: 1 addition & 1 deletion kerasTUT/3-backend.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
To know more or get code samples, please visit my website:
https://morvanzhou.github.io/tutorials/
https://mofanpy.com/tutorials/
Or search: 莫烦Python
Thank you for supporting!
"""
2 changes: 1 addition & 1 deletion kerasTUT/4-regressor_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
To know more or get code samples, please visit my website:
https://morvanzhou.github.io/tutorials/
https://mofanpy.com/tutorials/
Or search: 莫烦Python
Thank you for supporting!
"""
2 changes: 1 addition & 1 deletion kerasTUT/5-classifier_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
To know more or get code samples, please visit my website:
https://morvanzhou.github.io/tutorials/
https://mofanpy.com/tutorials/
Or search: 莫烦Python
Thank you for supporting!
"""
4 changes: 2 additions & 2 deletions kerasTUT/6-CNN_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
To know more or get code samples, please visit my website:
https://morvanzhou.github.io/tutorials/
https://mofanpy.com/tutorials/
Or search: 莫烦Python
Thank you for supporting!
"""
@@ -23,7 +23,7 @@
from keras.optimizers import Adam

# download the mnist to the path '~/.keras/datasets/' if it is the first time to be called
# X shape (60,000 28x28), y shape (10,000, )
# training X shape (60000, 28x28), Y shape (60000, ). test X shape (10000, 28x28), Y shape (10000, )
(X_train, y_train), (X_test, y_test) = mnist.load_data()

# data pre-processing
2 changes: 1 addition & 1 deletion kerasTUT/7-RNN_Classifier_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
To know more or get code samples, please visit my website:
https://morvanzhou.github.io/tutorials/
https://mofanpy.com/tutorials/
Or search: 莫烦Python
Thank you for supporting!
"""
2 changes: 1 addition & 1 deletion kerasTUT/8-RNN_LSTM_Regressor_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
To know more or get code samples, please visit my website:
https://morvanzhou.github.io/tutorials/
https://mofanpy.com/tutorials/
Or search: 莫烦Python
Thank you for supporting!
"""
2 changes: 1 addition & 1 deletion kerasTUT/9-Autoencoder_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
To know more or get code samples, please visit my website:
https://morvanzhou.github.io/tutorials/
https://mofanpy.com/tutorials/
Or search: 莫烦Python
Thank you for supporting!
"""
20 changes: 10 additions & 10 deletions kerasTUT/README.md
Original file line number Diff line number Diff line change
@@ -2,19 +2,19 @@

In these tutorials for Tensorflow, we will build our first Neural Network and try to build some advanced Neural Network architectures developed recent years.

All methods mentioned below have their video and text tutorial in Chinese. Visit [莫烦 Python](https://morvanzhou.github.io/tutorials/) for more.
All methods mentioned below have their video and text tutorial in Chinese. Visit [莫烦 Python](https://mofanpy.com/) for more.
If you speak Chinese, you can watch my [Youtube channel](https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg) as well.


* [Install](https://github.com/MorvanZhou/tutorials/blob/master/kerasTUT/2-installation.py)
* [Backend (Tensorflow/Theano)](https://github.com/MorvanZhou/tutorials/blob/master/kerasTUT/3-backend.py)
* [Install](2-installation.py)
* [Backend (Tensorflow/Theano)](3-backend.py)
* Networks
* [Simple Regressor](https://github.com/MorvanZhou/tutorials/blob/master/kerasTUT/4-regressor_example.py)
* [Simple Classifier](https://github.com/MorvanZhou/tutorials/blob/master/kerasTUT/5-classifier_example.py)
* [CNN](https://github.com/MorvanZhou/tutorials/blob/master/kerasTUT/6-CNN_example.py)
* [RNN classifier](https://github.com/MorvanZhou/tutorials/blob/master/kerasTUT/7-RNN_Classifier_example.py)
* [RNN LSTM regressor](https://github.com/MorvanZhou/tutorials/blob/master/kerasTUT/8-RNN_LSTM_Regressor_example.py)
* [Autoencoder](https://github.com/MorvanZhou/tutorials/blob/master/kerasTUT/9-Autoencoder_example.py)
* [Simple Regressor](4-regressor_example.py)
* [Simple Classifier](5-classifier_example.py)
* [CNN](6-CNN_example.py)
* [RNN classifier](7-RNN_Classifier_example.py)
* [RNN LSTM regressor](8-RNN_LSTM_Regressor_example.py)
* [Autoencoder](9-Autoencoder_example.py)


# Donation
@@ -31,7 +31,7 @@ If you speak Chinese, you can watch my [Youtube channel](https://www.youtube.com

<div>
<a href="https://www.patreon.com/morvan">
<img src="https://morvanzhou.github.io/static/img/support/patreon.jpg"
<img src="https://mofanpy.com/static/img/support/patreon.jpg"
alt="Patreon"
height=120></a>
</div>
58 changes: 29 additions & 29 deletions matplotlibTUT/README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
# Python Matplotlib methods and tutorials

All methods mentioned below have their video and text tutorial in Chinese. Visit [莫烦 Python](https://morvanzhou.github.io/tutorials/) for more.
All methods mentioned below have their video and text tutorial in Chinese. Visit [莫烦 Python](https://mofanpy.com/tutorials/) for more.


* [Install](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt2_install.py)
* [Basic usage](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt3_simple_plot.py)
* [Figure](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt4_figure.py)
* [Axis setting1](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt5_ax_setting1.py)
* [Axis setting2](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt6_ax_setting2.py)
* [Legend](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt7_legend.py)
* [Annotation](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt8_annotation.py)
* [Deal with Tick](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt9_tick_visibility.py)
* [Install](plt2_install.py)
* [Basic usage](plt3_simple_plot.py)
* [Figure](plt4_figure.py)
* [Axis setting1](plt5_ax_setting1.py)
* [Axis setting2](plt6_ax_setting2.py)
* [Legend](plt7_legend.py)
* [Annotation](plt8_annotation.py)
* [Deal with Tick](plt9_tick_visibility.py)
* Drawing
* [Scatter](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt10_scatter.py)
* [Bar](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt11_bar.py)
* [Contours](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt12_contours.py)
* [Image](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt13_image.py)
* [3D plot](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt14_3d.py)
* [Scatter](plt10_scatter.py)
* [Bar](plt11_bar.py)
* [Contours](plt12_contours.py)
* [Image](plt13_image.py)
* [3D plot](plt14_3d.py)
* Subplots
* [Subplot1](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt15_subplot.py)
* [Grid Subplot](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt16_grid_subplot.py)
* [Plot in Plot](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt17_plot_in_plot.py)
* [Second y-axis](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt18_secondary_yaxis.py)
* [Subplot1](plt15_subplot.py)
* [Grid Subplot](plt16_grid_subplot.py)
* [Plot in Plot](plt17_plot_in_plot.py)
* [Second y-axis](plt18_secondary_yaxis.py)
* Animation
* [Function Animation](https://github.com/MorvanZhou/tutorials/blob/master/matplotlibTUT/plt19_animation.py)
* [Function Animation](plt19_animation.py)


# Some plots from these tutorials:

![axis setting](https://morvanzhou.github.io/static/results/plt/2_4_3.png)
![axis setting](https://mofanpy.com/static/results/plt/2_4_3.png)

![Annotation](https://morvanzhou.github.io/static/results/plt/2_6_5.png)
![Annotation](https://mofanpy.com/static/results/plt/2_6_5.png)

![Scatter](https://morvanzhou.github.io/static/results/plt/3_1_1.png)
![Scatter](https://mofanpy.com/static/results/plt/3_1_1.png)

![Bars](https://morvanzhou.github.io/static/results/plt/3_2_1.png)
![Bars](https://mofanpy.com/static/results/plt/3_2_1.png)

![Contours](https://morvanzhou.github.io/static/results/plt/3_3_1.png)
![Contours](https://mofanpy.com/static/results/plt/3_3_1.png)

![Image](https://morvanzhou.github.io/static/results/plt/3_4_1.png)
![Image](https://mofanpy.com/static/results/plt/3_4_1.png)

![3D plot](https://morvanzhou.github.io/static/results/plt/3_5_1.png)
![3D plot](https://mofanpy.com/static/results/plt/3_5_1.png)

![Subplot](https://morvanzhou.github.io/static/results/plt/4_1_2.png)
![Subplot](https://mofanpy.com/static/results/plt/4_1_2.png)

![plot in plot](https://morvanzhou.github.io/static/results/plt/4_3_1.png)
![plot in plot](https://mofanpy.com/static/results/plt/4_3_1.png)

# Donation

@@ -60,7 +60,7 @@ All methods mentioned below have their video and text tutorial in Chinese. Visit

<div>
<a href="https://www.patreon.com/morvan">
<img src="https://morvanzhou.github.io/static/img/support/patreon.jpg"
<img src="https://mofanpy.com/static/img/support/patreon.jpg"
alt="Patreon"
height=120></a>
</div>
8 changes: 4 additions & 4 deletions matplotlibTUT/plt7_legend.py
Original file line number Diff line number Diff line change
@@ -30,11 +30,11 @@
plt.yticks([-2, -1.8, -1, 1.22, 3],
[r'$really\ bad$', r'$bad$', r'$normal$', r'$good$', r'$really\ good$'])

l1, = plt.plot(x, y2, label='linear line')
l2, = plt.plot(x, y1, color='red', linewidth=1.0, linestyle='--', label='square line')
l1, = plt.plot(x, y1, label='linear line')
l2, = plt.plot(x, y2, color='red', linewidth=1.0, linestyle='--', label='square line')

# plt.legend(loc='upper right')
plt.legend(handles=[l1, l2], labels=['up', 'down'], loc='best')
plt.legend(loc='upper right')
# plt.legend(handles=[l1, l2], labels=['up', 'down'], loc='best')
# the "," is very important in here l1, = plt... and l2, = plt... for this step
"""legend( handles=(line1, line2, line3),
labels=('label1', 'label2', 'label3'),
5 changes: 3 additions & 2 deletions matplotlibTUT/plt9_tick_visibility.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
y = 0.1*x

plt.figure()
plt.plot(x, y, linewidth=10)
plt.plot(x, y, linewidth=10, zorder=1) # set zorder for ordering the plot in plt 2.0.2 or higher
plt.ylim(-2, 2)
ax = plt.gca()
ax.spines['right'].set_color('none')
@@ -32,5 +32,6 @@

for label in ax.get_xticklabels() + ax.get_yticklabels():
label.set_fontsize(12)
label.set_bbox(dict(facecolor='white', edgecolor='None', alpha=0.7))
# set zorder for ordering the plot in plt 2.0.2 or higher
label.set_bbox(dict(facecolor='white', edgecolor='none', alpha=0.8, zorder=2))
plt.show()
8 changes: 4 additions & 4 deletions pyTorch tutorial/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="http://pytorch.org/" target="_blank">
<img width="40%" src="https://github.com/MorvanZhou/PyTorch-Tutorial/blob/master/logo.png" style="max-width:100%;">
<img width="40%" src="/MorvanZhou/PyTorch-Tutorial/blob/master/logo.png" style="max-width:100%;">
</a>
</p>

@@ -10,11 +10,11 @@

# This pyTorch Tutorial has been moved to anther independent repo:

[https://github.com/MorvanZhou/PyTorch-Tutorial](https://github.com/MorvanZhou/PyTorch-Tutorial)
[/MorvanZhou/PyTorch-Tutorial](/MorvanZhou/PyTorch-Tutorial)

# 请注意, 这个 PyTorch 的教程代码已经被移至另一个网页:

[https://github.com/MorvanZhou/PyTorch-Tutorial](https://github.com/MorvanZhou/PyTorch-Tutorial)
[/MorvanZhou/PyTorch-Tutorial](/MorvanZhou/PyTorch-Tutorial)


# Donation
@@ -31,7 +31,7 @@

<div>
<a href="https://www.patreon.com/morvan">
<img src="https://morvanzhou.github.io/static/img/support/patreon.jpg"
<img src="https://mofanpy.com/static/img/support/patreon.jpg"
alt="Patreon"
height=120></a>
</div>
46 changes: 23 additions & 23 deletions tensorflowTUT/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://www.tensorflow.org/" target="_blank">
<img width="40%" src="https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/logo.jpeg" style="max-width:100%;">
<img width="40%" src="logo.jpeg" style="max-width:100%;">
</a>
</p>

@@ -14,38 +14,38 @@

In these tutorials for Tensorflow, we will build our first Neural Network and try to build some advanced Neural Network architectures developed recent years.

All methods mentioned below have their video and text tutorial in Chinese. Visit [莫烦 Python](https://morvanzhou.github.io/tutorials/) for more.
All methods mentioned below have their video and text tutorial in Chinese. Visit [莫烦 Python](https://mofanpy.com/tutorials/) for more.
If you speak Chinese, you can watch my [Youtube channel](https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg) as well.

**As many requests about making these tutorials available in English, please find them in this playlist:** ([https://www.youtube.com/playlist?list=PLXO45tsB95cJHXaDKpbwr5fC_CCYylw1f](https://www.youtube.com/playlist?list=PLXO45tsB95cJHXaDKpbwr5fC_CCYylw1f))


* Tensorflow Basic
* [Basic example](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf5_example2/full_code.py)
* [Session](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tensorflow6_session.py)
* [Variable](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tensorflow7_variable.py)
* [Placeholder](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tensorflow8_feeds.py)
* [Basic example](tf5_example2/full_code.py)
* [Session](tensorflow6_session.py)
* [Variable](tensorflow7_variable.py)
* [Placeholder](tensorflow8_feeds.py)
* Build your first NN
* [Adding layer](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tensorflow10_def_add_layer.py)
* [Build NN](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf11_build_network/full_code.py)
* [Visualize update](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf12_plot_result/full_code.py)
* [Adding layer](tensorflow10_def_add_layer.py)
* [Build NN](tf11_build_network/full_code.py)
* [Visualize update](tf12_plot_result/full_code.py)
* Tensorboard
* [Visualization 1](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf14_tensorboard/full_code.py)
* [Visualization 2](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf15_tensorboard/full_code.py)
* [Classification](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf16_classification/full_code.py)
* [Overfitting and dropout](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf17_dropout/full_code.py)
* [Save Network](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf19_saver.py)
* [Visualization 1](tf14_tensorboard/full_code.py)
* [Visualization 2](tf15_tensorboard/full_code.py)
* [Classification](tf16_classification/full_code.py)
* [Overfitting and dropout](tf17_dropout/full_code.py)
* [Save Network](tf19_saver.py)
* CNN
* [CNN layers](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf18_CNN2/full_code.py)
* [CNN training](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf18_CNN3/full_code.py)
* [CNN layers](tf18_CNN2/full_code.py)
* [CNN training](tf18_CNN3/full_code.py)
* RNN
* [Classification](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf20_RNN2/full_code.py)
* [Regression](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf20_RNN2.2/full_code.py)
* [Autoencoder](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf21_autoencoder/full_code.py)
* [Classification](tf20_RNN2/full_code.py)
* [Regression](tf20_RNN2.2/full_code.py)
* [Autoencoder](tf21_autoencoder/full_code.py)
* Scope
* [Scope in TF](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf22_scope/tf22_scope.py)
* [Training Testing for RNN](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf22_scope/tf22_RNN_scope.py)
* [Batch Normalization](https://github.com/MorvanZhou/tutorials/blob/master/tensorflowTUT/tf23_BN/tf23_BN.py)
* [Scope in TF](tf22_scope/tf22_scope.py)
* [Training Testing for RNN](tf22_scope/tf22_RNN_scope.py)
* [Batch Normalization](tf23_BN/tf23_BN.py)



@@ -63,7 +63,7 @@ If you speak Chinese, you can watch my [Youtube channel](https://www.youtube.com

<div>
<a href="https://www.patreon.com/morvan">
<img src="https://morvanzhou.github.io/static/img/support/patreon.jpg"
<img src="https://mofanpy.com/static/img/support/patreon.jpg"
alt="Patreon"
height=120></a>
</div>
Binary file not shown.
3 changes: 2 additions & 1 deletion tensorflowTUT/tf20_RNN2.2/full_code.py
Original file line number Diff line number Diff line change
@@ -100,7 +100,8 @@ def compute_cost(self):
name='average_cost')
tf.summary.scalar('cost', self.cost)

def ms_error(self, labels, logits):
@staticmethod
def ms_error(labels, logits):
return tf.square(tf.subtract(labels, logits))

def _weight_variable(self, shape, name='weights'):
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion tensorflowTUT/tf21_autoencoder/full_code.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# View more python learning tutorial on my Youtube and Youku channel!!!

# My tutorial website: https://morvanzhou.github.io/tutorials/
# My tutorial website: https://mofanpy.com/tutorials/

from __future__ import division, print_function, absolute_import

2 changes: 1 addition & 1 deletion tensorflowTUT/tf22_scope/tf22_RNN_scope.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# visit https://morvanzhou.github.io/tutorials/ for more!
# visit https://mofanpy.com/tutorials/ for more!


# 22 scope (name_scope/variable_scope)
2 changes: 1 addition & 1 deletion tensorflowTUT/tf22_scope/tf22_scope.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# visit https://morvanzhou.github.io/tutorials/ for more!
# visit https://mofanpy.com/tutorials/ for more!


# 22 scope (name_scope/variable_scope)
2 changes: 1 addition & 1 deletion tensorflowTUT/tf23_BN/tf23_BN.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
visit https://morvanzhou.github.io/tutorials/ for more!
visit https://mofanpy.com/tutorials/ for more!
Build two networks.
1. Without batch normalization
2 changes: 0 additions & 2 deletions tensorflowTUT/tf5_example2/full_code.py
Original file line number Diff line number Diff line change
@@ -23,8 +23,6 @@
loss = tf.reduce_mean(tf.square(y-y_data))
optimizer = tf.train.GradientDescentOptimizer(0.5)
train = optimizer.minimize(loss)

init = tf.initialize_all_variables()
### create tensorflow structure end ###

sess = tf.Session()
28 changes: 14 additions & 14 deletions theanoTUT/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Python Theano methods and tutorials

All methods mentioned below have their video and text tutorial in Chinese. Visit [莫烦 Python](https://morvanzhou.github.io/tutorials/) for more.
All methods mentioned below have their video and text tutorial in Chinese. Visit [莫烦 Python](https://mofanpy.com/tutorials/) for more.


* [Install](https://github.com/MorvanZhou/tutorials/blob/master/theanoTUT/theano2_install.py)
* [Example of Machine Learning](https://github.com/MorvanZhou/tutorials/blob/master/theanoTUT/theano3_what_does_ML_do.py)
* [Install](theano2_install.py)
* [Example of Machine Learning](theano3_what_does_ML_do.py)
* Basic
* [Basic Usage](https://github.com/MorvanZhou/tutorials/blob/master/theanoTUT/theano4_basic_usage.py)
* [Function](https://github.com/MorvanZhou/tutorials/blob/master/theanoTUT/theano5_function.py)
* [Shared Variable](https://github.com/MorvanZhou/tutorials/blob/master/theanoTUT/theano6_shared_variable.py)
* [Activation Function](https://github.com/MorvanZhou/tutorials/blob/master/theanoTUT/theano7_activation_function.py)
* [Basic Usage](theano4_basic_usage.py)
* [Function](theano5_function.py)
* [Shared Variable](theano6_shared_variable.py)
* [Activation Function](theano7_activation_function.py)
* Build a Network
* [Layer](https://github.com/MorvanZhou/tutorials/blob/master/theanoTUT/theano8_Layer_class.py)
* [Regression](https://github.com/MorvanZhou/tutorials/blob/master/theanoTUT/theano9_regression_nn/full_code.py)
* [Visualize Regression](https://github.com/MorvanZhou/tutorials/blob/master/theanoTUT/theano10_regression_visualization/full_code.py)
* [Classification](https://github.com/MorvanZhou/tutorials/blob/master/theanoTUT/theano11_classification_nn/full_code.py)
* [Regularization](https://github.com/MorvanZhou/tutorials/tree/master/theanoTUT/theano12_regularization)
* [Save model](https://github.com/MorvanZhou/tutorials/blob/master/theanoTUT/theano13_save/full_code.py)
* [Layer](theano8_Layer_class.py)
* [Regression](theano9_regression_nn/full_code.py)
* [Visualize Regression](theano10_regression_visualization/full_code.py)
* [Classification](theano11_classification_nn/full_code.py)
* [Regularization](https://github.com/MorvanZhou/tutorials/tree/master/theano12_regularization)
* [Save model](theano13_save/full_code.py)

# Donation

@@ -32,7 +32,7 @@ All methods mentioned below have their video and text tutorial in Chinese. Visit

<div>
<a href="https://www.patreon.com/morvan">
<img src="https://morvanzhou.github.io/static/img/support/patreon.jpg"
<img src="https://mofanpy.com/static/img/support/patreon.jpg"
alt="Patreon"
height=120></a>
</div>
Binary file added tkinterTUT/ins.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions tkinterTUT/tk11_msgbox.py
Original file line number Diff line number Diff line change
@@ -4,15 +4,16 @@
# Youku video tutorial: http://i.youku.com/pythontutorial

import tkinter as tk
import tkinter.messagebox

window = tk.Tk()
window.title('my window')
window.geometry('200x200')

def hit_me():
#tk.messagebox.showinfo(title='Hi', message='hahahaha')
#tk.messagebox.showwarning(title='Hi', message='nononono')
#tk.messagebox.showerror(title='Hi', message='No!! never')
#tk.messagebox.showinfo(title='Hi', message='hahahaha') # return 'ok'
#tk.messagebox.showwarning(title='Hi', message='nononono') # return 'ok'
#tk.messagebox.showerror(title='Hi', message='No!! never') # return 'ok'
#print(tk.messagebox.askquestion(title='Hi', message='hahahaha')) # return 'yes' , 'no'
#print(tk.messagebox.askyesno(title='Hi', message='hahahaha')) # return True, False
print(tk.messagebox.asktrycancel(title='Hi', message='hahahaha')) # return True, False