Programming as Creating Causal Models
Programming can never just be programming, we must always explain
programming using a metaphor. Programming IS manufacturing.
Programming IS conducting a symphony. Programming IS making
a peanut butter and jelly sandwitch. Insert your particular agenda here.
After reading The Mind's Arrows by Clark Glymour
i think an interesting metaphor may be Programming IS Building
Causal Models.
My take is that programming as primarily teleological and analytical
in nature. Programs are purposeful. This purpose serves as a grounding against
which meanings are resolved. We start from our goals and work backwards figuring
out how to achieve our goals. Goals arise and subside
in feedback loops over time. There is no lack of available paradigms
for implementing all of the above, but the idea of causal models is
interesting. Then again i just may be channeling long repressed memories
from past logic programming classes.
Cause means The producer of an effect, result,
or consequence. Causal means
Indicative of or expressing a cause. The sense of model
that applies is A schematic description of a system, theory, or phenomenon
that accounts for its known or inferred properties and may be used for
further study of its characteristics. A program is chain of causes
that produces the effects necessary to reach our goals. The program
is the model.
The programmer is responsible for implementing the necessary causes and
effects by translating the causal model a programmer has constructed
in their mind to the causal model embodied in a program. In the
mind reason, emotion, and experience meld to provide the
deep structure of a causal model. A lot of what we know isn't
easy to articulate. Programming requires the elicitation
of the model which is difficult because our thoughts are primarily
images which are hard to fully explore and extract.
The discipline of programming, to paraphrase Mr. Glymour:
is about the causal processes and mechanisms though
which intelligent action comes about. Subdisciplines are chiefly
about the processes and mechanisms through which human understanding
of causal relations comes about, the causes of our knowledge of
the causal structure of the world. And adequate theories of human
understanding require knowing what it is that people have when
they have causal knowledge, and how they come to have it.
Causal Structure and Bayes Nets
One of the main tasks of programmers is to learn causal structure.
Mr. Glymour suggests representing causal structures as Bayes Nets:
Bayes nets are type of neural net, which are a type of graphical
causal model. A Bayes net is a directed acyclic graph and an
associated probablity distribution satisfying the Markov Assumption.
If the graph is intended to represent causal relations and the probabilities
are intended to represent those that result from the represented
mechanism, the pair form a causal Bayes net.
The Markov Assumption says that the probability of state
occurring given a previous state sequence depends only on the
the previous n states. The probability of X occurring after
a sequence depends only on the previous state.
The Graph
The vertices represent features or variables. A directed
edge between two variables, X -> Y, means that for some values of all
of the other variables represented, an action that varies X will
cause variation in Y. Mr. Glymour uses the following example:
Clapping (yes/no)
/
/
/ /
TV(on/off) Light(on/off)
/ /
/
/
Electic Power (on/off)
The acyclic requirement bothers me as it seems many interesting problems
involve cycles.
The Probability Stuff
An interesting feature is that you can make probability predictions. The
probability that there is a clapping and the TV is on and the light
is off is:
pr(light is off | clapping) * pr (TV is on | clapping) . pr(clapping)
pr means probability. pr(x|y) is the probablity of x
conditional on y.
The Utility of Causal Bayes Nets
I don't know if the probability features are that important for programmers.
What matters more is that by considering the probabilites it forces you to build
a more complete model of causal relations, and it should help you discover
holes in your model, which should help you better solve your problems.
A causal model is still not an algorithm and programs must in the end
get down to the business of algorithms. Often though it's not the
algorithm that's the problem, but the main problem is not knowing what you
need to do. Building causal models should make it clear what needs
to be done.
comment[]
9:19:36 PM
|