[alicebot-archcomm] more random <random>

Dr. Richard S. Wallace alicebot-archcomm@list.alicebot.org
Sun, 28 Apr 2002 12:32:10 -0700


As I recall, the discussion was stalled on the definition of "equals".

My preference would be to get the more primitive abstractions of equals,
set, member and so on worked out, so that things like "shuffle" can be
easily and unambiguosly defined in terms of the primitives (whether we
expressly provide the primitives in AIML or not).

Rich
----- Original Message -----
From: "Noel Bush" <noel@alicebot.org>
To: "Alicebot and AIML Architecture Committee"
<alicebot-archcomm@list.alicebot.org>
Sent: Sunday, April 28, 2002 12:28 PM
Subject: Re: [alicebot-archcomm] more random <random>


> I am just reviewing the recent discussion on the general list, which I
> should have done before my first post....in any case, it seems to me
> that maybe the discussion might have gotten sidetracked on the question
> of sets and lists in AIML, which is interesting but perhaps not
> essential for what some people are looking for.
>
> The <arb> (or <arbitrary>, in the interest of avoiding obscurity) idea
> seems really nice, but can't it be seen as a more advanced topic, one we
> could get on to after providing a simpler <shuffle> that provides random
> selection without replacement (now that I know the preferred term :-) )?
>
> On Sun, 2002-04-28 at 23:20, Dr. Richard S. Wallace wrote:
> > Yep.  That's called random selection without replacement.
> >
> > The classic example is a shuffled deck of cards.  After you choose the
seven
> > of hearts, you cannot choose the seven of hearts again.
> >
> > Rich
> > ----- Original Message -----
> > From: "Noel Bush" <noel@alicebot.org>
> > To: "Alicebot and AIML Architecture Committee"
> > <alicebot-archcomm@list.alicebot.org>
> > Sent: Sunday, April 28, 2002 12:17 PM
> > Subject: Re: [alicebot-archcomm] more random <random>
> >
> >
> > > I'm always immediately ready to believe that I'm the stupidest person
in
> > > the room, and that with every word out of my mouth I only add more
> > > evidence that I'm utterly incompetent to express any thought or
> > > opinion.  But that doesn't stop me from hoping that someone with more
> > > expertise will come along and help give form to the formless, so to
> > > speak.
> > >
> > > Do you have a prediction, mystical intuition, rock-solid proof,
> > > anything, regarding something like "shuffle" and whether it's needed?
> > > People who are building various bots for different applications seem
to
> > > be expressing a need.  Can someone who has already picked up several
> > > statistics books provide some articulation to this need?
> > >
> > > On Sun, 2002-04-28 at 23:06, Dr. Richard S. Wallace wrote:
> > > > My suggestion is to pick up a statistics book.
> > > >
> > > > Rich
> > > >
> > > > ----- Original Message -----
> > > > From: "Noel Bush" <noel@alicebot.org>
> > > > To: "Alicebot and AIML Architecture Committee"
> > > > <alicebot-archcomm@list.alicebot.org>
> > > > Sent: Sunday, April 28, 2002 12:02 PM
> > > > Subject: Re: [alicebot-archcomm] more random <random>
> > > >
> > > >
> > > > > Thanks, John and Rich, for the informative replies.
> > > > >
> > > > > I guess my concern has to do with an unanswered requirement that
seems
> > > > > to be lurking, not the nature of randomness itself.  The point
about
> > > > > never finding an even distribution in a small sample is definitely
> > > > > important.  And it helps me to understand better the need for a
> > > > > variation on the <random> theme, as was recently discussed on the
> > > > > mailing list.
> > > > >
> > > > > As in,
> > > > >
> > > > > <shuffle>
> > > > >   <li>One thing.</li>
> > > > >   <li>Another thing.</li>
> > > > >   <li>And so on.</li>
> > > > > </shuffle>
> > > > >
> > > > > In which one item is chosen each time, "randomly" (without further
> > > > > discussing what that is), and then the same element will not be
chosen
> > > > > again in the same bot-user context until all elements from the
> > <shuffle>
> > > > > have been "used up".
> > > > >
> > > > > I think this meets a need for what people would tend to mislabel
> > > > > "random" (myself included).  It could be that this function is
even
> > more
> > > > > needed than an actual <random>, since people are actually seeking
a
> > way
> > > > > to create "varied, not-so-repetitive" responses, not really
something
> > > > > that corresponds to a mathematical definition of random.
> > > > >
> > > > > On Sun, 2002-04-28 at 20:30, John Foderaro wrote:
> > > > > >
> > > > > >
> > > > > > >> The problem is that if two different <random> elements are
> > > > > > >> imagined to each have an independent random "space", tying
all of
> > > > their
> > > > > > >> choices to the same sequence of pseudo-random numbers really
> > throws a
> > > > > > >> wrench into the works.
> > > > > >
> > > > > >  I know what you're saying but I don't think there is anything
to
> > worry
> > > > > > about.  Random number generators will produce a nice even
> > distribution
> > > > > > but only over a very large number of samples.  If you're asking
> > > > > > for a random number between 0 and 4 (inclusive) and call random
5
> > > > > > times you almost certainly won't get each number chosen once.
> > > > > > And that's the correct result since the odds of that happening
> > > > > > if the random number generator were truly random is very small.
> > > > > >
> > > > > > I wrote little test program to show this:
> > > > > >
> > > > > > If I chose 5 random numbers I get one 2, two 3's and 2 4's.
> > > > > >
> > > > > > cl-user(31): (testit :count 5)
> > > > > > 0: 0  0.0d0
> > > > > > 1: 0  0.0d0
> > > > > > 2: 1  0.2d0
> > > > > > 3: 2  0.4d0
> > > > > > 4: 2  0.4d0
> > > > > >
> > > > > >
> > > > > > If I chose one million random numbers I get this distribution.
> > > > > > Now the distribution is very nice over the 5 possible numbers:
> > > > > >
> > > > > > cl-user(32): (testit :count 1000000)
> > > > > > 0: 199398  0.199398d0
> > > > > > 1: 199834  0.199834d0
> > > > > > 2: 200394  0.200394d0
> > > > > > 3: 200158  0.200158d0
> > > > > > 4: 200216  0.200216d0
> > > > > >
> > > > > >
> > > > > >
> > > > > > Suppose that after every 7th random number I obtain I call
> > > > > > the random number generator and throw away the value.  This is
> > > > > > simulating the case of running another <random> tag with a
> > > > > > different number of elements.
> > > > > >
> > > > > > We still end up with a nice distribution:
> > > > > >
> > > > > > cl-user(34): (testit :count 1000000 :toss-out 7)
> > > > > > 0: 200119  0.200119d0
> > > > > > 1: 200194  0.200194d0
> > > > > > 2: 199914  0.199914d0
> > > > > > 3: 199833  0.199833d0
> > > > > > 4: 199940  0.19994d0
> > > > > >
> > > > > >
> > > > > > So I don't think there is any need to create multiple
independent
> > > > > > random number sequences, one for each <random> tag.
> > > > > >
> > > > > >
> > > > > > --john foderaro
> > > > > >
> > > > > > ps. here's my test code
> > > > > >
> > > > > > (in-package :user)
> > > > > >
> > > > > > (defvar results (make-array 5))
> > > > > >
> > > > > > (defun testit (&key (count 10000) (toss-out 0))
> > > > > >   (dotimes (i (length results)) (setf (svref results i) 0))
> > > > > >
> > > > > >   (dotimes (i count)
> > > > > >
> > > > > >     ; throw out a random result periodically
> > > > > >     (if* (and (> toss-out 0)
> > > > > >       (zerop (mod i toss-out)))
> > > > > >        then (random (+ (length results) 4)))
> > > > > >
> > > > > >     ; now collect some random info
> > > > > >     (incf (svref results (random (length results)))))
> > > > > >
> > > > > >   (dotimes (i (length results))
> > > > > >     (format t "~d: ~d  ~s~%"
> > > > > >     i
> > > > > >     (svref results i)
> > > > > >     (/ (float (svref results i) 1.0d0) count)))
> > > > > >   )
> > > > > > _______________________________________________
> > > > > > alicebot-archcomm mailing list
> > > > > > alicebot-archcomm@list.alicebot.org
> > > > > > http://list.alicebot.org/mailman/listinfo/alicebot-archcomm
> > > > > >
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > alicebot-archcomm mailing list
> > > > > alicebot-archcomm@list.alicebot.org
> > > > > http://list.alicebot.org/mailman/listinfo/alicebot-archcomm
> > > >
> > > > _______________________________________________
> > > > alicebot-archcomm mailing list
> > > > alicebot-archcomm@list.alicebot.org
> > > > http://list.alicebot.org/mailman/listinfo/alicebot-archcomm
> > > >
> > >
> > >
> > > _______________________________________________
> > > alicebot-archcomm mailing list
> > > alicebot-archcomm@list.alicebot.org
> > > http://list.alicebot.org/mailman/listinfo/alicebot-archcomm
> >
> > _______________________________________________
> > alicebot-archcomm mailing list
> > alicebot-archcomm@list.alicebot.org
> > http://list.alicebot.org/mailman/listinfo/alicebot-archcomm
> >
>
>
> _______________________________________________
> alicebot-archcomm mailing list
> alicebot-archcomm@list.alicebot.org
> http://list.alicebot.org/mailman/listinfo/alicebot-archcomm