Re: learnable dynamics (was Goal of AI...)
- From: Michael Olea <oleaj@xxxxxxxxxxxxx>
- Date: Mon, 29 May 2006 05:27:05 GMT
JGCASEY wrote:
Michael Olea wrote:
template<typename TREAL = float>
class LogisticMap ...
Unfortunately I am just a humble BASIC programmer who has
done some c programming but only dabbled in c++.
I had to look up lambda which is some kind of c++ library
and TREAL which is a general purpose real number. I never
got to use or understand c++ templates.
OK, if you don't know C++ I can see how these mistakes could arise.
First, "lambda" is just the name, some arbitrary name I chose, for a real
valued variable. It plays the role of "k" in the equation. I called it
"lambda" rather than "k" because in my first encounter with the logistic
map the constant I called "k" was represented by the greek letter lambda.
So lambda here is just the name of a variable - when you initialize the
"object" that calculates successive values of x, the logistic map
calculator object, you set lambda to some constant value, like 4.0 (as is
done in the example snippet) or say 3.726.
Now, there is a "lambda library" - a C++ library available from the BOOST
organization, one of many many libraries available from BOOST. This is a
library that makes a certain style of programming - the "lambda calculus",
relatively easy in C++. It has nothing to do with my choice of variable
name above (I could have used "jc", or "zick", or "k"...).
Pretty much the same comments apply to my choice of the name "TREAL". This
is just an arbitrary name, but this time it is the name not of a variable
but of a data type - I could have called it "T", for example. I choose
"TREAL" to indicate that the data type needs to support the concept of real
numbers. In C++, as in C, there are 2 built-in data types you can use for
real numbers: "float" and "double". These are both floating point
representations of reals. In my usual environment floats are 32-bit ieee
floating point numbers, whereas doubles are 64-bit ieee floating point
numbers. You are not limited to the built in types - you can roll your own,
say a variable precision version, or a version optimized for numbers that
will be restricted to the range (0, 1). You can roll your own so long as
your version supports the operations on reals used by the logistic map
object - e.g. subtraction, multiplication, assignment, etc. The reason for
making this data type a compile-time parameter is that otherwise every time
I wanted to use some different implementation of reals, say I wanted to use
double rather than float (which I made the default) then everywhere the
word TREAL appears I would have to change the code to say "double". By
making the type a parameter a) I only specify the type once, where I
initialize the object, and b) I can use as many different implimentations
of real numbers in a single program as I see fit, whithout changing the
code that implements the map.
So this statement:
LogisticMap<> map(4.0, 0.4);
Does several things. 1) it declares a variable, named "map" of type
LogisticMap<float> - that is, everywhere the word TREAL appears in the
definition of LogisticMap the compiler will see the word "float" (so you
could think of it as glorified macro substitution). The reason I can write
LogisticMap<> instead of the more explicit LogisticMap<float> is that in
the definition of LogisticMap I made float the default type for TREAL:
template<typename TREAL = float>
class LogisticMap ...
2) It initializes the value of "lambda" (aka "k") to 4.0. This value of
lambda will never change for the life of the object with variable name map.
3) It sets the intial value of x to 0.4. Remember we have some initial
population size and we want to see how it evloves over time. So 0,4 is the
intitial population size. On each iteration the current value of x will be
the input to the computation lambda*x*(1-x), and the result will be saved
and used as the starting value for the next iteration.
4) in subsequent code every appearance of "map()" is like a function call -
it returns the next value of x in the time series, but it also has the side
effect of stashing that value away to serve as the "starting population
size" for the next invocation of map().
5) By making map a variable it can be passed as an argument to other
"functors" that have no idea what "map" does other than return a value,
which can be operated on in turn e.g. { if ( f() <= 0.5) return 0 else
return 1; }. That way you can compose complex functions out of fine-grained
components.
Now, one thing I might want to investigate is how sensitive the sequence of
values is to the precision with which floating point numbers are
represented. So I could have a little code like this:
LogisticMap<float> mapF(4.0, 0.4);
LogisticMap<double> mapD(4.0, 0.4);
int i;
for (i = 0; abs(mapF() - mapD()) < threshold; ++i)
;
//print divergence of thresold at iteration i;
I recognize x[i+1] = k*x[i]*(1-x[i]) from reading I have
done on chaos but have never actually looked much into
the subject.
It is a nice dynamical system to play with because you can investigate
almost all the major phenomena of chaotic dynamics in a very simple
setting.
The variable x is a line segment running from 0 to 1.
More precisely x is a real-valued number taking values in the interval
running from 0 to 1.
Thus in BASIC I guess you would do something like this,
k = 3
for x = 0 to 1 step 0.1
PRINT k * x * ( 1 - x)
next i
Not quite, no. What Curt said. You set x to some starting value and let it
evolve. You want to see how it evolves from some starting point
So with your unsupervised learning algorithms do
they need a critic or do they just work by themselves
to learn a compact set of rules that are a "good"
approximation of the actual rules?
No critic. The latter. The task is not simply to predict the sequence, but
to model it, which includes estimating its predictability (e.g. the
probability that the next value will fall between 0.2 and 0.27, or that the
next 4 values will all be greater than 0.5, etc.). How the algorithm
constructs its model may or may not involve comparing its predictions with
results. For example, a typical self-organizing map does not make such
comparisons. (Hey, Curt, there's a reason Sutton and Barto distinguish RL
from unsupervised learning, and a reason I say RL is a special case of
unsupervised learning of probability distributions ;-).
And do you think this is related to how the brain might
learn about its input? Is our input chaotic in any way?
Yes, at an abstract level it is related. We encounter a full gamut of
phenomena from steady state to periodic to chaotic to stochastic, as well
as mixtures (e.g. "noisy periodic"). Want an example of chaotic "inputs"?
Most meteorologists today would put the weather in that category.
-- Michael
.
- Follow-Ups:
- Re: learnable dynamics (was Goal of AI...)
- From: JGCASEY
- Re: learnable dynamics (was Goal of AI...)
- References:
- Re: Goal of AI: Perfect or Bounded Rationality
- From: adityar7
- Re: Goal of AI: Perfect or Bounded Rationality
- From: Curt Welch
- Re: Goal of AI: Perfect or Bounded Rationality
- From: jalegris
- Re: Goal of AI: Perfect or Bounded Rationality
- From: Curt Welch
- Re: Goal of AI: Perfect or Bounded Rationality
- From: jalegris
- Re: Goal of AI: Perfect or Bounded Rationality
- From: Curt Welch
- Re: Goal of AI: Perfect or Bounded Rationality
- From: jalegris
- Re: Goal of AI: Perfect or Bounded Rationality
- From: Curt Welch
- Re: Goal of AI: Perfect or Bounded Rationality
- From: emotioncube
- Re: Goal of AI: Perfect or Bounded Rationality
- From: Curt Welch
- Re: Goal of AI: Perfect or Bounded Rationality
- From: Michael Olea
- Re: Goal of AI: Perfect or Bounded Rationality
- From: Curt Welch
- Re: Goal of AI: Perfect or Bounded Rationality
- From: Michael Olea
- Re: Goal of AI: Perfect or Bounded Rationality
- From: JGCASEY
- Re: Goal of AI: Perfect or Bounded Rationality
- From: Michael Olea
- Re: Goal of AI: Perfect or Bounded Rationality
- From: JGCASEY
- learnable dynamics (was Goal of AI...)
- From: Michael Olea
- Re: learnable dynamics (was Goal of AI...)
- From: JGCASEY
- Re: Goal of AI: Perfect or Bounded Rationality
- Prev by Date: Re: learnable dynamics (was Goal of AI...)
- Next by Date: Re: learnable dynamics (was Goal of AI...)
- Previous by thread: Re: learnable dynamics (was Goal of AI...)
- Next by thread: Re: learnable dynamics (was Goal of AI...)
- Index(es):
Relevant Pages
|
|