model.fit() Part I

Parikshit Sanyal
Significant others
Published in
5 min readJun 29, 2021

Why do we need to learn anything at all?

Unicellular organisms (bacteria, protozoa), and many multicellular ones (the entire kingdom of plants, animals like sponge and hydra) live and die (happily?) without caring to learn a wee bit. Evolution has given them enough to survive and reproduce. Any further improvement by the individual organism is deemed completely unnecessary.

Life needs food to sustain itself, a means to reproduce, rest, and some mechanism of protection from danger (heat/cold, acid, predators etc). As long as nature provides, organisms are happy to comply. There’s hardly any room for improvisation. Not at the level of the individual, anyway; evolution works slowly; its effects begin to show only after millions of years.

A paramecium will swim towards sugar and run away from acid; which is its innate behavior and not from experience (Image from Barfooz at the English Wikipedia., CC BY-SA 3.0 <http://creativecommons.org/licenses/by-sa/3.0/>, via Wikimedia Commons)

Learning seems to be a product of natural selection; when the going got tough and competition got stiff, organisms which could modify their behavior from past experiences (i.e. the rat which can think ‘better not go out in the sun, my cousin was devoured by an eagle yesterday’) — had an evolutionary edge over others.

  1. Mind the word think: learning involves at least some degree of conscious activity. A paramecium will swim away from hot waters, and a plant will grow towrds sunlight; neither of these are ‘learning’ in the conventional sense of the word. Any modern air conditioner can sense ambient temperature and adjust its wattage; but nobody in their right mind would call this ‘learning’.
  2. In the evolutionary scheme of learning, it is inevitably tied to some biological necessity (food/ reproduction/ survival); any organism with a sufficiently developed brain must learn several different things in its life, just to survive in an increasingly competitive environment.

To summarise, ‘learning’ in the conventional sense is a function of at least two neurons, somewhere in the brain of higher animals; let us call them A & B. If A & B are linked (‘synapsed’) in a particular way:

A -> B

… so that a certain input on A always produces a certain output from B. When an organism learns, the same input on A must produce a quantitatively different output from B, and this change must be permanent.

We’ll briefly review the more common mechanisms of learning in animals.

Habituation

You rent a place in a new city; you are waken up by the shrill whitsle of a train on your very first night; your first reaction is panic, and then you realise the rail line must be nearby. A few nights pass, you wake up every night with the same whistle, but the panic seems to have gone. After a week, you don’t even wake up. It seems some neuron in your brain has figured out that the whistle of a distant train is neither good nor bad for you, and its best to ignore it.

# Before habituation
A (whistle) -> B (wake up!!!)
# After habituation
A (whistle) -> B (whatever)

Imprinting

For the first few months of their lives, children must depend on adults for survival. A duckling will hatch from the egg, and immediately seek the first living things to latch onto. Typically, it finds the mother, and it’s imprinted somewhere in its brain to follow the mother around (which is good survival tactic). However, it doesn’t need to be the mother everytime: in this Tom & Jerry film from 1955, a freshly hatched duckling finds Tom the cat, and gets irreversibly attached to him.

# Before imprinting
A(sight of adult) -> B (nothing)
# After imprinting
A(sight of adult) -> B (follow it aroud)

Operant conditioning

One must learn the perils (and joys) of life to survive: herded cows stay away from electrified fence after their first encounter, young children can’t stay from ice cream (until their tooth hurts). These mechanisms are similar to the earliest protists (i.e. paramecium), except there is now a component of ‘experience’ to them (i.e. their must be a first time encounter with a reward/ danger for operant conditioning).

# Before operant conditionig
A(sight of fire) -> B (let's explore!!)
# After operant conditioning
A(sight of fire) -> B (stay away!!!)

Classical conditioning

Now that hunter-gatherer socities are extinct and forests are dwindling, animals must find increasingly indirect means to obtain the basic necessities of life. If you’re reading this article, chances are that you have never produced food yourself, and are fully dependent on the abstract entity called ‘market’ to get food. The day this whole market mechanism disappears, you’ll possibly starve. How then, has evolution prepared you for dealing with the ‘market’?

In Pavlov’s classical experiment, after repeated servings of food accompanied with the ring of a Bell, his dog began to salivate not just to food, but the sound of the bell.

# Before conditioning
A(bell) -> C (nothing) # The sound of a bell hardly means anything to a dog
B(food) -> C(salivation) # Obviously, that's biology
A AND B -> C(salivation) # Because of the food, not the bell
# After conditioning
A OR B -> C(salivation) # Note that 'and' has changed to 'or'

Now, pause a moment to think. You as an organism need to eat. That’s all there is to it. Why do you need to go to school, learn stuff like ‘integral calculus’ (which is irrelevant to your biological survival, i.e. it’s the ‘bell’), get a ‘job’ and earn pieces of paper with numbers printed on them? No one can eat money; why must we hanker after it?

If instead you had belonged to a hunter gatherer society, you would have had direct access to your food (life would have been real simple: just walk down the forest and grab a peach; don’t get eaten by a leopard). Unfortunately, you’re born in a society which has placed layers after layers of such ‘bell’s between you and your food. To get food, you must first love the ‘bell’ (i.e. school, job, money).

# Before conditioning, i.e. a child
A(school, job, money) -> C (nothing) # the child will most probably try to eat the money, avoid school and wonder where do his parents go out everyday
B(give the child some food) -> C('me want food!!!')
A AND B -> C('me want food!!!' ) # Because of the food, not the school/ job/ money
# After conditioning, i.e. you
A OR B -> C('me want job!!! me want money!!!')

And now you’re fuly adapted to deal with the market! Evolution has achieved another feat.

Pavlov’s writings¹ do not mention how many times the ‘bell’ (actually a metronome) was rung; let us assume that it was x, i.e. after hearing the bell & having the food together for x times, (i.e. after x epochs of training) the dog finally learnt the association of the two. As if there is a code somewhere in the brain of the dog:

if len(bell & food) > x:
change (A & B -> C) to (A or B -> C)

This seems ridiculuous! We don’t have neurons with numbers written inside them! Yet, experiments on learning are remarkably reproducible. Children across the globe learn to stand by 1 year, and can walk by 18 months. Of course, there is no ‘alarm neuron’ in the brain which goes off at 1 year and 18 months. So where do these numbers emerge from?

Before moving onto part II, ponder for a moment over these isssues.

  1. https://psychclassics.yorku.ca/Pavlov/lecture3.htm

--

--