W!o+ 的《小伶鼬工坊演義》︰神經網絡【Perceptron】三

為什麼人們會在意『感知器』 XOR 的問題呢?如果一個『神經元』就是一台『圖靈機』,或足以表達造物之神奇!或可以顯現人所以成萬物之靈的理據?還是只是對

感知器

感知器(英語:Perceptron)是Frank Rosenblatt在1957年就職於Cornell航空實驗室Cornell Aeronautical Laboratory)時所發明的一種人工神經網路。它可以被視為一種最簡單形式的前饋神經網路 ,是一種二元線性分類器

Frank Rosenblatt給出了相應的感知機學習算法,常用的有感知機學習、最小二乘法和梯度下降法。譬如,感知機利用梯度下降法對損失函數進行極小化,求出可將訓練數據進行線性劃分的分離超平面 ,從而求得感知機模型。

感知機是生物神經細胞的簡單抽象。神經細胞結構大致可分為:樹突突觸細胞體軸突。 單個神經細胞可被視為一種只有兩種狀態的機器——激動時為『是』,而未激動時為『否』。神經細胞的狀態取決於從其它的神經細胞收到的輸入信號量,及突觸的 強度(抑制或加強)。當信號量總和超過了某個閾值時,細胞體就會激動,產生電脈衝。電脈衝沿著軸突並通過突觸傳遞到其它神經元。為了模擬神經細胞行為,與 之對應的感知機基礎概念被提出,如權量(突觸)、偏置(閾值)及激活函數(細胞體)。

在人工神經網絡領域中,感知機也被指為單層的人工神經網絡,以區別於較複雜的多層感知機(Multilayer Perceptron)。作為一種線性分類器,(單層)感知機可說是最簡單的前向人工神經網絡形式 。儘管結構簡單,感知機能夠學習並解決相當複雜的問題。感知機主要的本質缺陷是它不能處理線性不可分問題。

 

819px-Complete_neuron_cell_diagram_zh.svg

神經細胞結構示意圖

歷史

1943年,心理學家Warren McCulloch和數理邏輯學家Walter Pitts在合作的《A logical calculus of the ideas immanent in nervous activity》[1]論文中提出並給出了人工神經網絡的概念及人工神經元的數學模型,從而開創了人工神經網絡研究的時代。1949年,心理學家唐納德·赫布在《The Organization of Behavior》[2]論文中描述了神經元學習法則

人 工神經網絡更進一步被美國神經學家Frank Rosenblatt所發展。他提出了可以模擬人類感知能力的機器,並稱之為『感知機』。1957年,在Cornell航空實驗室中,他成功在IBM 704機上完成了感知機的仿真。兩年後,他又成功實現了能夠識別一些英文字母、基於感知機的神經計算機——Mark1,並於1960年6月23日,展示與眾。

為了『教導』感知機識別圖像,Rosenblatt,在Hebb學習法則的 基礎上,發展了一種疊代、試錯、類似於人類學習過程的學習算法——感知機學習。除了能夠識別出現較多次的字母,感知機也能對不同書寫方式的字母圖像進行概 括和歸納。但是,由於本身的局限,感知機除了那些包含在訓練集裡的圖像以外,不能對受干擾(半遮蔽 、不同大小、平移、旋轉)的字母圖像進行可靠的識別。

首個有關感知機的成果,由Rosenblatt於1958年發表在《The Perceptron: A Probabilistic Model for Information Storage and Organization in the Brain》[3]的文章里。1962年,他又出版了《Principles of Neurodynamics: Perceptrons and the theory of brain mechanisms》[4]一書,向大眾深入解釋感知機的理論知識及背景假設。此書介紹了一些重要的概念及定理證明,例如感知機收斂定理

雖然最初被認為有著良好的發展潛能,但感知機最終被證明不能處理諸多的模式識別問題。1969年,Marvin MinskySeymour Papert在《Perceptrons》書中,仔細分析了以感知機為代表的單層神經網絡系統的功能及局限,證明感知機不能解決簡單的異或XOR)等線性不可分問題,但Rosenblatt和Minsky及Papert等人在當時已經了解到多層神經網絡能夠解決線性不可分的問題。

由於Rosenblatt等人沒能夠及時推廣感知機學習算法到多層神經網絡上,又由於《Perceptrons》在研究領域中的巨大影響,及人們對書中論點的誤解,造成了人工神經領域發展的長年停滯及低潮,直到人們認識到多層感知機沒有單層感知機固有的缺陷及反向傳播算法在80年代的提出,才有所恢復。1987年,書中的錯誤得到了校正,並更名再版為《Perceptrons – Expanded Edition》。

近年,在FreundSchapire1998)使用核技巧改 進感知機學習算法之後,愈來愈多的人對感知機學習算法產生興趣。後來的研究表明除了二元分類,感知機也能應用在較複雜、被稱為structured learning類型的任務上(Collins, 2002),又或使用在分布式計算環境中的大規模機器學習問題上(McDonald, Hall and Mann, 2011)。

───

 

美麗的誤解?!要是『感知器網絡』能夠學習成為『豆鵝狐人』

『豆鵝狐人』之問題就是

狐狸、鵝、豆子問題
狐狸、鵝、豆子問題〔又稱狼、羊、菜問題〕是一則古老的智力遊戲題。

問題
有一個農民到集市買了一隻狐狸、一隻鵝和一袋豆子,回家時要渡過一條河。河中有一條船,但是只能裝一樣東西。而且,如果沒有人看管,狐狸會吃掉鵝,而鵝又很喜歡吃豆子。問:怎樣才能讓這些東西都安全過河?

解答

第一步、帶鵝過河;
第二步、空手回來;
第三步、帶狐狸〔或豆子〕過河;
第四步、帶鵝回來;
第五步、帶豆子〔或狐狸〕過河;
第六步、空手回來;
第七步、帶鵝過河。

在此『問』的『問題』是︰

如何將之用 pyDatalog 語言『改寫重述』,使得可以用『程式』來執行『推理』,得到『答案』的呢?

─── 摘自《勇闖新世界︰ 《 pyDatalog 》 導引《十》豆鵝狐人之問題篇

 

之『解題者』!!那麼它的『命題推理』能力

『命題邏輯』 Propositional calculus 是一種『真、假』二值邏輯。在這個邏輯體系裡,所有命題『非真即假』。它的主要特徵可由『矛盾蘊函萬有』,叫做『爆炸原理』,來概括︰

一、 假設 甲 與 非甲 皆真 【矛盾】

二、 甲真 【來自於一之中『與』 and 的詞義】

三、甲 或 萬有 為真 【來自於二以及『或』 or 的詞義】

四、非甲 【來自於一之中『與』 and 的詞義】

五、 萬有 【來自於三和四,理則歸結】

所以證明了『矛盾 → 萬有』為真。

或許可以說近代『邏輯』相關的零零種種研究,多半與一個稱之為『羅素悖論』︰

有一位理髮師宣稱,他為所有不為自己理髮的人理髮,請問他為不為自己理髮? ── 引自《{x|x ∉ x} !!??》──

者有千絲萬縷的聯繫!同一篇文章中所講到的︰邏輯學家為了說明邏輯推導是否合理有效合法,構造了『真值表』︰

P ,非 P
P ,   ~P
QP 且 Q
P ‧ Q
P 或 Q
P + Q
若 P 則 Q
P → Q
非 P 或 Q
~P + Q
真 ,假
 T      F

T

T

T

T

T
真 ,假
 T      F

F

F

T

F

F
假 ,真
 F      T

T

F

T

T

T
假 ,假
  F       F

F

F

F

T

T

。真值表考慮了陳述句所有的真假可能狀況,如果兩個陳述句 ── 比方說 P → Q 和 ~P + Q ──,在每一種狀況裡都真假相同,那麼他們在邏輯上表示同樣的陳述,只不過穿著不同說法的外衣 。假使有一個陳述句在所有的真假可能狀況裡頭都是真的,這稱之為『恆真句』,舉例說 P + ~P。恆真句構成了論述合理有效推論的基礎。就讓我們說說有名的『三段論』吧︰

若 P 則 Q
因 P
故 Q

,把這個推理改寫成 ((P→Q)‧P)→Q ,那它將是個恆真句。雖然『 P 或非 P 』是個恆真句,但是彷彿像句空話什麼也沒有說,事實上它說︰凡是陳述非真即假,假使 P 是真的,那麼非 P 一定是假的。這就是大名鼎鼎的『矛盾律』!可是那要怎麼看『明天可能會下雨』或『明天可能不會下雨』呢?好似『想非想非非想』一般 ,邏輯學的路途依然遙遠!!

,這個『真值表』詮釋,也就是『數理邏輯』中『埃爾布朗解釋』Herbrand interpretation  ,紀念英年早逝的『雅克‧埃爾布朗』 Jacques Herbrand 對『機器證明』基礎之貢獻︰

In mathematical logic, a Herbrand interpretation is an interpretation in which all constants and function symbols are assigned very simple meanings. Specifically, every constant is interpreted as itself, and every function symbol is interpreted as the function that applies it. The interpretation also defines predicate symbols as denoting a subset of the relevant Herbrand base, effectively specifying which ground atoms are true in the interpretation. This allows the symbols in a set of clauses to be interpreted in a purely syntactic way, separated from any real instantiation.

The importance of Herbrand interpretations is that, if any interpretation satisfies a given set of clauses S then there is a Herbrand interpretation that satisfies them. Moreover, Herbrand’s theorem states that if S is unsatisfiable then there is a finite unsatisfiable set of ground instances from the Herbrand universe defined by S. Since this set is finite, its unsatisfiability can be verified in finite time. However there may be an infinite number of such sets to check.

It is named after Jacques Herbrand.

如此所謂『原子』 atom ,或說『邏輯原子』,意指『真假陳述』的『最小單元』,其內沒有其它的『邏輯結構』之『基本命題』。如是所謂『子句』 clause 就是有特定『邏輯結構』的『命題』︰

H_1 \ or \  H_2  \cdots \ or \ H_m \ <= \ T_1 \ and \  T_2   \cdots \ and \ T_n

。由於『邏輯運算符號』彼此間的『邏輯等價』性,使得我們可以選擇『機器證明』的合適『句式』,在盡可能不失去『一般性』的狀況下建構該程式語言。也可以說『特定性』是『實務』考量下的結果。因此我們可以明白『霍恩子句Horn clause  ︰

A Horn clause is a clause (a disjunction of literals) with at most one positive, i.e. unnegated, literal.

Conversely, a disjunction of literals with at most one negated literal is called a dual-Horn clause.

A Horn clause with exactly one positive literal is a definite clause; a definite clause with no negative literals is sometimes called a fact; and a Horn clause without a positive literal is sometimes called a goal clause (note that the empty clause consisting of no literals is a goal clause). These three kinds of Horn clauses are illustrated in the following propositional example:

Disjunction form Implication form Read intuitively as
Definite clause ¬p ∨ ¬q ∨ … ∨ ¬tu upq ∧ … ∧ t assume that,
if p and q and … and t all hold, then also u holds
Fact u u assume that
u holds
Goal clause ¬p ∨ ¬q ∨ … ∨ ¬t falsepq ∧ … ∧ t show that
p and q and … and t all hold [note 1]

In the non-propositional case, all variables in a clause are implicitly universally quantified with scope the entire clause. Thus, for example:

¬ human(X) ∨ mortal(X)

stands for:

∀X( ¬ human(X) ∨ mortal(X) )

which is logically equivalent to:

∀X ( human(X) → mortal(X) )

Horn clauses play a basic role in constructive logic and computational logic. They are important in automated theorem proving by first-order resolution, because the resolvent of two Horn clauses is itself a Horn clause, and the resolvent of a goal clause and a definite clause is a goal clause. These properties of Horn clauses can lead to greater efficiencies in proving a theorem (represented as the negation of a goal clause).

Propositional Horn clauses are also of interest in computational complexity, where the problem of finding truth value assignments to make a conjunction of propositional Horn clauses true is a P-complete problem (in fact solvable in linear time), sometimes called HORNSAT. (The unrestricted Boolean satisfiability problem is an NP-complete problem however.) Satisfiability of first-order Horn clauses is undecidable.

的 由來,它的『重要性』以及可能的『限制性』。進而理解『證明理論』 Proof Theory 所講的『 resolution 』邏輯推導歸結與『unification』 變元替換一致化。且清楚明白『歸謬證法』 proof by refutation 在『證明理論』中的主導地位。

─── 摘自《勇闖新世界︰ 《 pyDatalog 》 導引《三》

 

果真不能『自知』︰一個『感知器』不足以解決『XOR』問題??因為如果假設可以,依據 XOR 的 (x_1,x_2) 真值表定義

[(1,1) \longrightarrow 0]

w_1 \cdot 1 + w_2 \cdot 1 - b \leq 0

[(0,0) \longrightarrow 0]

-b \leq 0

[(1,0) \longrightarrow 1]

w_1 \cdot 1 - b > 0

[(0,1) \longrightarrow 1]

w_2 \cdot 1 - b > 0

所以 b \geq 0 ,  \ w_1 > b.  \ w_2 > b

但這與 w_1 + w_2   \leq b 卻矛盾!!

由是當知,切莫輕忽對待任何『基楚概念』。即使『感知器』

Perceptrons

What is a neural network? To get started, I’ll explain a type of artificial neuron called a perceptron. Perceptrons were developed in the 1950s and 1960s by the scientist Frank Rosenblatt, inspired by earlier work by Warren McCulloch and Walter Pitts. Today, it’s more common to use other models of artificial neurons – in this book, and in much modern work on neural networks, the main neuron model used is one called the sigmoid neuron. We’ll get to sigmoid neurons shortly. But to understand why sigmoid neurons are defined the way they are, it’s worth taking the time to first understand perceptrons.

So how do perceptrons work? A perceptron takes several binary inputs, x_1, x_2, \cdots, and produces a single binary output:

In the example shown the perceptron has three inputs, x_1, x_2, x_3. In general it could have more or fewer inputs. Rosenblatt proposed a simple rule to compute the output. He introduced weights,w_1,w_2,\cdots, real numbers expressing the importance of the respective inputs to the output. The neuron’s output, 0 or 1, is determined by whether the weighted sum \sum_j w_j x_j is less than or greater than some threshold value. Just like the weights, the threshold is a real number which is a parameter of the neuron. To put it in more precise algebraic terms:

output = \begin{cases}0 & \text{if } \sum_j w_j x_j \leq \ threshold\\1 & \text{if} \ \sum_j w_j x_j > \ threshold\end{cases}

That’s all there is to how a perceptron works!

……

 

之定義看似『簡單』,它的『數理』邏輯歸結未必可『一眼望盡』 ,囫圇吞棗者恐有『見樹不見林』之失耶!!