W!o+ 的《小伶鼬工坊演義》︰神經網絡【轉折點】六

莊子‧外篇
秋水

秋水時至,百川灌河,涇流之大,兩涘渚崖之間,不辯牛馬。於是焉河伯欣然自喜,以天下之美為盡在己。順流而東行,至於北海,東面而視,不見水端,於是焉河伯始旋其面目,望洋向若而歎,曰:「野語有之曰『聞道百,以為莫己若』者,我之謂也。且夫我嘗聞少仲尼之聞而輕伯夷之義者,始吾弗信,今我睹子之難窮也,吾非至於子之門則殆矣,吾長見笑於大方之家。」

北海若曰:「井蛙不可以語於海者,拘於虛也;夏蟲不可以語於冰者,篤於時也;曲士不可以語於道者,束於教也。今爾出於崖涘,觀於大海,乃知爾醜,爾將可與語大理矣。天下之水,莫大於海,萬川歸之,不知何時止而不盈;尾閭泄之,不知何時已而不虛;春秋不變,水旱不知。此其過江河之流,不可為量數。而吾未嘗以此自多者,自以比形於天地而受氣於陰陽,吾在天地之間,猶小石小木之在大山也,方存乎見少,又奚以自多!計四海之在天地之間也 ,不似礨空之在大澤乎?計中國之在海內,不似稊米之在大倉乎?號物之數謂之萬,人處一焉;人卒九州,穀食之所生,舟車之所通 ,人處一焉。此其比萬物也,不似豪末之在於馬體乎?五帝之所連 ,三王之所爭,仁人之所憂,任士之所勞,盡此矣。伯夷辭之以為名,仲尼語之以為博,此其自多也,不似爾向之自多於水乎?」

……

公孫龍問於魏牟曰:「龍少學先生之道,長而明仁義之行,合同異 ,雜堅白,然不然,可不可,困百家之知,窮眾口之辯,吾自以為至達已。今吾聞莊子之言,汒焉異之,不知論之不及與,知之弗若與?今吾無所開吾喙,敢問其方。」

公子牟隱机太息,仰天而笑曰:「子獨不聞夫埳井之鼃乎?謂東海之鱉曰:『吾樂與!出跳梁乎井幹之上,入休乎缺甃之崖,赴水則接腋持頤,蹶泥則沒足滅跗,還虷蟹與科斗,莫吾能若也。且夫擅一壑之水,而跨跱埳井之樂,此亦至矣,夫子奚不時來入觀乎?』東海之鱉左足未入,而右膝已縶矣。於是逡巡而卻,告之海曰:『夫千里之遠,不足以舉其大;千仞之高,不足以極其深。禹之時 ,十年九潦,而水弗為加益;湯之時,八年七旱,而崖不為加損。夫不為頃久推移,不以多少進退者,此亦東海之大樂也。』於是埳井之鼃聞之,適適然驚,規規然自失也。且夫知不知是非之竟,而猶欲觀於莊子之言,是猶使蚊負山,商蚷馳河也,必不勝任矣。且夫知不知論極妙之言,而自適一時之利者,是非埳井之鼃與?且彼方跐黃泉而登大皇,無南無北,奭然四解,淪於不測;無東無西,始於玄冥,反於大通。子乃規規然而求之以察,索之以辯,是直用管窺天,用錐指地也,不亦小乎!子往矣!且子獨不聞壽陵餘子之學行於邯鄲與?未得國能,又失其故行矣,直匍匐而歸耳。今子不去,將忘子之故,失子之業。」

公孫龍口呿而不合,舌舉而不下,乃逸而走。

……

惠子相梁,莊子往見之。或謂惠子曰:「莊子來,欲代子相。」於是惠子恐,搜於國中三日三夜。莊子往見之,曰:「南方有鳥,其名為鵷鶵,子知之乎?夫鵷鶵發於南海而飛於北海,非梧桐不止,非練實不食,非醴泉不飲。於是鴟得腐鼠,鵷鶵過之,仰而視之曰:『嚇!』今子欲以子之梁國而嚇我邪?」

───

 

秋水』雖盛,卻是不能不見水端。邯鄲學步,恐怕未得國能,又失其故行矣。或許杜甫深解『秋水』文字,寄語

《天末懷李白》

涼風起天末,君子意如何。
鴻雁幾時到,江湖秋水多。
文章憎命達,魑魅喜人過。
應共冤魂語,投詩贈汨羅。

 

耶??!!設若國失其語,豈能思接千載乎!!??午夜夢回︰

派生碼訊

子 鼠

天澤履 ䷉ ,素履之往,獨行愿也。幽人貞吉 ,中不自亂也。愬愬終吉,志行也。視履考祥,其旋元吉。

紅火禮︰《説文解字》:禮,履也。所以事神致福也。从示从豊,豊亦聲。 古禮 ,古文禮。程式之先,當思其 禮 禮,當作說明,以利分享,以及來日之自讀。

派 ︰《了凡四訓》有言︰

何謂真假?昔有儒生數輩,謁中峰和尚,

問曰︰「佛氏論善惡報應,如影隨 形。今某人善,而子孫不興;某人惡,而家門隆盛︰佛說無稽矣。」

中峰云︰「凡情未滌,正眼未開,認善為惡,指惡為善,往往有之 。不憾己之是非顛倒,而反怨 天之報應有差乎?」

眾曰︰「善惡何致相反?」

中峰令試言。

一人謂「詈人毆人是惡;敬人禮人是善。」

中峰云︰「未必然也。」

一人謂「貪財妄取是惡,廉潔有守是善。」

中峰云︰「未必然也。」

眾人歷言其狀,中峰皆謂不然。因請問。

中峰告之曰︰「有益於人,是善;有益於己,是惡。有益於人,則毆人,詈人皆善也;有益於己,則敬人,禮人皆惡也。 是故人之行善,利人者公,公則為真;利己者私,私則為假。又根心者真,襲跡者假;又無為而為者真,有為而為者假;皆當自考。」

何 謂端曲?今人見謹愿之士,,類稱為善而取之;聖人則寧取狂狷。至於謹愿之士,雖一鄉皆好,而必以為德之賊;是世人之善惡,分明與聖人相反。推此一端,種種 取舍,無有不謬;天地鬼神之福善禍淫,皆與聖人同是非,而不與世俗同取舍。凡欲積善,決不可徇耳目,惟從心源隱微處,默默洗滌,純是濟世之心,則為端;苟 有一毫媚世之心,即為曲;純 是愛人之心,則為端;有一毫憤世之心,即為曲;純是敬人之心,則為端;有一毫玩世之心,即為曲;皆當細辨。

……

生 昔有『唐鳳』者,能文善語『珍珠串』☿☺︰

=head1 NAME
Lingua::Sinica::PerlYuYan – 中書珨 – Perl in Classical Chinese in Perl
=head1 VERSION
our VERSION = 1257700140.47574; # 2009年11月 9日 周一 01時09分11秒 CST</span>  <span style="color: #808000;">=head1 SYNOPSIS</span> <span style="color: #808000;"> # The Sieve of Eratosthenes - 埃拉托斯芬篩法</span> <span style="color: #808000;"> use Lingua::Sinica::PerlYuYan;</span>  <span style="color: #808000;">用籌兮用嚴。井涸兮無礙</span> <span style="color: #808000;"> 。印曰最高矣 又道數然哉。</span> <span style="color: #808000;"> 。截起吾純風 賦小入大合。</span> <span style="color: #808000;"> 。習予吾陣地 並二至純風。</span> <span style="color: #808000;"> 。當起段賦取 加陣地合始。</span> <span style="color: #808000;"> 。陣地賦篩始 繫繫此雜段。</span> <span style="color: #808000;"> 。終陣地兮印 正道次標哉。</span> <span style="color: #808000;"> 。輸空接段點 列終註泰來。</span>  <span style="color: #808000;">=head1 DESCRIPTION</span> <span style="color: #808000;"> This module makes it possible to write Perl programs in Classical Chinese poetry in Perl.</span>  <span style="color: #808000;">說此經者,能以珨文言文珨。</span>  <span style="color: #808000;">(If one I<has> to ask "Why?", please refer to L<Lingua::Romana::Perligata> for</span> <span style="color: #808000;"> related information.)</span>  。昔事已隨黃鶴去,此時空餘黃鶴樓。『珨』本無言語?!  <span style="color: #808080;">《廣韻》侯夾切《集韻》轄夾切,音洽。《玉篇》玉蛤,一云蜃器 。《集韻》蜃飾器。</span> <span style="color: #808080;"> 又《五音集韻》烏甲切,音鴨。開閉門也。</span>  此『經』將訴誰人知??又有『<a href="http://zh.wikipedia.org/zh-tw/%E5%91%A8%E8%9F%92">周蟒</a>』者,自稱『<a href="http://blog.gasolin.idv.tw/2007/09/blog-post_22.html">蓋索林</a>』 Gasolin ,曾把『派生』中文化,獨立<a href="http://code.google.com/p/zhpy/wiki/CodingStyle">風格</a>與<a href="http://blog.gasolin.idv.tw/2007/09/blog-post_22.html">堅持</a>,條條大道通羅馬。不知何因<a href="http://code.google.com/p/zhpy/">棄城池</a>,古道西風存瘦馬 ☿☹!剪不斷,理還亂,符碼文化聲聲慢,ㄚ˙禮多人不怪,斷腸人在天之涯!!  ☆ 編者言<a href="http://www.freesandal.org/wp-content/uploads/%E8%AA%AA%E6%98%8E.gif"><img class="alignnone size-full wp-image-32950" src="http://www.freesandal.org/wp-content/uploads/%E8%AA%AA%E6%98%8E.gif" alt="說明" width="120" height="19" /></a>  讀者需知『轉譯』之不易,此處 M♪o 用其家鄉之『<a href="http://www.freesandal.org/?m=20150319">城南舊事</a>』,將如何比擬恰當,或該寫『<a href="http://www.freesandal.org/?p=7613">圖靈</a>』,只恐不符旨意,或應說『<a href="http://zh.wikipedia.org/zh-tw/%E5%90%B3%E9%B3%B3">吳鳳</a>』 ,大概沒這事理,無法之法,採用莊子『隨寫隨掃』之筆法,以為『辜妄言之』哉!!  ── 摘自《<a href="http://www.freesandal.org/?p=33096">M♪o 之學習筆記本《子》開關︰【紅火禮】謙和有禮</a>》     <span style="color: #666699;">講此『派生三』與『中文化』之事,也算是履禮而行的吧。</span>  <span style="color: #808080;">【派生科學程式庫安裝】</span> <pre class="lang:python decode:true">sudo apt-get install python-numpy sudo apt-get install python-numpy sudo apt-get install python-scipy sudo apt-get install python3-scipy sudo apt-get install python-skimage  sudo apt-get install python3-skimage</pre>    <span style="color: #808080;">【派生<a style="color: #808080;" href="https://zh.wikipedia.org/zh-tw/%E6%80%BB%E5%8F%98%E5%B7%AE">總變差</a>程式庫安裝】</span> <pre class="lang:python decode:true">sudo apt-get install python-cffi python3-cffi sudo apt-get install liblapacke-dev sudo apt-get install libblas-dev sudo apt-get install liblapack-dev sudo pip install prox-tv sudo pip3 install prox-tv</pre>    <span style="color: #666699;">借著</span> <h1><span style="color: #666699;"><a style="color: #666699;" href="https://github.com/albarji/proxTV">proxTV</a></span></h1> <span style="color: #808080;">Matlab and Python toolbox for fast Total Variation proximity operators.</span>  <span style="color: #808080;">For an up-to-date version, check <a style="color: #808080;" href="https://github.com/albarji/proxTV">https://github.com/albarji/proxTV</a> .</span> <h2><span style="color: #808080;">Introduction</span></h2> <span style="color: #808080;"><strong>proxTV</strong> is a toolbox implementing blazing fast implementations of Total Variation proximity operators. While the core algorithms are implemented in C to achieve high efficiency, Matlab and Python interfaces are provided for ease of use.</span>  <span style="color: #808080;">The library provides efficient solvers for the following Total Variation proximity problems:</span> <table> <thead> <tr> <th><span style="color: #808080;">Problem</span></th> <th><span style="color: #808080;">Formulation</span></th> </tr> </thead> <tbody> <tr> <td><span style="color: #808080;">Standard (l1) Total Variation on a 1-dimensional signal</span></td> <td><span style="color: #808080;"><a style="color: #808080;" href="https://github.com/albarji/proxTV/blob/master/docs/img/TV1.png" target="_blank"><img class="" src="https://github.com/albarji/proxTV/raw/master/docs/img/TV1.png" alt="alt tag" width="175" height="33" /></a></span></td> </tr> <tr> <td><span style="color: #808080;">Quadratic (l2) Total Variation on a 1-dimensional signal</span></td> <td><span style="color: #808080;"><a style="color: #808080;" href="https://github.com/albarji/proxTV/blob/master/docs/img/TV2.png" target="_blank"><img class="" src="https://github.com/albarji/proxTV/raw/master/docs/img/TV2.png" alt="alt tag" width="182" height="32" /></a></span></td> </tr> <tr> <td><span style="color: #808080;">lp-norm Total Variation on a 1-dimensional signal</span></td> <td><span style="color: #808080;"><a style="color: #808080;" href="https://github.com/albarji/proxTV/blob/master/docs/img/TVp.png" target="_blank"><img class="" src="https://github.com/albarji/proxTV/raw/master/docs/img/TVp.png" alt="alt tag" width="182" height="32" /></a></span></td> </tr> <tr> <td><span style="color: #808080;">Weighted Total Variation on a 1-dimensional signal</span></td> <td><span style="color: #808080;"><a style="color: #808080;" href="https://github.com/albarji/proxTV/blob/master/docs/img/TV1w.png" target="_blank"><img class="" src="https://github.com/albarji/proxTV/raw/master/docs/img/TV1w.png" alt="alt tag" width="185" height="34" /></a></span></td> </tr> <tr> <td><span style="color: #808080;">Anisotropic Total Variation on a 2-dimensional signal</span></td> <td><span style="color: #808080;"><a style="color: #808080;" href="https://github.com/albarji/proxTV/blob/master/docs/img/TV2D.png" target="_blank"><img class="" src="https://github.com/albarji/proxTV/raw/master/docs/img/TV2D.png" alt="alt tag" width="258" height="30" /></a></span></td> </tr> <tr> <td><span style="color: #808080;">lp-norm Anisotropic Total Variation on a 2-dimensional signal</span></td> <td><span style="color: #808080;"><a style="color: #808080;" href="https://github.com/albarji/proxTV/blob/master/docs/img/TV2Dp.png" target="_blank"><img class="" src="https://github.com/albarji/proxTV/raw/master/docs/img/TV2Dp.png" alt="alt tag" width="271" height="29" /></a></span></td> </tr> <tr> <td><span style="color: #808080;">Weighted Anisotropic Total Variation on a 2-dimensional signal</span></td> <td><span style="color: #808080;"><a style="color: #808080;" href="https://github.com/albarji/proxTV/blob/master/docs/img/TV2Dw.png" target="_blank"><img class="" src="https://github.com/albarji/proxTV/raw/master/docs/img/TV2Dw.png" alt="alt tag" width="263" height="30" /></a></span></td> </tr> <tr> <td><span style="color: #808080;">Anisotropic Total Variation on a 3-dimensional signal</span></td> <td><span style="color: #808080;"><a style="color: #808080;" href="https://github.com/albarji/proxTV/blob/master/docs/img/TV3D.png" target="_blank"><img class="" src="https://github.com/albarji/proxTV/raw/master/docs/img/TV3D.png" alt="alt tag" width="308" height="24" /></a></span></td> </tr> <tr> <td><span style="color: #808080;">Generalized N-dimensional Anisotropic Total Variation</span></td> <td><span style="color: #808080;"><a style="color: #808080;" href="https://github.com/albarji/proxTV/blob/master/docs/img/TVND.png" target="_blank"><img class="" src="https://github.com/albarji/proxTV/raw/master/docs/img/TVND.png" alt="alt tag" width="227" height="36" /></a>, with X(di) every possible 1-dimensional slice of X following dimension di.</span></td> </tr> </tbody> </table> <span style="color: #808080;">───</span>     <span style="color: #666699;">可以探索</span> <h1 id="firstHeading" class="firstHeading" lang="en"><span style="color: #666699;"><a style="color: #666699;" href="https://en.wikipedia.org/wiki/Total_variation#cite_note-1">Total variation</a></span></h1> <span style="color: #808080;">In <a style="color: #808080;" title="Mathematics" href="https://en.wikipedia.org/wiki/Mathematics">mathematics</a>, the <b>total variation</b> identifies several slightly different concepts, related to the (<a style="color: #808080;" title="Local property" href="https://en.wikipedia.org/wiki/Local_property">local</a> or global) structure of the <a style="color: #808080;" title="Codomain" href="https://en.wikipedia.org/wiki/Codomain">codomain</a> of a <a style="color: #808080;" title="Function (mathematics)" href="https://en.wikipedia.org/wiki/Function_%28mathematics%29">function</a> or a <a style="color: #808080;" title="Measure (mathematics)" href="https://en.wikipedia.org/wiki/Measure_%28mathematics%29">measure</a>. For a <a style="color: #808080;" title="Real number" href="https://en.wikipedia.org/wiki/Real_number">real-valued</a> <a style="color: #808080;" title="Continuous function" href="https://en.wikipedia.org/wiki/Continuous_function">continuous function</a> <i>f</i>, defined on an <a style="color: #808080;" title="Interval (mathematics)" href="https://en.wikipedia.org/wiki/Interval_%28mathematics%29">interval</a> [<i>a</i>, <i>b</i>] ⊂ ℝ, its total variation on the interval of definition is a measure of the one-dimensional <a class="mw-redirect" style="color: #808080;" title="Arclength" href="https://en.wikipedia.org/wiki/Arclength">arclength</a> of the curve with parametric equation <i>x</i> ↦ <i>f</i>(<i>x</i>), for <i>x</i> ∈ [<i>a</i>, <i>b</i>].</span>  <img class="alignnone size-full wp-image-54243" src="http://www.freesandal.org/wp-content/uploads/Total_variation.gif" alt="Total_variation" width="179" height="236" />  <span style="color: #808080;">As the green ball travels on the graph of the given function, the length of the path travelled by that ball's projection on the <i>y</i>-axis, shown as a red ball, is the total variation of the function.</span>  <span style="color: #808080;">───</span>     <span style="color: #666699;">之旨趣。甚或能得『雜訊處理』之門徑耶!!</span> <pre class="lang:python decode:true">pi@raspberrypi:~ python
Python 2.7.9 (default, Mar 8 2015, 00:52:26)
[GCC 4.9.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import prox_tv as ptv
>>> import numpy as np
>>> from pylab import *
>>> import matplotlib.pyplot as plt
>>> import time
>>> N = 1000
>>> s = np.zeros((N,1))
>>> s[N/4:N/2] = 1
>>> s[N/2:3*N/4] = -1
>>> s[3*N/4:-N/8] = 2
>>> n = s + 0.5*randn(*shape(s))
>>> lam=20
>>> f = ptv.tv1_1d(n,lam)
>>> plt.subplot(3, 1, 1)
<matplotlib.axes._subplots.AxesSubplot object at 0x75a7d810>
>>> plt.title(‘TVL1 filtering’)
<matplotlib.text.Text object at 0x75a937f0>
>>> plt.plot(s)
[<matplotlib.lines.Line2D object at 0x72a6a0d0>]
>>> plt.ylabel(‘Original’)
<matplotlib.text.Text object at 0x75a9f0f0>
>>> grid(True)
>>> plt.subplot(3, 1, 2)
<matplotlib.axes._subplots.AxesSubplot object at 0x72a6a4b0>
>>> plt.plot(n)
[<matplotlib.lines.Line2D object at 0x72a382d0>]
>>> plt.ylabel(‘Noisy’)
<matplotlib.text.Text object at 0x72a7da90>
>>> grid(True)
>>> plt.subplot(3, 1, 3)
<matplotlib.axes._subplots.AxesSubplot object at 0x72a386b0>
>>> plt.plot(f)
[<matplotlib.lines.Line2D object at 0x72a38730>]
>>> plt.ylabel(‘Filtered’)
<matplotlib.text.Text object at 0x72a38f70>
>>> grid(True)
>>> plt.show()
>>>

 

signal-TV

 

假使能用『中文』作表達

【新增中文模組】

pi@raspberrypi:~/test more mnistloader.py  import struct import numpy as np  def 載入訓練資料():     with open("train-images-idx3-ubyte","rb") as imagefile:         magic, ni, nr, nc = struct.unpack(">IIII", imagefile.read(16))         return np.fromfile(imagefile, dtype=np.uint8).reshape(60000,784)  def 載入訓練標籤():     with open("train-labels-idx1-ubyte","rb") as labelfile:         magic, ni =  struct.unpack(">II", labelfile.read(8))         return np.fromfile(labelfile, dtype=np.uint8) </pre>   <pre class="lang:python decode:true">pi@raspberrypi:~/test python3
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mnistloader
>>> 訓練資料 = mnistloader.載入訓練資料()
>>> 訓練標籤 = mnistloader.載入訓練標籤()
>>> len(訓練資料)
60000
>>> len(訓練資料[0])
784
>>> len(訓練標籤)
60000
>>> 訓練標籤[0]
5
>>> import matplotlib.pyplot as plt

>>> 五 = 訓練資料[0].reshape(28,28)
>>> plt.imshow(五,cmap='Greys', interpolation='nearest')
<matplotlib.image.AxesImage object at 0x70f78990>
>>> plt.show()
>>>

 

HW5-origin

 

豈非善哉???