What's the purpose of `if __name__ == '__main__'`?

Stackoverflow Stackexchange

Q: What does `if name == "__main__"` mean in Python?
Possible Duplicate:
What does <if name==“main”:> do?

I have wrote scripts in Python for quite a while now and I study more of Python as I need it. When reading other people's code I meet if name == "__main__": construct quite often.
What is it good for?

A: Basically,
There's a distinction between the "main" script file and external files which were imported or referenced in another way. If the script is the "main" script then the special variable __name__ will equal "__main__".
You can use this to protect the "execution" code from the classes and variables the script has. This enables you to import a script and use classes and variables without actually running that script's main code if it has any.
See also: What does if name == “main”: do?


Which test was devised to determine whether robots can think?

Turing test

The test was introduced by Turing in his 1950 paper "Computing Machinery and Intelligence" while working at the University of Manchester. It opens with the words: "I propose to consider the question, 'Can machines think? Because "thinking" is difficult to define, Turing chooses to "replace the question by another, which is closely related to it and is expressed in relatively unambiguous words." Turing describes the new form of the problem in terms of a three-person game called the "imitation game", in which an interrogator asks questions of a man and a woman in another room in order to determine the correct sex of the two players. Turing's new question is: "Are there imaginable digital computers which would do well in the imitation game?" This question, Turing believed, was one that could actually be answered. In the remainder of the paper, he argued against all the major objections to the proposition that "machines can think".
Since Turing introduced his test, it has been both highly influential and widely criticized, and has become an important concept in the philosophy of artificial intelligence. Philosopher John Searle would comment on the Turing test in his Chinese room argument, a thought experiment that stipulates that a machine cannot have a "mind", "understanding", or "consciousness", regardless of how intelligently or human-like the program may make the computer behave. Searle criticizes Turing's test and claims it is insufficient to detect the presence of consciousness.
History

Cognitive test

Cognitive tests are assessments of the cognitive capabilities of humans and other animals. Tests administered to humans include various forms of IQ tests; those administered to animals include the mirror test (a test of visual self-awareness) and the T maze test (which tests learning ability). Such testing is used in psychology and psychometrics, as well as other fields studying human and animal intelligence.


Turing test

The Turing test, originally called the imitation game by Alan Turing in 1950, is a test of a machine's ability to exhibit intelligent behaviour equivalent to, or indistinguishable from, that of a human. Turing proposed that a human evaluator would judge natural language conversations between a human and a machine designed to generate human-like responses. The evaluator would be aware that one of the two partners in conversation was a machine, and all participants would be separated from one another. The conversation would be limited to a text-only channel, such as a computer keyboard and screen, so the result would not depend on the machine's ability to render words as speech. If the evaluator could not reliably tell the machine from the human, the machine would be said to have passed the test. The test results would not depend on the machine's ability to give correct answers to questions, only on how closely its answers resembled those a human would give. Since the Turing test is a test of indistinguishability in performance capacity, the verbal version generalizes naturally to all of human performance capacity, verbal as well as nonverbal (robotic).


Turing test

The Turing test, originally called the imitation game by Alan Turing in 1950, is a test of a machine's ability to exhibit intelligent behaviour equivalent to, or indistinguishable from, that of a human. Turing proposed that a human evaluator would judge natural language conversations between a human and a machine designed to generate human-like responses. The evaluator would be aware that one of the two partners in conversation was a machine, and all participants would be separated from one another. The conversation would be limited to a text-only channel, such as a computer keyboard and screen, so the result would not depend on the machine's ability to render words as speech. If the evaluator could not reliably tell the machine from the human, the machine would be said to have passed the test. The test results would not depend on the machine's ability to give correct answers to questions, only on how closely its answers resembled those a human would give. Since the Turing test is a test of indistinguishability in performance capacity, the verbal version generalizes naturally to all of human performance capacity, verbal as well as nonverbal (robotic).

Thought experiment

Retrodiction The activity of retrodiction (or postdiction) involves moving backward in time, step-by-step, in as many stages as are considered necessary, from the present into the speculated past to establish the ultimate cause of a specific event (e.g., reverse engineering and forensics).
Given that retrodiction is a process in which "past observations, events, add and data are used as evidence to infer the process(es) that produced them" and that diagnosis "involve[s] going from visible effects such as symptoms, signs and the like to their prior causes", the essential balance between prediction and retrodiction could be characterized as:
regardless of whether the prognosis is of the course of the disease in the absence of treatment, or of the application of a specific treatment regimen to a specific disorder in a particular patient.
Backcasting
The activity of backcasting – the term backcasting was coined by John Robinson in 1982 – involves establishing the description of a very definite and very specific future situation. It then involves an imaginary moving backward in time, step-by-step, in as many stages as are considered necessary, from the future to the present to reveal the mechanism through which that particular specified future could be attained from the present.
Backcasting is not concerned with predicting the future:
According to Jansen (1994, p. 503:


History of robots

It features a female humanoid automaton standing by a basin filled with water.When the user pulls the lever, the water drains and the female automaton refills the basin. Furthermore, he created a robotic musical band. According to Mark Rosheim, unlike Greek designs Arab automata worked with dramatic illusion and manipulated the human perception for practical application. The segmental gears described in The Book of Knowledge of Ingenious Mechanical Devices, published by Al-Jazari shortly before his death in 1206, appeared 100 years later in the most advanced European clocks. Al-Jazari also published instructions on the construction of humanoid automata. The first water clocks modeled on Arabic designs were constructed in Europe about 1000 CE, possibly on the basis of the information that was transmitted during Muslim-Christian contact in Sicily and Spain. Among the first recorded European water clocks is that of Gerbert of Aurillac, built in 985 CE. Hero's works on automata were translated into Latin amid the 12th century Renaissance. The early 13th-century artist-engineer Villard de Honnecourt sketched plans for several automata.

Turing test

The test was introduced by Turing in his 1950 paper "Computing Machinery and Intelligence" while working at the University of Manchester. It opens with the words: "I propose to consider the question, 'Can machines think? Because "thinking" is difficult to define, Turing chooses to "replace the question by another, which is closely related to it and is expressed in relatively unambiguous words." Turing describes the new form of the problem in terms of a three-person game called the "imitation game", in which an interrogator asks questions of a man and a woman in another room in order to determine the correct sex of the two players. Turing's new question is: "Are there imaginable digital computers which would do well in the imitation game?" This question, Turing believed, was one that could actually be answered. In the remainder of the paper, he argued against all the major objections to the proposition that "machines can think".
Since Turing introduced his test, it has been both highly influential and widely criticized, and has become an important concept in the philosophy of artificial intelligence. Philosopher John Searle would comment on the Turing test in his Chinese room argument, a thought experiment that stipulates that a machine cannot have a "mind", "understanding", or "consciousness", regardless of how intelligently or human-like the program may make the computer behave. Searle criticizes Turing's test and claims it is insufficient to detect the presence of consciousness.
History


History of robots

It features a female humanoid automaton standing by a basin filled with water.When the user pulls the lever, the water drains and the female automaton refills the basin. Furthermore, he created a robotic musical band. According to Mark Rosheim, unlike Greek designs Arab automata worked with dramatic illusion and manipulated the human perception for practical application. The segmental gears described in The Book of Knowledge of Ingenious Mechanical Devices, published by Al-Jazari shortly before his death in 1206, appeared 100 years later in the most advanced European clocks. Al-Jazari also published instructions on the construction of humanoid automata. The first water clocks modeled on Arabic designs were constructed in Europe about 1000 CE, possibly on the basis of the information that was transmitted during Muslim-Christian contact in Sicily and Spain. Among the first recorded European water clocks is that of Gerbert of Aurillac, built in 985 CE. Hero's works on automata were translated into Latin amid the 12th century Renaissance. The early 13th-century artist-engineer Villard de Honnecourt sketched plans for several automata.


Cognitive test

Cognitive tests are assessments of the cognitive capabilities of humans and other animals. Tests administered to humans include various forms of IQ tests; those administered to animals include the mirror test (a test of visual self-awareness) and the T maze test (which tests learning ability). Such testing is used in psychology and psychometrics, as well as other fields studying human and animal intelligence.

Progress in artificial intelligence

Sub-human Optical character recognition for printed text (nearing par-human for Latin-script typewritten text)
Object recognition
Various robotics tasks that may require advances in robot hardware as well as AI, including:
Stable bipedal locomotion: Bipedal robots can walk, but are less stable than human walkers (as of 2017)
Humanoid soccer
Speech recognition: "nearly equal to human performance" (2017)
Explainability. Current medical systems can diagnose certain medical conditions well, but cannot explain to users why they made the diagnosis.
Many tests of fluid intelligence (2020)
Bongard visual cognition problems, such as the Bongard-LOGO benchmark (2020)
Visual Commonsense Reasoning (VCR) benchmark (as of 2020)
Stock market prediction: Financial data collection and processing using Machine Learning algorithms
Angry Birds video game, as of 2020
Various tasks that are difficult to solve without contextual knowledge, including:
Translation
Word-sense disambiguation
Proposed tests of artificial intelligence
In his famous Turing test, Alan Turing picked language, the defining feature of human beings, for its basis. The Turing test is now considered too exploitable to be a meaningful benchmark.
The Feigenbaum test, proposed by the inventor of expert systems, tests a machine's knowledge and expertise about a specific subject. A paper by Jim Gray of Microsoft in 2003 suggested extending the Turing test to speech understanding, speaking and recognizing objects and behavior.


Artificial intelligence

In the late teens and early 2020s, AGI companies began to deliver programs that created enormous interest. In 2015, AlphaGo, developed by DeepMind, beat the world champion Go player. The program was taught only the rules of the game and developed strategy by itself. GPT-3 is a large language model that was released in 2020 by OpenAI and is capable of generating high-quality human-like text. These programs, and others, inspired an aggressive AI boom, where large companies began investing billions in AI research. According to AI Impacts, about $50 billion annually was invested in "AI" around 2022 in the U.S. alone and about 20% of the new U.S. Computer Science PhD graduates have specialized in "AI".
About 800,000 "AI"-related U.S. job openings existed in 2022.
Philosophy
Defining artificial intelligence
Alan Turing wrote in 1950 "I propose to consider the question 'can machines think'?" He advised changing the question from whether a machine "thinks", to "whether or not it is possible for machinery to show intelligent behaviour". He devised the Turing test, which measures the ability of a machine to simulate human conversation. Since we can only observe the behavior of the machine, it does not matter if it is "actually" thinking or literally has a "mind". Turing notes that we can not determine these things about other people but "it is usual to have a polite convention that everyone thinks."


Thought experiment

Retrodiction The activity of retrodiction (or postdiction) involves moving backward in time, step-by-step, in as many stages as are considered necessary, from the present into the speculated past to establish the ultimate cause of a specific event (e.g., reverse engineering and forensics).
Given that retrodiction is a process in which "past observations, events, add and data are used as evidence to infer the process(es) that produced them" and that diagnosis "involve[s] going from visible effects such as symptoms, signs and the like to their prior causes", the essential balance between prediction and retrodiction could be characterized as:
regardless of whether the prognosis is of the course of the disease in the absence of treatment, or of the application of a specific treatment regimen to a specific disorder in a particular patient.
Backcasting
The activity of backcasting – the term backcasting was coined by John Robinson in 1982 – involves establishing the description of a very definite and very specific future situation. It then involves an imaginary moving backward in time, step-by-step, in as many stages as are considered necessary, from the future to the present to reveal the mechanism through which that particular specified future could be attained from the present.
Backcasting is not concerned with predicting the future:
According to Jansen (1994, p. 503:


Chinese room

Searle does not disagree that AI research can create machines that are capable of highly intelligent behavior. The Chinese room argument leaves open the possibility that a digital machine could be built that acts more intelligently than a person, but does not have a mind or intentionality in the same way that brains do.
Searle's "strong AI hypothesis" should not be confused with "strong AI" as defined by Ray Kurzweil and other futurists, who use the term to describe machine intelligence that rivals or exceeds human intelligence -- that is, artificial general intelligence, human level AI or superintelligence. Kurzweil is referring primarily to the amount of intelligence displayed by the machine, whereas Searle's argument sets no limit on this. Searle argues that a superintelligent machine would not necessarily have a mind and consciousness.
Turing test
The Chinese room implements a version of the Turing test. Alan Turing introduced the test in 1950 to help answer the question "can machines think?" In the standard version, a human judge engages in a natural language conversation with a human and a machine designed to generate performance indistinguishable from that of a human being. All participants are separated from one another. If the judge cannot reliably tell the machine from the human, the machine is said to have passed the test.


Progress in artificial intelligence

Sub-human Optical character recognition for printed text (nearing par-human for Latin-script typewritten text)
Object recognition
Various robotics tasks that may require advances in robot hardware as well as AI, including:
Stable bipedal locomotion: Bipedal robots can walk, but are less stable than human walkers (as of 2017)
Humanoid soccer
Speech recognition: "nearly equal to human performance" (2017)
Explainability. Current medical systems can diagnose certain medical conditions well, but cannot explain to users why they made the diagnosis.
Many tests of fluid intelligence (2020)
Bongard visual cognition problems, such as the Bongard-LOGO benchmark (2020)
Visual Commonsense Reasoning (VCR) benchmark (as of 2020)
Stock market prediction: Financial data collection and processing using Machine Learning algorithms
Angry Birds video game, as of 2020
Various tasks that are difficult to solve without contextual knowledge, including:
Translation
Word-sense disambiguation
Proposed tests of artificial intelligence
In his famous Turing test, Alan Turing picked language, the defining feature of human beings, for its basis. The Turing test is now considered too exploitable to be a meaningful benchmark.
The Feigenbaum test, proposed by the inventor of expert systems, tests a machine's knowledge and expertise about a specific subject. A paper by Jim Gray of Microsoft in 2003 suggested extending the Turing test to speech understanding, speaking and recognizing objects and behavior.

Artificial intelligence

In the late teens and early 2020s, AGI companies began to deliver programs that created enormous interest. In 2015, AlphaGo, developed by DeepMind, beat the world champion Go player. The program was taught only the rules of the game and developed strategy by itself. GPT-3 is a large language model that was released in 2020 by OpenAI and is capable of generating high-quality human-like text. These programs, and others, inspired an aggressive AI boom, where large companies began investing billions in AI research. According to AI Impacts, about $50 billion annually was invested in "AI" around 2022 in the U.S. alone and about 20% of the new U.S. Computer Science PhD graduates have specialized in "AI".
About 800,000 "AI"-related U.S. job openings existed in 2022.
Philosophy
Defining artificial intelligence
Alan Turing wrote in 1950 "I propose to consider the question 'can machines think'?" He advised changing the question from whether a machine "thinks", to "whether or not it is possible for machinery to show intelligent behaviour". He devised the Turing test, which measures the ability of a machine to simulate human conversation. Since we can only observe the behavior of the machine, it does not matter if it is "actually" thinking or literally has a "mind". Turing notes that we can not determine these things about other people but "it is usual to have a polite convention that everyone thinks."


Meaning of life

To be fruitful and multiply. ()
To obtain freedom. ()
To fill the Earth and subdue it. ()
To serve humankind, to prepare to meet and become more like God, to choose good over evil, and have joy.
˹He is the One˺ Who created death and life in order to test which of you is best in deeds. And He is the Almighty, All-Forgiving. —
To worship God and enter heaven in afterlife.
To love, to feel, to enjoy the act of living
To love more.
To love those who mean the most. Every life you touch will touch you back.
To treasure every enjoyable sensation one has.
To seek beauty in all its forms.
To have fun or enjoy life.
To seek pleasure and avoid pain.
To be compassionate.
To be moved by the tears and pain of others, and try to help them out of love and compassion.
To love others as best we possibly can.
To eat, drink, and be merry.
To have power, to be better
To strive for power and superiority.
To rule the world.
To know and master the world.
To know and master nature.
To help life become as powerful as possible.

Meaning of life

The meaning of life pertains to the inherent significance or philosophical meaning of living (or existence in general). There is not a definitive answer, and thinking or discourse on the topic is sought in the English language through the question, "What is the meaning of life?" (or the related "Why are we here?" or "What is the purpose of existence?"). There have been many proposed answers to these questions from many different cultural and ideological backgrounds. The search for life's meaning has produced much philosophical, scientific, theological, and metaphysical speculation throughout history. Different people and cultures believe different things for the answer to this question. Opinions vary on the usefulness of using time and resources in the pursuit of an answer. Excessive pondering can be indicative of, or lead to, an existential crisis.
The meaning of life can be derived from philosophical and religious contemplation of, and scientific inquiries about, existence, social ties, consciousness, and happiness. Many other issues are also involved, such as symbolic meaning, ontology, value, purpose, ethics, good and evil, free will, the existence of one or multiple gods, conceptions of God, the soul, and the afterlife. Scientific contributions focus primarily on describing related empirical facts about the universe, exploring the context and parameters concerning the "how" of life. Science also studies and can provide recommendations for the pursuit of well-being and a related conception of morality. An alternative, humanistic approach poses the question, "What is the meaning of my life?"


Tex Stackexchange

Q: Missing abstract with amsart class I'm not very good at LaTeX but I've been using it to write my dissertation. Have just come to the end and trying to format everything correctly. Whenever I try to put my Abstract paragraph into the form \begin{abstract} (writing here) \end{abstract} and click play the whole abstract section just disappears. What am I doing wrong?
\documentclass[12pt]{amsart}

\begin{document}

\begin{abstract}
(my abstract here)
\end{abstract}
\end{document}

A: The amsart class does some Mysterious Stuff with abstracts: it stores the abstract in a box to be used in the title page.  To get it to appear, issue the magic command \maketitle after the abstract.
(It will then complain about a missing \title ... )
\documentclass[12pt]{amsart}

\begin{document}

\begin{abstract}
(my abstract here)
\end{abstract}

\maketitle
Some text
\end{document}

Mathoverflow Stackexchange

Q: How to write an abstract for a math paper? How would you go about writing an abstract for a Math paper? I know that an abstract is supposed to "advertise" the paper. However, I do not really know how to get started. Could someone tell me how they go about writing an abstract?

A: *

*Avoid notation if possible.  Notation makes it really hard to search electronically.

*Put the subject in context, e.g., "In a recent paper, T. Lehrer introduced the concept of left-bifurcled rectangles.  He conjectured no such rectangles exist when the number of bifurcles $n$ is odd."

*State your results, in non-technical language, if possible.  "In this paper we show the existence of left-bifurcled rectangles for all prime $n$."

*Mention a technique, if there is a new one:  "Our methods involve analytic and algebraic topology of locally euclidean metrizations of infinitely differentiable Riemannian manifolds".

*Never, ever, ever, cite papers in the bibliography by giving citation numbers; the abstract is an independent entity that should stand on its own.