4. 计算机科学 (Kaggle项目拆解:泰坦尼克号预测)
? ?? ?今天計算機科學最高的研究水平,從人工智能,到并行計算,從計算機網絡,到處理器芯片,從數據庫,到云計算,都在公司,而不在大學里。
? ? ? 在學校學習的知識都會慢慢老化,如果我有一點點的黑客風格,就會保持開放的思維,愿意接受新東西,也樂意分享自己的知識、學習方法、思考模式、學習資源等,要對自己有信心,未來的自己一定會更強,一定可以挖到更多的 0 day、0 day。
? ? ? p.s.?在計算機安全領域中,零日漏洞或零時差漏洞(英語:Zero-day exploit)通常是指還沒有補丁的安全漏洞,而零日攻擊或零時差攻擊(英語:Zero-day attack)則是指利用這種漏洞進行的攻擊。
? ? ? p.s. 提供該漏洞細節或者利用程序的人通常是該漏洞的發現者。零日漏洞的利用程序對網絡安全具有巨大威脅,因此零日漏洞不但是黑客的最愛,掌握多少零日漏洞也成為評價黑客技術水平的一個重要參數。
? ? ? 挖漏洞也不是為了賺錢,是純粹的告訴別人:" ...?(我比你強~)",而后別人說:“反彈”......
? ? ? 您完全可以根據自己的喜好決定閱讀順序。
?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 《目錄》(粉色章節是翻譯補充,補充這么多也不知道好不好)
- 鍥子
 - Programming as Art and science? ? ? ? ? ? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? ?
 - 自動化計算? ? ? ? ? ? ??
 
人工智能入門指南
- 人工智能是什么 ?
 - 人工智能之路食用指南??
 - 人工智能的發展趨勢
 - 如何測量 A 與 B 的相關性 ?? ??
 - 機器與人在學習上的區別?
 - 機器學習界的 Hello, world.Kaggle項目拆解:泰坦尼克號預測
 - 因果革命?
 - 因果思維的層次?
 - 實現因果思維的方法?
 - Computing as Pervasive Information Processes
 - The Universe as a Computer
 
? ? ?因為計算機科學具體內容,在《1. What is computation thinking ?》已經寫明(點擊查看)。
? ? ?所以,體驗一下原文,第四章?盡量以英文原文復述,第五章 將是全英文。
- ? ? 第一章主要是聊?“計算機系”;
 - ? ? 第二章主要是講 “圖靈機”;
 - ? ? 第三章主要是看 “通用計算機”;
 - ? ? 第四章主要說聞 “人工智能的未來發展趨勢”
 
鍥子
? ? ? 20 世紀 50 年代,學術界開始倡導在大學里建立計算機科學課程,以滿足對學習新技術日益增長的需求。
? ? ? 從那時起,計算機科學部門對計算機思維的許多概念進行了提煉和完善。
? ? ? 現在我們來看看計算機思維是如何在大學里發展起來的。
? ? ? 在開始之前,我們想指出計算機思維發展的環境里的幾個關鍵方面。
? ? ??首先也是最重要的,計算機是一個融合工程、科學和數學的技術領域。
? ? ? 大多數計算機專業的學生來大學,是為了學習軟件和硬件技術的專業,而不是為了接受通識教育。
? ? ? 雇主也來大學招聘畢業生就業。
? ? ? 因此,隨著學術而發展起來的計算機思維,在設計方面一直具有很強的分量,并受到雇主所說的需求的強烈影響。
? ? ? ??
? ?? ?但這還不是全部。
? ?? ?大學以學科成一系部門,并分散在各個學科研究所和中心。
? ?? ?這些部門極力保護自己的身份、預算和空間。
? ?? ?因為他們的預算取決于入學的學生,所以他們一定會保護招生工作。
? ?? ?而且,由于招生,決定了聲譽和聲譽的研究生產力,各系也可以保護教授的研究領域。
? ? ??Another important shaping aspect of academia is the practice of seeking consensus on all decisions.
? ?? ?每個人都希望有發言權,不管是招聘新人、授予終身教職、決定提供哪些課程、批準其他部門提出的可能重疊的課程,還是批準組建新的項目或部門。
以下內容正是介紹計算機系的背景,譯者曾在第一章末節介紹過計算機受到的阻礙,這里給出英文原版吧。
? ? ? This is the atmosphere in which new computational thinking departments and academic computational thinking were formed.
??? ? The founders worried about curriculum and industry demand in the context of a set of consensus-seeking departments fiercely guarding their prerogatives, always concerned with public image and identities.
? ? ? ? ? ?
? ? ???The new departments proposed by the founders were split off from their existing departments.
? ? ? ?Their home departments often did not support the split because they would lose students, budget, and identity.
? ? ? ?The founders encountered a lot of resistance from other departments that did not deem a new department focused on computer technology to be legitimately science or engineering, or see it would provide a unique intellectual perspective.
? ? ? ?Foring a consensus favoring formation of a new department was a challenge. ? ?
? ? ? ?They built a good case and were successful.
? ? ? 計算機科學系的數量緩慢增長,僅在美國,從 1962 年的 1 個增加到 1980 年的 120 個。?
? ? ? 最終在 20 世紀 90 年代末,計算機科學開始興起,人們終于意識到計算機革命是真實的。
? ? ? 今天幾乎每一所大學都有一個計算機科學系。
? ? ? 科技、理工甚至商業學校都設有計算機科學系。
? ? ??Why so many homes?
? ? ? The answer echoes those early political fights: the new departments were established in the schools that were most welcoming.
? ? ? 由于大多數系都在理工科學校,到20世紀80年代,計算機科學家們把他們的研究領域稱為 “計算機科學與工程”。? ? ? ? ? ? ? ??
? ? ? That mouthful was simplified in the 1990s as "computing" became a popular shorthand for CS&E and its European counterpart "informatics".
? ? ??在 20 世紀 90 年代,一些大學進一步發展,建立了獨立的計算機學校,這一運動在今天繼續發展。
? ? ??真是個轉機!
? ? ??早期形成了倆個計算機學術學會:1946 年的 IEEE-CS(Institute of Electrical and Electronics Engineers Computer Society)和1947年的ACM(Association for Computing Machinery)。
? ? ? 由于他們努力制定和推廣課程建議,我們定期在 1968年、1978年、1989年、1991年、2001年 和 2003 年對計算機課程進行了一系列簡介。? ??
? ? ? ?These snapshots show how the concerted efforts of computing pioneers to articulate a unique identity for computer science led them to recognize computational thinking as a distinguishing aspect from the beginning.
? ? ? ?事后看來,我們可以看到四個時代,描述了大學對計算的看法,以及計算思維的觀點是如何變化的:
- Phenomena surrounding computers(1950s-1970s)
 - Programming as art and science(1970s)
 - Computing as automation(1980s)
 - Computing as pervasive information processes(1990s to present)
 
? ? ? ?我們將在下面的章節中討論這些時代。
? ? ? ?大學計算思維發展的這四個階段受到其他領域對計算機科學的最初抵制的強烈影響:計算機科學家花了大量的精力來澄清和證明他們的研究領域。
? ? ? ??But computer science was not always the receiver of resistance.
? ? ? ??There were two important instances when computer science was the giver.
? ? ? ? One was the computational science movement in the 1980s, which was eschewed by many computer scientists.
? ? ? ??A common reaction to an announcement by the physics or biology department that they were setting up a computational science branch would be a howl of protest that those departments were impinging on the territory of computing.
? ? ? ? 一些計算機科學家認為,物理學和生物學已經認識到計算機的重要性,正試圖劫持他們曾經強烈反對的領域。
? ? ? ??Eventually computer scientists got over this and now work collaboratively with computational sciences.
? ? ? ? 我們將在第 7 章中討論 computational sciences。
? ? ? ? 軟件工程也發生了類似的過程。
? ? ? ??The computing departments that viwed themselves as science were not receptive to the practices of teaching and doing projects common in engineering.
? ? ? ? ?ACM 和 IEEE 于 1950 年初 ,為年輕人創辦了期刊。
? ? ? ? ?The Moore School, home of the ENIAC project, was an early starter of computing education in 1946 with a two-month intensive course on "theory and techniques for design of electronic digital computer."
? ? ? ? ??In the 1950s the Moore School offered a multi-discipline degree in computing that included numerical analysis, programming, and programming language design.
? ? ? ? ? ?其他學校也開始了自己的課程。 ?
? ? ? ? ? ? These early efforts of establish computing as unacademic discipline were slow to gain traction.
? ? ? ? ? ? The impediment was more than a cautionary hesitancy to see if computers were here to stay; it was a deep doubt about whether computing and academic substance beyond mathematics, electrical engineering ,and physics.?
? ? ? ? ? ? Outsiders typically saw the computing field of the 1950s as an impenetrable and anarchistic thicket of idiosyncratic technology tricks.
? ? ? ? ? ? What is more, the different perspectives to thinking about computing were disunited:?those who designed computing machines were mostly unaware of important developments in the theory of computing such as Turing on computatble numbers, Church on lambda calculus, Post on string manipulation, Kleene on regular expressions, Rabin and Scott on nondeterministic machines, and Chomsky on the relation between grammars and classes of automata.
? ? ? ? ? ? Academics who proposed full-fledged computer science departments or programs in research universities met stiff resistance.
? ? ? ? ? ? Many critics did not believe in the value of computing's new ways: common objections included lack of unique intellectual content and lack of adequate theoretical basis.
? ? ? ? ? ? Purists argued that computers were human-made artifacts and not natural occurrences, and thus their study could not be counted among the noble natural sciences. ?
? ? ? ? ? ??On top of all that, many doubted whether computing would last.
? ? ? ? ? ? Until there was a consensus among many departments, no one could found a computer science department.
? ? ? ? ? ??This tide began to change in 1962, when Purdue established the first computer science department and Stanford followed soon thereafter.
? ? ? ? ? ? ?在接下來的 20 年里,部門的數量增長緩慢但穩定,僅在美國就超過了 100 個。
? ? ? ? ? ? ?盡管如此,許多學者仍然質疑計算機科學是一個合法的科學領域還是工程領域。 ?
? ? ? ? ? ? ?關于計算合法性問題的一個重大轉變發生在 1967 年,當時三位公認的計算機科學家艾倫·紐威爾、艾倫·珀利斯和赫伯特·西蒙發表了一封關于這個問題的信。
? ? ? ? ? ? ?They wrote:"Wherever three are phenomena, there can be a science to describe and explain those phenomena. Thus, ... botany is the study of plants, ... zoology is the study of animals, astronomy the study of stars, and so on. Phenomena bread sciences. ... There are computers. The phenomena surrounding computers are varied, complex, rich."?
? ? ? ? ? ? ??From this basis they quickly dismissed six objections, including the one that computers are human-made and are therefore not legitimate objects of a science.
? ? ? ? ? ? ??Herb Simon, a Nobel laureate in economics , so objected to the notion that there could be no science, surrounding human-made objects that he wrote a this idea. ? ? ?
? ? ? ? ? ? ??He gave an example from time-sharing systems(computers that allow many simultaneous users): The early development of time-sharing systems could not have been guided by theory as there was none, and most predictions about how time-sharing systems would behave were astonishingly inaccurate.?
? ? ? ? ? ? ??It was not possible to develop a theory of time-sharing systems without actually building those systems; after they were built, empirical research on their behavior led to a rich theoretical base about them.
? ? ? ? ? ? ??In other words, computational thinking could not approach problems from one direction only-the engineering aspects and scientific-mathematical aspects of computing evolved in a synergistic way to yield a science that was not purely a natural science.
? ? ? ? ? ? ??
? ? ? ? ? ? ??The notion of computing as the study of phenomena surrounding computers quickly gained traction, and by the end of the 1960s was taken as the definition of computing.
? ? ? ? ? ? ? ?A view of the field's uniqueness started to form around that notion.
? ? ? ? ? ? ? ?The term "algorithm thinking" was used to describe the most obvious aspect of new kind of thinking.
? ? ? ? ? ? ? ?The field's unique aims, typical problems, methods of solving those problems, and kinds of solutions were the basis of computational thinking.
? ? ? ? ? ? ? ?The computing pioneers expanded computational thinking beyond what they inherited from the long history of computation.
? ? ? ? ? ? ? ?They focused on the construction principles of programs, computing machines, and operating systems.
? ? ? ? ? ? ? ?他們提出了許多今天被認為是理所當然的計算概念,包括命名變量、控制結構、數據結構、數據類型、形式編程語言、子程序、編譯器、輸入輸出協議、指令管道、中斷系統、計算過程、內存層次結構、緩存、虛擬內存、外圍設備和接口。
? ? ? ? ? ? ? ?編程的方法和計算機系統架構是計算思維發展的主要驅動力。
? ? ? ? ? ? ? ?到 1970 年,大多數計算機科學家表示,計算機特有的思維和實踐方式——今天稱為計算思維——包含了與計算機有關的所有知識和技能。
? ? ? ? ? ? ? ?計算機思維早期分為硬件思維和軟件思維。
? ? ? ? ? ? ? ?The hardware flavor was followed by computer engineers in the engineering school; the software flavor by software designers and computing theorists in the science school.
? ? ? ? ? ? ? ?
Programming as Art and science? ? ? ? ? ? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? ?
? ? ? ? ? ?20 世紀 60 年代是計算機的成熟期,計算機科學家們對 ta 們的思考方式產生了相當豐富的內容。
? ? ? ? ? ?The subfield of operating systems was born in the early 1960s to bring cheap, interactive computing to large user communities---computational thinking acquired a systems attitude.
? ? ? ? ? ?The subfield of software engineering was born in the late 1960s from a concern that existing models of programming were incapable of developing reliable and dependable production software---computer thinking acquired an engineering attitude.
? ? ? ? ? ?The subfield of networking was born in 1967 when the ARPANET project was started --- computational thinking acquired a networking attitude.
? ? ? ? ? ?With a solid, reliable technology base in place, the field's attention shifted to programs and programming.
? ? ? ? ? ?隨著標準編程方法的出現,許多編程語言應運而生。
? ? ? ? ? ?A huge interest informal verification of programs welled up, seeking a theory-based way to demonstrate that programs were reliable and correct.
? ? ? ? ? ?A similar interest in computational complexity also welled up, seeking analytical ways to assess just how much computational work the different algorithms required.
? ? ? ? ? ?Computer programs are expressions of algorithms in a formal language that, when compiled to machine-executable form, control the actions of a machine.? ?
? ? ? ? ? ?程序是幾乎所有計算的核心:大多數計算機專業人員和研究人員都以某種方式或其他方式使用程序。
? ? ? ? ? ?在 20 世紀 40 年代的第一臺存儲程序計算機上,編程是用匯編語言完成的,匯編語言把指令集逐行轉換成計算機可以運行的機器代碼。 ? ??? ? ? ? ? ??
? ? ? ? ? ?例如,指令 “ ADD?R1,R2,R3 ” 是將寄存器 R1 和 R2 的和放入寄存器 R3。
? ? ? ? ? ?該指令通過用二進制代碼替換 ?ADD?R1,R2,R3 轉換為機器代碼。 ?
? ? ? ? ? ?用匯編語言編寫程序非常繁瑣而且容易出錯。? ? ? ? ? ? ?
? ? ? ? ??編程語言的發明是為了提供程序員想要的更高層次的精確表達式,而后編譯器可以明確地將這些表達式翻譯成機器代碼。
? ? ? ? ??這大大簡化了編程工作,使其更具生產力,更不容易出錯。
? ? ? ? ??The first widely adopted programming languages introduced a plethora of new computational thinking concepts that had few or no counterparts in other intellectual traditions.
? ? ? ? ??大多數編程語言旨在幫助自動化重要工作,如分析科學數據和評估數學模型(1957年的Fortran)、進行邏輯推理(1958年的Lisp)、跟蹤業務庫存和維護客戶數據庫(1959年的COBOL)。
? ? ? ? ??一些語言的目的是讓人們交流精確的算法規范(可讀性好),這些規范可以被納入其他語言中。
? ? ? ? ??Algol 語言(1958)就是從這個角度發展起來的。
? ? ? ? ??語言迎合特定思考問題方式的想法被稱為 “編程范式”。
? ? ? ? ??例如,命令式編程將程序視為一系列模塊(稱為“程序”),其指令命令機器。
? ? ? ? ??FORTRAN, COBOL, 和?ALGOL 都適合這一類別。
? ? ? ? ??面向對象編程將程序視為相對獨立的單元(“對象”)的集合,這些單元相互交互,并通過交換消息與外部世界交互。
? ? ? ? ??后來的語言,如 SimalTalk 和 Java 就屬于這一類。
? ? ? ? ??函數式編程把程序看作從輸入數據生成輸出數據的數學函數集。LISP就是一個例子。
? ? ? ? ??這些編程范例在 20 世紀 70 年代被視為不同風格的算法思維。
? ? ? ? ??他們都希望程序是清晰的表達式,以便人類在編譯和執行時正確、有效地閱讀和執行。
? ? ? ? ? Donald Knuth, in his major works The Art of computer Programming and Literate Programming, and Edsger Dijkstra in his work on structured programming, epitomized the idea that computing is about algorithms in this sense.
? ? ? ? ? 到 1980 年,大多數計算機科學家都說計算機思維是一套與算法和軟件開發有關的技能和知識。?
? ? ? ? ?But things got tricky when the proponents of algorithmic thinking had to describe what algorithmic thinking was and how it differed from other kinds of thinking.
? ? ? ? ?Knuth 比較了數學教科書和計算機教科書中的推理模式,確定了倆者的典型模式。
? ? ? ? ?He concluded that algorithmic thinking differed from mathematical thinking in several aspects: by the ways in which it reduces complex problems to interconnected simple ones, emphasizes in formation structures, pays attention to how ?actions alter the states of data, and formulates symbolic representations of reality.
? ? ? ? ?In his own studies, Dijkstra differentiated computer scientists from mathematicians by their capacity for expressing algorithms in natural as well as formal language, for devising notations that simplified the computations, for mastering complexity, for shifting between abstraction levels, and for inventing concepts, objects, notations, and theories when necessary.
? ? ? ??Today's descriptions of the mental tools of computational thinking are typically much less mathematical in their orientation than were many early descriptions of algorithmic thinking.
? ? ? ??Over time, many have argued that programming and algorithmic thinking are as important as reading, writing, and arithmetic---the traditional three Rs of education---but the proposal to add them(as a new combined "R") to that list has yet to be accepted.
? ? ? ??Computing's leaders have a long history of disagreement on this point.
? ? ? ??Some computing pioneers considered computing's ways of thinking to be a generic tool for everyone, on a par with mathematics and language.
? ? ? ??Others considered algorithmic thinking to be a rather rare, innate ability---present with about one person in fifty.
? ? ? ??The former view has more support among educators because it embraces the idea that everyone can learn computational thinking: computational thinking is a skill to be learned and not an ability that one is born with.
? ? ? ??The ?programming and algorithms view of computing spawned new additions to the computational thinking toolbox.
? ? ? ??The engineering-technology side provided compilers(for converting human-readable programs to executable machine codes), parsing methods (for breaking programming language statements into components), code optimization, operating systems, and empirical testing and debugging methods(for finding errors in programs).
? ? ? ??The math science side provided a host of methods for algorithms analysis such as O-notation for estimating the efficiency of algorithms, different models of computation, and proofs of program correctness.
? ? ? ? ?By the late 1970s, it was clear that computing moved on an intellectual trajectory with concepts, concerns, and skills very different from other academic disciplines.
自動化計算? ? ? ? ? ? ??
? ? ? ??Despite all its richness, the view of computing as the study and design of algorithms was seen as too narrow.
? ? ? ??By the late 1970s, there were many other questions under investigation.
? ? ? ??How do you design a new programming language ?
? ? ? ??How do you increase programmer productivity ?
? ? ? ??How do you design a secure operating system ?
? ? ? ??How do you design fault-tolerant software systems and machines ?
? ? ? ??How do you transmit data reliably over a packet network ?
? ? ? ??How do you protect systems against data theft by intruders or malware ?
? ? ? ??How do you find the bottlenecks of a computer system or network ?
? ? ? ??How do you find the response time of a system ?
? ? ? ??How do you get a system to do work previously done by human operators ?
? ? ? ? The study of algorithms focused on individual algorithms but rarely on their interactions with humans or the effects of their computations on other users of systems and networks.
? ? ? ? ?It could hardly provide complete answers to these questions.
??
? ? ? ? ?The idea emerged that the common factor in all these questions, and the soul of computational thinking, was that computing enabled automation in many fields.
? ? ? ? ?Automation generally meant one of two things: the control of processes by mechanical means with minimal human intervention, or the carrying out of a process by a machine.
? ? ? ? ?Many wanted to return to the 1960s notion that automation was the ultimate purpose of computers and among the most intriguing questions of the modern age.
? ? ? ? ?自動化似乎是所有計算機科學中的共同因素,而計算機思維似乎是為了提高自動化的效率。
? ? ? ? ?In 1978 the US National Science Foundation launched a comprehensive project to map what is essential in computing.
? ? ? ? ?It was called the "Computer Science and Engineering Research Study"(COSERS).
? ? ? ? ?In 1980 they released What Can Be Automated ?, a thousand-page tome that examined numerous aspects of computing and its applications from the standpoint of efficient automation.
? ? ? ? ?That study answered many of the questions above, and for many years, the COSERS report offered the most complete picture of computing and the era's computational thinking.
? ? ? ? ?It is still a very relevant resource for anyone who wants an overview, written by famous computing pioneers, of many central themes, problems, and questions in computing.
??
? ? ? ? ??Well into the 1990s, the computing-as-automation idea was adopted in books, research reports, and influential policy documents as the "fundamental question underlying computing."
? ? ? ? ??This idea reonated well with the history of computational thinking:As we discussed in the previous chapters, automatic computing realized the dream of applied and correctly without relying on human intuition and judgment.
? ? ? ? ??Theoreticians such Alan Turing were fascinated by the idea of mechanizing computing.
? ? ? ? ??Practitioners saw their programs as automations of tasks.
? ? ? ? ??By 1990,"What can be automated?"
? ? ? ? ??became a popular slogan in explanations of computing to outsiders and a carrying theme of computational thinking.
? ? ? ? ??Ironically, the question of "what can be automated" led to the undoing of the automation interpretation because the boundary between what can and cannot be automated is ambiguous.
? ? ? ? ??由于新的算法或更快的硬件,以前不可能實現自動化的事情現在可能成為可能。
? ? ? ? ??到 20 世紀 70 年代,計算機科學家已經發展出一套豐富的計算復雜性理論。
? ? ? ? ??By the 1970s, computer scientists had developed a rich theory of computational complexity, which classified problems according to how many computational steps algorithms solving them needed.
? ? ? ? ??For example, searching an unordered list of N items for a specific item takes time proportional to N steps.
? ? ? ? ? 將 n 個元素排序更為復雜:某些排序算法需要??步,而最佳算法只需要 ?步。? ?
譯者補充:對算法分析感興趣,請見博客《漸進記號》。
? ? ? ? ? Printing a list of all subsets of N items takes time proportional to .
? ? ? ? ? The search problem is of "linear diffculty", the sorting problem is of "quadratic diffculty," and the printing problem is of "exponential difficulty."
? ? ? ? ? Search is fast, enumeration is slow; computational complexity theorists call the former "easy" ?and the latter "hard."
? ? ? ? ? To see how vast the difference is between easy and hard problems, imagine that we have a computer that can do 1 billion() instructions or per second.
? ? ? ? ? To search a list of 100 items would take 100 instructions 0.1 microseconds.
? ? ? ? ??To enumerate and print all the subsets of 100?items would take ?instructions, a process that would take around ?years.
? ? ? ? ??That is 10,000 times longer than the age of the universe, which is very roughly around ?years old.
? ? ? ? ??Even though we can write an algorithm to do that, there is no computer that could complete the job in a reasonable amount of time.
? ? ? ? ? Translating this to automation, an algorithm to automate something might take an impossibly long time.
? ? ? ? ??Not everything for which we have an algorithms is automatable in practice.
? ? ? ? ??Over time, new generations of more powerful machines enable the automation of previously intractable tasks.
? ? ? ? ??Heuristic algorithms make the question of computational hardness asks us to pack a subset of items into a weight-limited knapsack to maximize the value of items packed.
? ? ? ? ??The algorithm for doing this is similar to the enumeration problem and would take an impossibly long time for most knapsacks.
? ? ? ? ??But we have a rule-of-thumb(a "heuristic") that says "rate each item with its value-until the knapsack is full."
? ? ? ? ??This rule of thumb packs very good knapsacks fast, but not necessarily the best.
? ? ? ? ??Many hard problems are like this.
? ? ? ? ??There are fast heuristic algorithms that do a good job but not necessarily the best.
? ? ? ? ??We can automate them only if we find a good heuristic algorithm.
? ? ? ? ?The early findings about what things cannot be done in computing, either because they are impossible or just too long, led to pessimism about whether computing could help with most practical problems.
? ? ? ? ??Today the mood is much more optimistic.
? ? ? ? ???A skilled computational thinker uses a sophisticated understanding of computational complexity, logic, and optimization methods to design good heuristic algorithms.
? ? ? ? ? ?Although all parts of computing contribute to automation, the field of artificial intelligence(AI) has emerged as a focal point in computing for automating human cognitive tasks and other human work.
因為計算機科學的重要內容我已經總結在第一篇,因此盡量給原文,以下為譯者補充。
人工智能入門指南
人工智能是什么 ?
? ? ? ?現在的人工智能本質上是機器學習,機器學習就是用一組數據建立一個統計模型。
? ? ? ?這個統計模型能對新的數據作出預言,輸入的數據越多越精確,模型能做的預言就越準確。
? ? ? ?數學家就叫 統計模型,而計算機科學家鬼使神差的改叫 機器學習,記者有時候叫 大數據,現在的科技大佬在大會上就更會聊了,叫啥呢,不就是?人工智能......
? ? ? ?上一章介紹了神經網絡,如果用大量的數據去訓練這個網絡,讓網絡學會自己做判斷。
? ? ? ?網絡內部有大量參數隨著訓練不斷變化,就相當于人腦在學習中提高技藝。
? ? ? ?這樣的訓練主要依靠數據和所謂的智能算法,即數學模型。
? ? ? ?機器學習其實是再現昨天的世界,只不過昨天的世界和今天的世界之間是連續變化的。
? ? ? ?如,人臉識別軟件,使用您過去的照片進行訓練,識別今天的您,之所以能識別得準,是因為昨天的您,去年的您,甚至 10 年前的您,和今天的您之間是漸變的、連續變化的,而不是跳變的。
? ? ? ?而機器學習,實際上是尋找一種數學模型,讓這種模型符合 ta 所要描述的對象。
? ? ? ?其實您每次做數學的應用題,都是在使用一個模型。
? ? ? ?您知道題目包含什么假設,有什么因果關系,就能用方程推導出一個結果,方程描寫的是模型中事物的聯系。
? ? ? ?模型的特點:
? ? ? ?比如說我們要尋找一種描述天體運動的模型,讓ta符合太陽系行星的運動情況,今天這個模型就是開普勒-牛頓的橢圓形模型:太陽系中所有的行星和彗星圍繞著太陽系的重心(和太陽的位置很接近但是有所差別),做橢圓運動。
? ? ? ?當然,這個模型內不同物體的運動速度和周期不同,這些數據被稱為模型的參數。
? ? ? ?有了這樣一個模型,就可以知道今后太陽系中行星和彗星的運行規律了,哈雷就用 ta 成功地預測了哈雷彗星未來回到人們視野的時間。
? ? ? ?在這個模型中,要得到模型的參數(比如每一個星體運動的長軸半徑,運動一圈的周期),就要根據觀察到的歷史數據計算。
? ?
? ? ? ?我們在機器學習中有時用 “契合” 來形容模型描述的情況和真實情況的接近程度,契合度越高,誤差越小,當然也就越好。
? ? ? ?數學上有一個 “切比雪夫大數定律”,保證了只要數據量足夠大,這種契合度就能接近100%。
? ? ? ?機器學習分兩種。
- ? ? ? ?第一種是有模型和參數的學習,也就是顯性的模型。在歷史上,地心說模型、日心說模型、開普勒-牛頓的橢圓形模型,都是這一類。當然,模型和真實情況并不一定一致,只是在誤差范圍內簡潔地概括了真實情況;而在過去,人需要想出模型,再通過實驗找參數。 ? ? ?
 - ? ? ? ?第二種是沒有限定模型,只有數據,有數據驅動,看看能產生什么樣的模型。比如基于人工神經網絡的深度學習就是如此,當然,里面一些拓撲結構,一些轉換函數的設定,還是有規范的。由于沒有情緒的模型,因此今天很多人覺得深度學習是個黑箱,ta只是對目標進行了最優化,至于為什么有效,誰也說不清。
 
? ? ??
? ? ? ?機器學習根據使用的數據不同,區分成了不同的類型。
- 無監督學習:輸入的數據是雜亂無章的,機器想從這些數據中學習并得到規律;輸出的模型就可能不準確。
 - 有監督學習:輸入的數據都是經過標識的,有了一個大致的方向;但因為人工標識數據不僅成本高,而且很難得到足夠量的數據,這種機器學習方法提高到一定程度,就再也提高不了了。
 - 半監督學習:介于前倆者之間。
 - 強化學習:計算機在沒有人為給定方向的條件下,自己試著走一個方向,而后由人設定的一些原則告訴 ta 好不好,也就是說需要有一個判斷價值的反饋信號送還給機器學習系統。
 
? ? ? ? 任何一個機器學習的過程,其實都是不斷地調整數學模型參數的過程,直到參數收斂到最佳點。
? ? ? ? 從事過機器學習工作的人都知道這樣一個訣竅,為了加快機器學習的收斂速度,最好先用標注過的高質量數據尋找收斂的方向,這比完全沒有數據輸入,全靠計算機自適應學習快得多。
? ? ? ? 那些標注過的,正確無誤的數據, 其實就是人總結出來的,或者見到的成功經驗。
? ? ? ? 沒有這些成功經驗,計算機通過自適應學習,也能收斂到正確的模型,但是時間要長很多。
? ? ? ? 如果您給計算機輸入的數據是錯誤的,相當于失敗的經驗,計算機即使最終能回歸到正確的模型上,也要走非常非常長的彎路。
? ? ? ? 想深入的話,可以看下面的參考資料:
- ? ? ? 機器學習的學習類型:HAWQ數據倉庫與數據挖掘實戰電子書,王雪迎-文檔類-CSDN下載
 - ? ? ? 機器學習的常用算法:3.機器學習常用算法.pdf-機器學習文檔類資源-CSDN下載
 
人工智能之路食用指南? ?
??
? ? ? 有了計算機的基礎,學習過編程和計算機算法之后,學習人工智能其實并不難(主修)。
? ? ? 首先需要有足夠的概率論和數理統計基礎,這在大學就是一門課,學了這門課,基本的人工智能和機器學習的數學基礎就有了。
? ? ? 而后學習這本書《人工智能:一種現代方法》(Artificial Intelligence: A Modern Approach),這是目前最好的、寫得最清楚的教科書。
? ? ? 作者一位是羅素教授,擔任過伯克利計算機系主任,是人工智能專家。
? ? ? 另一位是諾威格博士,是 Google 的大牛,過去主管 Google 整個的研究部門,是一位有豐富工程經驗的學者。
? ? ? 他們一直在不斷地更新這本教科書,美國80%~90%的大學人工智能課都使用這本書。
? ? ? 此外,對于人工智能的不同應用,需要學習一些專業知識;如做人臉識別,就需要學習圖像處理;做機器翻譯,就需要學習自然語言處理。
? ? ? 如果只是輔修的話,可以看一看這個:《程序員的金豆豆能不能搞事情》。
? ? ? 如果對 “自學” 這個動作感興趣,請見博客:《C語言自學指南》。
? ? ? ? ? ? The computational Thinking toolbox accumulated heuristic methods for searching solution spaces of games, for deducing conclusions from given information, and for machine-learning methods that find problem solutions by generalizing from examples.
? 機器學習中包及相應函數認識:R語言基本統計分析方法(包及函數)_a嘟嘟a的博客-CSDN博客_r語言統計包
人工智能的發展趨勢
? ? ?越來越多的人理解了人工智能的能力邊界,但計算機和數據科學家,仍然需要以負責的道德標準,去推動人工智能發展。
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?—— 科技媒體網站VentureBeat
? ? ?科技媒體網站 VentureBeat 最近采訪了四位科技界大咖,預測了2019年人工智能的發展趨勢。
? ? ?這四位大咖,都是人工智能領域非常有份量的大人物,包括斯坦福大學的計算機科學系的副教授、全球人工智能和機器學習領域最權威的學者之一吳恩達、紐約大學計算機科學家楊立昆、埃森哲應用智能部的總經理魯曼·喬德赫里,還有數據科學和機器學習咨詢機構 Fast Forward Labs 的創始人兼 CEO 希拉里·梅森。
? ? ?吳恩達發現,其實只要找對了方法,哪怕只用小規模的數據,也能獲得有價值的結果。
? ? ?如,訓練一個圖像識別系統,不需要再拿上億張圖片來做訓練素材,只用 1000 張圖片也能達到預期的效果,這就大大節約了時間和成本,也降低了人工智能行業的準入門檻。
? ? ?所以,“少樣本學習”,將會成為2019年人工智能學習方向的一個重要趨勢。
? ? ?以及,“自監督學習” 和“?因果學習”,這兩個趨勢,一個說的是讓人工智能自己來掌握事物的運作規律,另一個說的是讓人工智能學會建立因果關系。
? ? ?自監督學習和建立因果關系,這兩種能力組合到一起,就能讓人工智能像人類一樣,學會關于這個世界的常識了。
? ? ?而要讓人工智能學會建立因果關系,就不僅是通過觀察來學習了,還要能進行推理,比如說,看到有人打傘,就能推測出,外面可能在下雨。
? ? ?在 2019 年,人工智能將朝著這樣一個方向發展:
- ? 用少量樣本就能掌握更強大的技能,甚至還可能擁有像人類一樣的常識;不過,在人工智能發展的道路上,我們還會面臨更復雜的倫理挑戰,如何對人工智能倫理進行監管,將會是一個長期難題。
 
? ?
? ? ?讀后感:
? ? ?因果關系下面有細寫,是人工智能界最重要的趨勢;至于?“少樣本學習”,我則不太認同。
? ? ?我認為這個時代,最不缺的就是數據了,明明更多的數據搞出來的效果會更好,為什么不呢 ?
? ? ?就這 3 年世界產生的數據比 3 年前到人類誕生都要多得多,以后隨著 loT 的普及,數據會再次成數量級增加......??
如何測量 A 與 B 的相關性 ?? ?
??
? ? ? 我來為上面這篇新聞,添加一些背景信息。
? ? ? 現在的人工智能,大數據分析是基礎,而且基本上都是關注相關性,而非因果關系。
? ? ? 原因在于獲取因果關系往往花費太大、難度太高,而且相關性也能解決許多問題。? ??
- ? ? ? 相關性: A 發生后,B 發生的可能性就增加,這就是相關性。
 - ? ? ? 因果關系:從 A 一定能推導出 B,那么知道了 A 就等同于知道了 B。
 
? ? ? 如果相關性比較強,我們在得到信息 A 之后,就可以消除關于 B 的不確定性。
? ? ? 但是,如果 A 和 B 之間的相關性較弱,那種聯系就沒有意義。
? ? ??在過去,我們常常是先感覺兩種信息相關,然后通過數據來驗證,這是傳統的數據方法。
? ? ? 大數據的方法不同,它不先進行預先的假設,由于數據量大,總是可以總結出一些相關性,而后再分析什么靠譜,什么不靠譜,并非所有看似相關的事情都靠譜。
? ? ? 一些事情,大數據是分析不出來的,比如:
- ? ? ? ?影片 A 比影片 B 在上映時賣掉的冰淇淋多,一些大數據專家就在統計:是否看影片 A 的情侶多,一起吃冰淇淋,是否看影片A的年輕人多,喜歡吃冰淇淋,等等。
 - ? ? ? ?最后來了一個賣冰棍的老太太說,嗨,影片 A 是夏天放映的,影片 B 是冬天放映了。如果我們一定要統計,可能真能發現看影片 A 和 B 情侶比例的細微差異,但是如果我們就得出情侶看電影一定會吃冰淇淋的結論,就有點荒唐了。
 
? ? ? 那么,如何度量 A 和 B 的相關性是強還是弱 ?
? ? ? 信息論里有一個互信息公式度量,使用方法請見博客:《信息收集》之女人的裙擺 OR 股市的漲幅。
機器與人在學習上的區別?
? ? ??人工智能現在很大的一個瓶頸在于 ta 不能理解因果關系。
? ? ? 人工智能的深度學習,靠的是用神經網絡逐步建立一種 “識別模式”。
? ? ? 比如說,您想讓人工智能識別狗,您要先建立一些算法的“神經元”,而后把這些神經元用疊層的方式連在一起,就好像三明治那樣一層層的,這就是所謂的 “深度”。
? ? ? 當您拿出貓的照片交給人工智能,它的神經網絡就開始工作,第一層的神經元首先會進行判斷,信號傳到第二層,再進行判斷,以此類推。最后,整個神經網絡會做出一個最終決定,判斷照片中的是不是狗。
? ? ? 無論判斷對錯,這時候,您都要給人工智能反饋。如果判斷錯了,它就弱化那些導致錯誤結果的神經元連接,如果判斷對了,它就強化這些連接。只要次數足夠多,人工智能就會形成一個有效的識別狗的模式,達到很高的正確率。
? ? ? 但是,人類大腦并不是這么工作的,人類的認知并不是建立在“層層識別”的基礎上,而是看穿現象背后的邏輯和因果關系,再歸納出抽象的知識,然后用這些知識來應對新情況。
? ? ? 概括地來說,這就是一種推理能力。這種能力最大的好處,就是讓人不用依賴大量的數據就能學習。
? ? ? 舉個例子,想讓小孩子認識什么叫 “車”,就不需要讓他們看上萬張車的圖片才能認出來,他們會總結——帶輪子的、能在地上跑的就是車。
? ? ? ?哪怕下次碰到的是之前從來沒見過的拖拉機,小孩子也能知道這算是一種車。
? ? ? ?但人工智能就做不到,它能準確識別一萬次車,但它依然不理解車是什么。每次要辨認新種類的車,它都必須從頭開始學習,每一次學習都要靠海量的數據來訓練。
? ? ? ?聽到這您應該就明白了,人工智能和人在“學習”這件事上是有區別的。人類就是靠推理能力,快速學習,這種推理能力還能幫人類應對不斷出現的新情況。
?Kaggle項目拆解:泰坦尼克號預測
? ? ? ? 既然已經把機器學習的理論差不多說完了,我們一起來做一個人工智能的程序。
? ? ? ? 背景:電影《泰坦尼克號》。
? ? ? ? 題目:預測泰坦尼克號的某位乘客是存活還是遇難了。
? ? ? ? 這是來自 Kaggle 的競賽題,如果您可以完整寫出這個程序,機器學習也算入段了。
? ? ? ? 競賽準備:Python 編程語言、Python 編譯器、泰坦尼克號的數據。
(1) 準備數據
? ? ? ? ?Kaggle 把?泰坦尼克號 的數據分為了倆份:
- ? ?train.csv :用于訓練統計模型。
 - ? ?test.csv? :用于檢測統計模型。
 
? ? ? ? ?您可以直接在?官網?下載(推薦),也可以 Q博客 ~
? ? ? ? ?打開文件?train.csv:
train.csv? ?一共 12 類數據。
- ??PassengerId:乘客ID
 - ??Survived? ? ? :是否幸存
 - ? Pclass? ? ? ? ? :艙位級別(頭等艙、二等艙、三等艙)
 - ??Name? ? ? ? ? ? :姓名
 - ??Sex? ? ? ? ? ? ? ?:性別
 - ??Age? ? ? ? ? ? ? ?:年齡
 - ??SibSp? ? ? ? ? ? :在泰坦尼克號上是否有兄弟姐妹或配偶
 - ??Parch? ? ? ? ? ? :在泰坦尼克號上是否有父母或子女
 - ? Ticket? ? ? ? ??? :船票號碼
 - ??Fare? ? ? ? ? ? ? ?:船票價格
 - ??Cabin? ? ? ? ? ? ?:房間編號
 - ??Embarked? ? ? :在英國哪個港口上的船
 
? ? 這 12 類數據在 Python 中叫 "列表",在 C 語言中叫 "數組"。
? ? 數據都是 列表/數組,其中包含了我們想要預測的某個人的各種信息,依據這些收集到的信息可以判斷這人是否幸存。
? ? 使用 Python 輸出?train.csv 里的數據:
import csv# 打印數據 with open("train.csv","r") as csv_file:reader=csv.reader(csv_file)for line in reader:print(line)?(2) 挑選數據
? ? ? 題目:預測泰坦尼克號的某位乘客是存活還是遇難了。?
? ? ? 使用 Python 接收 train.csv 里的數據:
import pandas as pd# 接收數據 train = pd.read_csv('train.csv',)? ? ?
? ? ?我們現在就來統計一下泰坦尼克號上幸存者和遇難者的數量吧,只需要?Survived?這個變量即可。?? ? ?
import pandas as pd# 接收數據 train = pd.read_csv('train.csv',)# 第一次建立模型 print( train['Survived'].value_counts() )# 使用函數: # value_counts()是一種查看表格某列中有多少個不同值的快捷方法,并計算每個不同值有在該列中有多少重復值。? ? 輸出結果:
1: 幸存,0:遇難? ?
? ? 總人數 = 遇難數 + 幸存數?
? ? ? ? ? ? ? ? = 549 + 342?
? ? ? ? ? ? ? ? = 819
? ?第一次,預測某個人幸存的概率就是拿?,
? ?幸存數 ? 總人數
? ??= 342 ? 819
? ? = 41.76%
? ? 但我們還有許多數據呀,不要只從一個方面看,要把數據聯系起來形成一個網絡,這樣預測的準確率才會提高。
? ? 如果您看過電影,就真的在船快沉時,救生艇都是讓給了 女士和小孩,所以性別會對預測幸存的概率產生影響。
? ? 使用 Python 做個統計:
import pandas as pd# 接收數據 train = pd.read_csv('train.csv',)# 第一次的統計模型,統計幸存者數量 print( train['Survived'].value_counts() )# 使用函數: # value_counts()是一種查看表格某列中有多少個不同值的快捷方法,并計算每個不同值有在該列中有多少重復值。# 第二次的統計模型,統計 幸存的男性人數、男性的總人數 print( train['Survived'][train['Sex'] == 'male'].value_counts() )? ? 輸出結果:
? ?
? ? 幸存的男性人數 = 109、男性的總人數 = 577(109 + 468)。
? ? 男性的存活率 =?幸存的男性人數 ??男性的總人數
? ? ? ? ? ? ? ? ? ? ? ? ? ?= 109 ? 577
? ? ? ? ? ? ? ? ? ? ? ? ? ?= 18.89%
? ? ?再使用同樣的語句,統計女性:
mport pandas as pd# 接收數據 train = pd.read_csv('train.csv',)# 第一次的統計模型,統計幸存者數量 print( train['Survived'].value_counts() )# 使用函數: # value_counts()是一種查看表格某列中有多少個不同值的快捷方法,并計算每個不同值有在該列中有多少重復值。# 第二次的統計模型 # 統計 幸存的男性人數、男性的總人數 print( train['Survived'][train['Sex'] == 'male'].value_counts() )# 統計 幸存的女性人數、女性的總人數 print( train['Survived'][train['Sex'] == 'female'].value_counts() )? ? 輸出結果:
? ? ?
? ? ?計算同理,233 ? 314(233+81) = 74%。
? ? ?第二次,預測某個人幸存的概率是:
- 男:18%
 - 女:74%
 
? ? ? 通過加入性別這個數據,預測的準確性就增長了。
? ? ? 我們再引入一些別的數據,說不定還可以繼續增長呢!!
? ? ? 不過,一個一個的分析實在太麻煩了。
?(3) 引入算法
? ? ? ?我們使用一個機器學習的算法,我選的 決策樹。
? ? ? ?之前,學 爬蟲?的時候接觸過這個算法,但沒研究,對了我把爬蟲的經驗都寫在了博客:《爬蟲專題》。
? ? ? ?調用方法:
from sklearn import tree, preprocessing? ? ? ?
? ? ? ?為了更精確的預測,我們想一想,哪些數據和預測有相關性呢 ?
? ? ? ?找出來,再把這些數據通通交給 決策樹,讓算法自動建立一個模型。
? ? ? ?
? ? ? ?我想了想,挑了 4 個:
- Sex 性別? ? ? ? ? ? ?:女士優先
 - Age 年齡? ? ? ? ? ? ?:小孩優先
 - Fare? ? ? ? ? ? ? ? ? ? :船票價格,越貴的安全性應該更好
 - Pclass? 艙位級別:人越少,站在救生艇上的概率就越大
 
?(4) 訓練模型
? ? ?現在有個問題是算法要求每個數據都得有數值,可是 “Age” 這一項只有 714 個人的數據。
? ? ?為此我們還得把剩下 100 多個人的年齡數據給補上,就用所有乘客年齡的中位數來代替。
? ? ?這種事情在實際操作中非常常見。
? ? ?
import pandas as pd from sklearn import tree, preprocessing# 接收數據 train = pd.read_csv('train.csv',)target = train['Survived'].values# 預處理 encoded_sex = preprocessing.LabelEncoder()# 轉換成數值,因為 Sex 是字符串要轉為數值才好操作 train.Sex = encoded_sex.fit_transform(train.Sex) features_one = train[['Pclass', 'Sex', 'Age', 'Fare']].values# 擬合一個決策樹: my_tree_one my_tree_one = tree.DecisionTreeClassifier() my_tree_one = my_tree_one.fit(features_one, target)? ?preprocessing.LabelEncoder() 函數的使用說明,https://www.cnblogs.com/caimuqing/p/9074046.html
? ?運行后,就有一個錯誤。
- ValueError: Input contains NaN, infinity or a value too large for dtype('float32').
 
? ?因為上面的是機器學習的核心代碼,數據處理如下。
import pandas as pd from sklearn import tree, preprocessing# 接收數據 train = pd.read_csv('train.csv')# 預處理 encoded_sex = preprocessing.LabelEncoder()# 轉換成數值,因為 Sex 是字符串要轉為數值才好操作 train.Sex = encoded_sex.fit_transform(train.Sex) features_one = train[['Pclass', 'Sex', 'Age', 'Fare']].values.tolist()target = train['Survived'].values# 補充缺失值 for x in range(len(features_one)):if str(features_one[x][2]) != 'nan':continueelse:features_one[x][2] = 33# 為了方便把平均數改為 33。# 擬合一個決策樹: my_tree_one my_tree_one = tree.DecisionTreeClassifier() my_tree_one = my_tree_one.fit(features_one, target)? ?基本上就是您告訴程序要預測的目標是乘客是否存活,影響目標的四個因素是艙位、性別、年齡和船票價格,您選取的機器學習模型是“決策樹”。
? ?最后生成的這個“my_tree_one”,就是預測模型。
?(5) 檢測模型
? ? 查看各數據(屬性)在決策樹中的占比:
print( my_tree_one.feature_importance_ )- 艙位:12%
 - 性別:31%
 - 年齡:24%? ??
 - 價格:32%
 
? ? 船票花費占比最大,這和程序參數的順序有關。
? ? 這只是一個綜合的統計性質,模型內部非常復雜,并不是對這幾個數據做什么加權平均。
? ??利用現有的訓練數據,檢測模型的預測準確度:
print( my_tree_one.score(features_one, target) )? ? 預測得到 97% 的準確率!!!?
? ? 完整代碼:
import pandas as pd from sklearn import tree, preprocessing# 接收數據 train = pd.read_csv('train.csv')# 預處理 encoded_sex = preprocessing.LabelEncoder()# 轉換成數值,因為 Sex 是字符串要轉為數值才好操作 train.Sex = encoded_sex.fit_transform(train.Sex) features_one = train[['Pclass', 'Sex', 'Age', 'Fare']].values.tolist()target = train['Survived'].values# 補充缺失值 for x in range(len(features_one)):if str(features_one[x][2]) != 'nan':continueelse:features_one[x][2] = 33# 為了方便把平均數改為 33。# 擬合一個決策樹: my_tree_one my_tree_one = tree.DecisionTreeClassifier() my_tree_one = my_tree_one.fit(features_one, target)# 查看各屬性在決策樹中的占比 print(my_tree_one.feature_importances_)# 檢測模型的預測準確度 print(my_tree_one.score(features_one, target))? ?輸出結果:? ??
? ? 97% 一個非常好的成績,但是可以理解,因為畢竟您的模型就是用這組數據訓練出來的。
? ? 因此,打開 test.csv 繼續測試,發現測試數據里只有 11 項指標,不包含信息 Survived。
? ? DataCamp 網站會幫您評分,具體的步驟就不寫了,直接告訴您結果。
? ? 結果是,我們這個模型用于測試數據的準確度仍然高達 97%!!!
? ??如此粗糙的模型,它居然就能做到這么準確!
? ? 人工智能界對此有個專門的形容詞,叫 “unreasonably effective”,不合理地準確。
? ??我們只知道泰坦尼克號上一半旅客的存活信息,我們根據這些信息做了一個預測模型,而后就能用這個模型,以97%的準確度,預測另一半旅客中每個人是否活了下來!
? ? 如果不滿足 97% 的預測程度,還可以嘗試新的組合。
? ??統計模型是數學的加強,依賴于參數估計,它要求模型的建立者,提前知道或了解變量之間的關系。
? ? 機器學習通過反復迭代學習發現隱藏在數據中的科學,由于機器學習作用在真實的數據上并不依賴于假設,預測效果是非常好的。
[一點點經驗]
? ? 任何一個機器學習的過程,其實都是不斷地調整數學模型參數的過程,直到參數收斂到最佳點。
? ? 每一次調整被稱為是一次迭代,調整的幅度被稱為迭代的步長。
? ? 一開始的時候,迭代的步長要比較大,這樣能夠很快地確定大致范圍,效率比較高,這種方法在統計學上最優的,請見博客:《扔玻璃球》。
? ? 世界上每年有很多機器學習方面的論文,都是圍繞提高學習效率展開的,而其中的核心其實就是怎樣用最少次迭代,完成模型的訓練。
? ? ?當然,任何好的機器學習算法都不是事先人為設定步長,而是在學習的過程中,自動找到合適的步長。
? ? ?任何從事過機器學習工作的人都知道這樣一個訣竅,為了加快機器學習的收斂速度,最好先用標注過的高質量數據尋找收斂的方向,這比完全沒有數據輸入,全靠計算機自適應學習快得多。
? ? ? 那些標注過的,正確無誤的數據, 其實就是人總結出來的,或者見到的成功經驗。沒有這些成功經驗,計算機通過自適應學習,也能收斂到正確的模型,但是時間要長很多。
? ? ? ?如果你給計算機輸入噪音,它們相當于失敗的經驗,計算機即使最終能回歸到正確的模型上,也要走非常非常長的彎路。
? ??泰坦尼克號就是有監督學習,事先就想到要預測 幸存 這個變量,無監督學習是讓程序自己發現變量之間的聯系。
? ??學會了這個方法,使用現成的工具,只要有足夠好的數據,您立即就可以搞幾個人工智能應用。
? ? 比如一個信用卡公司有十萬個用戶的詳細數據,包括年齡、收入、以往的購買記錄、信用得分、還款記錄等等,那您就可以預測其中每一個人下個月按時還款的可能性。
? ??現有的人工智能就是用統計方法增加猜測的準確度。
? ? 人工智能就是機器學習。機器學習就是統計模型。
? ?“人工智能” 應該叫“人工不智能”。
因果革命?
? ? ? 在過去不到三十年的時間里,珀爾領導了一場統計學家和計算機科學家參與的 “因果革命”。
? ? ??我們知道現在所謂的 AI,本質上就是機器學習。
? ? ? 用泰坦尼克號這條船上的數據,也只能用于預測泰坦尼克號上的人;
? ? ? 可是世界上每個地方都不一樣誒:
- ? ? ? 醫療:沒有倆個人的身體結構是一樣的;
 - ? ? ? 自動駕駛:每個地區的行車規則都不一樣;
 - ? ? ? ?......
 
? ? ? 只要把事情、環境稍稍的改變,現在的人工智能就廢了。
? ? ? 其實現在的人工智能沒有改變什么,社會還是這個社會,計算機也沒有解決我們的社會問題。
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?--- 摘自《人工不智能》
朱迪爾 · 珀爾? ? ? 珀爾是機器學習技術的開山鼻祖之一,但他也是這種 AI 最激烈的批評者,他認為數據是極其愚蠢的。
? ? ? 珀爾要做的,是讓計算機學會因果關系,讓 AI 真正理解 ta 在干什么,這樣 AI 就和人一樣可以推理了。
? ? ? In technological revolutions,past created new and often better kinds of work. The automation revolution, however, could break that pattern and all of work would be automated。
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? —— Fortune
? ? ? 這條路非常非常難,這是一條革命之路。
? ? ? 為此我們要建立所謂 “因果模型”,但在此之前,我們先研究一下因果思維到底是怎么回事。
? ? ? 舉個例子,一個國家的人均巧克力消費量,和這個國家的諾貝爾獎得主人數,倆者之間有很強的相關性。
? ? ? 只是這個相關性就沒什么意義,您總不可能說:“吃巧克力有利于得諾貝爾獎”。
? ? ??讓我們解釋這個相關性的話,肯定是:“巧克力消費量高是因為這個國家的經濟比較發達,而經濟比較發達的國家容易出諾貝爾獎得主”。
? ? ??請注意!只要這么一解釋,就用到了因果關系。
? ? ? 判斷相關性有沒有意義的標準是什么呢 ??
? ? ? 難道不還是要借助因果嗎 ???
? ? ??無形之中,我們還是覺得有因果的相關性更有意義。
? ? ? 因果思維很有用,一個簡單的因果模型,就能勝過無數經驗。
? ? ? 因果模型可以模擬出人的推理能力,因此人工智能大神才會如此傾向于因果思維啦。
因果思維的層次?
? ? ? 珀爾把 因果思維 一共分為三個等級。
? ? ? ? ? 1.??觀察:通過數據分析做出預測,觀察是尋找變量之間的相關性,觀察就是積累經驗,現在所有實用 AI 技術都是基于這個第一級思維。
- ? ?看到有人打傘,就能推測出,外面可能在下雨。
 - ? ?如果一個顧客買牙膏的話,他有多大的概率同時也買牙線呢 ?
 - ? ?AlphaGo 下圍棋,并不是它理解這步棋有什么用,ta 只不過知道走這步贏棋的概率會更大。
 - ? ? ......
 
? ? ? ? 所有動物都有觀察思維的能力。觀察思維已經能解決很多問題,但是遠遠不夠。
? ? ? ? ? 2.??干預:是預判一個行動的結果。
- ? ?如果我現在把牙膏的價格給提高十倍,對牙線的銷量會有什么影響 ?
 - ? ?如果我去表白會怎么樣 ?
 - ? ? ......
 
? ? ? ? ?以往的經驗可以給你一些提示,但干預動作的結果到底會怎樣,您需要更高級的判斷。
? ? ? ? ?想知道結果,最好的辦法是做實驗。
? ? ? ? ?互聯網公司一直都在做各種 “A/B測試”,看看哪個標題能吸引更多點擊,什么顏色的網頁能讓用戶停留時間更長,都是用分組測試的方法。
? ? ? ? ? 測試是主動的干預。
? ? ? ? ??3.??想象,是對以前發生的事兒的反思。
- ? ?如果我當時是那么做的話,現在會是一個什么樣的結果 ?
 - ? ?如果我小時候認真讀書,我能考上什么加州理工么 ?
 - ? ? ......
 
? ? ? ? ??想象是智人的超能力。
? ? ? ? ? 珀爾引用了赫拉利在《人類簡史》里的說法,大約是在七萬年前,智人發生了一起 “認知革命” —— 智人開始想象一些不存在的東西。
? ? ? ? ? 第一級也許只要有數據分析就行,但第二和第三級,需要因果模型,您需要知道什么導致什么。
? ? ? ? ??有了因果模型,您就能在大腦里做各種思想實驗,您就能權衡比較,您就能為未來做計劃。
? ? ? ? ??人工智能現在很大的一個瓶頸在于 ta 不能理解因果關系。
? ? ? ? ? 因此,因果關系是人工智能發展的趨勢,對比倆者,其實是基于機器學習的人工智能是不智能的,而未來的基于因果關系的人工智能才是真的智能。
? ? ? ? ? 如果對因果關系感興趣,可以研究一些哲學、佛學、心理學、經濟學等的內容,我將更新在博客:《大航海時代的海賊王》。
實現因果思維的方法?
? ? ? ? ? 其實 珀爾 也是哲學家,哲學家對因果關系有十分深刻的討論,目前計算機科學家已經有了倆種方法。
? ? ? ? ? 這兩種方案都有一定的效果,但也都有短板。
[方法一]
? ? ? ? ? 美國西雅圖有一家人工智能研究所,他們的科學家團隊用的就是這個思路。
? ? ? ? ? 他們收集了很多常識性的陳述,作為人工智能學習的素材。
? ? ? ? ? 這些常識哪里來呢 ?
? ? ? ? ? 就是靠人來給,亞馬遜有一個勞務眾包平臺,有很多人在線接一些散活兒。
? ? ? ? ? 研究人員就付費請這些眾包人員來制作常識性的陳述。
? ? ? ? ? 比如 ,X 把 Y 打昏了”這樣一個陳述,他們就找很多人來描述 X 的意圖:X為什么這樣做 ?
? ? ? ? ? 研究人員收集了 2 萬 5 千條這樣的陳述之后,就用這些陳述來訓練AI,而后再讓AI來分析新句子,推斷出句子當中的情緒或者意圖。
 ? ? ? ? ? 有時候,AI 能做出一些非常靠譜的推測,比如說,咱們換個問題:“杰克做了感恩節晚餐” ,AI會回答:“杰克的目的,是想要給家人留下美好的回憶”。這很不錯了,對吧?
? ? ? ? ? 但是,從總體來看,AI的正確率不算高,最好的情況,也就能答對一半。
? ? ? ? ? 而且這個方法太需要依賴人力了,你想,有那么多條常識性的陳述,如果都要靠人工來想,這個工作量實在太恐怖了。
[方法二]
? ? ? ? ??徹底放棄了傳統的深度學習的路子,直接把基本邏輯用硬編碼的方式植入AI。
? ? ? ? ? Vicarious公司用的就是這套方法,他們預先告訴AI:物體之間有相互作用,一個物體的運動軌跡,會因為與其他物體相互作用而發生改變——這就相當于給AI預先植入了人類對運動規律的基本認識。
? ? ? ? ??這種 AI 用很少的數據量就能學會新技能,而且還會變通。
? ? ? ? ??就拿“打磚塊”來說,游戲規則改變之后,這么學習出來的 AI 竟然也能很快適應。
? ? ? ? ??它似乎和人類一樣,抓到了這個游戲的本質。
? ? ? ? ??但這種方法最大的短板,就是AI做判斷時速度比較慢,而且預先要植入什么樣的邏輯,依然離不開人類的仔細推敲。
? ? ? ? ??聽到這,您可能聽出問題來了。
? ? ? ? ??是的,這兩種方案表面上看似乎都能讓人工智能掌握一些常識。
? ? ? ? ? 但問題在于,它們都是“治標不治本”。單靠人工智能,還是沒有辦法像人類一樣積累常識。
? ? ? ? ? 長路漫漫,如果某天真的達到了,到時候大家就可以看到?“碾壓” 人類能力的 AI 。
? ? ? ? ? ??
Computing as Pervasive Information Processes
? ? ? The spread of computing into many fields in the 1990s was another factor in the disintegration of the automation consensus of computational thinking in the academic world.
? ? ? Scientists who ran simulations or evaluated mathematical models were clearly thinking computationally but their interest was not about automating human tasks.
? ? ? ?A computational interpretation of the universe started to gain a foothold in sciences(see the next section, "The Universe as a Computer").
? ? ? ?The nail went into the automation coffin when scientists from other fields started saying around 2000 that they worked with naturally occurring information processes.
? ? ? ?Biologists, for example, said that the natural process of DNA transcription was computational.
? ? ? ?There was nothing to automate; instead they wanted to understand and then modify the process.
? ? ? ?
? ? ? ?Biology is not alone.
? ? ? ?Cognitive scientists see many brain processes as computational and have designed new materials by computing the reactions that yield them.
? ? ? ?Drug companies use simulations and search, instead of tedious lab experiments, to find new compounds to treat diseases.
? ? ? ?Physicists see quantum mechanics as a way to explain all particles and forces as information processes.
? ? ? ?The list goes on.
? ? ? ?What is more, many new innovations like blogging, image recognition , encryption, machine learning, natural language processing, and blockchains are all innovations made possible by computing. ?
? ? ? ?But none of the above was an automation of any existing process-each created an altogether new process.
? ? ? ?
? ? ? ?What a radical change from the days of Newell, Perlis, and Simon !
? ? ? ?Then the very idea of computer science was. attacked because it did not study natural processes.
? ? ? ?Today much of computing is directly relevant to understanding natural processes. ??
? ? ? ?? ? ? ? ? ? ? ? ? ? ??
The Universe as a Computer
? ? ? ?Some researchers say there is another stage of evolution beyond this: the idea that the universe is itself a computer.
? ? ? ?Everything we think we see, and everything we think, is computed by a natural process.
? ? ? ?Instead of using computational to understand nature, they say, we will eventually accept that everything in nature is computation.
? ? ? ?In that case, computational thinking is not just another skill to be learned, it is the natural behavior of the brain.
? ? ? ?
? ? ? ?Hollywood screenwriters love this story line.
? ? ? ?They have taken it into popular science-fiction movies based on the notion that everything we think we see is produced for us by a computer simulation, and indeed every thought we think we have is an illusion given by a computation.
? ? ? ?It might be an engaging story, but there is little evidence to support it.
? ? ? ?This claim is a generalization of a distinction familiar in artificial intelligence.
? ? ? ?Strong AI refers to the belief that suitably programmed machines can be literally intelligent.
? ? ? ?Weak AI refers to the belief that, through smart programming, machines can simulate mental activities so well they appear intelligent without being intelligent.
? ? ? ?For example, virtual assistants like Siri and Alexa are weak AI because they do a good job at recognizing common commands and acting on them without "understanding" them. ? ?
? ? ? ?The pursuit for strong AI dominated the AI agenda from the founding of the AI field in 1950 until the late 1990s.
? ? ? ?It produced very little insight into intelligence and no machines came ?close to anything that could be considered intelligent in the same way humans are intelligent.
? ? ? ?The pursuit for specialized, weak AI applications rose to ascendance beginning in the 1990s and is responsible for the amazing innovations with neural networks and biodata analysis.
? ? ? ?Similar to the weak-strong distinction in AI, the "strong" computational view of the universe holds that the universe itself, along with every living being, is a digital computer.
? ? ? ?Every dimension of space and time is discrete and every movement of matter or energy is a computation.
? ? ? ?In contrast, the "weak" computational view of the universe dose not claim that the world computes, but only that computational interpretations of the world are very useful for studying phenomena: we can model, simulate, and study the world using computation.
? ? ??
? ? ? ?The strong computational view is highly speculative, and while it has some passionate proponents, it faces numerous problems both empirical and philosophical.
? ? ? ?Its rise is understandable as a continuation of the ongoing quest to understand the world through the latest available technology.
? ? ? ?For instance, in the Age of Enlightenment, the world was compared to the clockwork.
? ? ? ?The brain has successively been compared to the mill, the telegraph system, hydraulic systems, electromagnetic systems, and the computer.
? ? ? ?The newest stage in this progression is to interpret the world is not a classical computer but a quantum computer.
? ? ?
 ? ? ? ? ? ?
總結
以上是生活随笔為你收集整理的4. 计算机科学 (Kaggle项目拆解:泰坦尼克号预测)的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: iReport使用入门
 - 下一篇: mysql - rank函数的使用