1. Perceptron in Euphoria

------=_NextPart_000_0175_01BE16EF.698D1100
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I'm developing the perceptron program in Euphoria for windows =
(win32lib.ew). How can I get data in the window if I'm using getText =
command, but It doesn't seem to work properly. is there any other =
command I can use, please let me know.
I'll send you a copy when I finished It.
Thanky you.

------=_NextPart_000_0175_01BE16EF.698D1100
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type><!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 =
HTML//EN"><!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<META content=3D'"MSHTML 4.72.2106.6"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>I'm developing the perceptron =
program in=20
Euphoria for windows (win32lib.ew). How can I get data in the window if =
I'm=20
using getText </FONT><FONT size=3D2>command, but It doesn't seem to work =
properly.=20
is there any other command I can use, please let me know.</FONT></DIV>
<DIV><FONT size=3D2>I'll send you a copy when I finished =
It.</FONT></DIV>

------=_NextPart_000_0175_01BE16EF.698D1100--

new topic     » topic index » view message » categorize

2. Re: Perceptron in Euphoria

Alfredo Brand wrote:

> I'm developing the perceptron program in
> Euphoria for windows (win32lib.ew). How
> can I get data in the window if I'm using getText
> command, but It doesn't seem to work properly.

You can set text with:

    setText( iControl, sText )

and retrieve it with:

    s = getText( iControl )

Good luck with your code!

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

3. Re: Perceptron in Euphoria

Thanks!, but I can't run my code because I've got this error.

An error was detected during execution of your program.

Your program exceeds 300 statements in size, so this Public Domain Edition
of Euphoria cannot provide run-time error diagnostics. If you purchase
the Complete Edition of Euphoria you will get full diagnostic support for
any size of program. See register.doc or visit
http://members.aol.com/FilesEu/

Meanwhile, you can locate your problem using print statements and the
Euphoria trace facility.


Press Enter...
How much does It cost the windows version?

-----Mensaje original-----
De: David Cuny <dcuny at LANSET.COM>
Para: EUPHORIA at LISTSERV.MUOHIO.EDU <EUPHORIA at LISTSERV.MUOHIO.EDU>
Fecha: Lunes 23 de Noviembre de 1998 4:30 PM
Asunto: Re: Perceptron in Euphoria


>Alfredo Brand wrote:
>
>> I'm developing the perceptron program in
>> Euphoria for windows (win32lib.ew). How
>> can I get data in the window if I'm using getText
>> command, but It doesn't seem to work properly.
>
>You can set text with:
>
>    setText( iControl, sText )
>
>and retrieve it with:
>
>    s = getText( iControl )
>
>Good luck with your code!
>
>-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

4. Perceptron in Euphoria

------=_NextPart_000_0019_01BE1B2F.D2CCC2C0
        charset="iso-8859-1"

my first contibution to this list.
If you think It, you can make it.
After several days of programming I finally got It,
enjoy it.
brand_01.e is the main program.


------=_NextPart_000_0019_01BE1B2F.D2CCC2C0
        name="brand.e"
Content-Transfer-Encoding: quoted-printable

new topic     » goto parent     » topic index » view message » categorize

5. Re: Perceptron in Euphoria

>my first contibution to this list.
>If you think It, you can make it.
>After several days of programming I finally got It,
>enjoy it.
>brand_01.e is the main program.


Looks nice, but its all Spanish, what does it do ?

new topic     » goto parent     » topic index » view message » categorize

6. Re: Perceptron in Euphoria

On Sun, 29 Nov 1998 00:33:02 -0500, Alfredo Brand <abrand at ALUMINA.COM.CO>
wrote:

>my first contibution to this list.
>If you think It, you can make it.
>After several days of programming I finally got It,
>enjoy it.

Congratulations! You tackled some difficult areas: numeric input,
for example, and got them to work. No small feat.

If I were using this in a programming class, I would use your
code to discuss several ideas:

1. Is there an easier and shorter way to write the date displays?
2. Following up on Ralf's comment ("It's in Spanish!";), is there
an easy way to internationalize this program?
3. There is a lot of repetition of the tasks:
   SetColors
   SetPosition
   puts(1,something)
   Perhaps we could combine those into a one-liner?

We can solve 1 and 2 with a single concept: The days never change.
There are always seven. Day[2] is (in Euphoria) always Monday/Lunes.
The months never change, month 1 is always January/Enero.
They are - umm...constant.
Why not put them into a list, and reference them by number?
What's more, if we put the list at the top of our program, it will
be easy for anyone to change the names of days and months into the
language of their choice.

Doing this will also simplify our logic quite a bit. See below.

Problem 3 is even more easily solved, resulting in shorter code.
See the Display() function below:

-- Ingenieria de Sistemas III
-- Inteligencia Artificial
-- Profesor : Ricardo Chavarriaga
-- Alfredo Brand
-- albrand65 at hotmail.com
-- brand
-- Funciones
--- with modifications by Irv Mullins

constant month = {"Enero","Febrero","Marzo","Abril",
                  "Mayo","Junio","Julio","Agosto",
                  "Septiembre","Octubre","Noviembre","Diciembre"}

constant days =  {"Dom","Lun","Mar","Mie","Jue","Vie","Sab"}

global procedure Display(sequence coords, sequence colors, sequence text)
   position(coords[1],coords[2])
   text_color(colors[2])
   bk_color(colors[1])
   puts(1,text)
end procedure

global procedure fecha_hora()
sequence dt, colors, ampm
integer mo, da, yr, hr, min, sec
   colors = {BLACK,WHITE}
   Display({4,02},colors,"Inteligencia Artificial")
   Display({5,02},colors,"Ingenieria de Sistemas")
   for i =  1 to 3 do
     Display({5,i+24},{BLACK,i+1},"I") -- trick
   end for
   Display({6,02},colors,"Alfredo Brand")
   Display({7,02},colors,"Profesor")
   Display({8,02},colors,"Ricardo Chavarriaga")

   dt = date() -- convert the date
   yr = dt[1] mo = dt[2] da = dt[3]
   hr = dt[4] min = dt[5] sec = dt[6]
   if compare(dt[4..6],{12,0,0}) = 1 then -- anyone see an error here?
    if hr > 12 then hr = hr - 12 end if
    ampm = "pm"
   else ampm = "am"
   end if

      position(1,1) -- display the days of the week
      for d = 1 to 7 do
          if d = dt[7] then
          text_color(BRIGHT_RED)
          bk_color(RED)
          else text_color(RED)
          bk_color(BLACK)
          end if
          printf(1," %3s ",{days[d]})
      end for

      Display({1,40},{BLUE,YELLOW},
         sprintf(" %s %d, %d ",{month[mo],da,yr+1900}))
         -- note: you cannot use "19%d",yr here! Why not?
      Display({2,40},{BLUE,WHITE},
         sprintf(" %02d:%02d %s",{hr,min,ampm}))

end procedure

This is only a first attempt. No doubt there are easier ways to do
some of this. Any takers?
And does anyone not know why the year must be displayed as shown
above?

Irv

new topic     » goto parent     » topic index » view message » categorize

7. Re: Perceptron in Euphoria

------=_NextPart_000_0042_01BE1BC4.12543100
        charset="iso-8859-1"


-----Mensaje original-----
De: Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL>
Para: EUPHORIA at LISTSERV.MUOHIO.EDU <EUPHORIA at LISTSERV.MUOHIO.EDU>
Fecha: domingo 29 de noviembre de 1998 8:42
Asunto: Re: Perceptron in Euphoria


>>my first contibution to this list.
>>If you think It, you can make it.
>>After several days of programming I finally got It,
>>enjoy it.
>>brand_01.e is the main program.
>
>
>Looks nice, but its all Spanish, what does it do ?

The perceptron is a program that learn concepts, i.e. it can learn to
respond with True (1) or False (0) for inputs we present to it, by
repeatedly "studying" examples presented to it.
The Perceptron is a single layer neural network whose weights and biases
could be trained to produce a correct target vector when presented with the
corresponding input vector. The training technique used is called the
perceptron learning rule. The perceptron generated great interest due to its
ability to generalize from its training vectors and work with randomly
distributed connections. Perceptrons are especially suited for simple
problems in pattern classification.

The perceptron calculates its output using the following equation:
                P * W + b > 0
where P is the input vector presented to the network, W is the vector of
weights and b is the bias.
The Learning Rule
The perceptron is trained to respond to each input vector with a
corresponding target output of either 0 or 1. The learning rule has been
proven to converge on a solution in finite time if a solution exists.
The learning rule can be summarized in the following two equations:


        For all i:

                W(i) = W(i) + [ T - A ] * P(i)

                b    = b + [ T - A ]

where W is the vector of weights, P is the input vector presented to the
network, T is the correct result that the neuron should have shown, A is the
actual output of the neuron, and b is the bias.

Training
Vectors from a training set are presented to the network one after another.
If the network's output is correct, no change is made. Otherwise, the
weights and biases are updated using the perceptron learning rule. An entire
pass through all of the input training vectors is called an epoch. When such
an entire pass of the training set has occured without error, training is
complete. At this time any input training vector may be presented to the
network and it will respond with the correct output vector. If a vector P
not in the training set is presented to the network, the network will tend
to exhibit generalization by responding with an output similar to target
vectors for input vectors close to the previously unseen input vector P.

Limitations
Perceptron networks have several limitations. First, the output values of a
perceptron can take on only one of two values (True or False). Second,
perceptrons can only classify linearly separable sets of vectors. If a
straight line or plane can be drawn to seperate the input vectors into their
correct categories, the input vectors are linearly separable and the
perceptron will find the solution. If the vectors are not linearly separable
learning will never reach a point where all vectors are classified properly.
The most famous example of the perceptron's inability to solve problems with
linearly nonseparable vectors is the boolean exclusive-or problem.


------=_NextPart_000_0042_01BE1BC4.12543100
        name="perceptron2.gif"

new topic     » goto parent     » topic index » view message » categorize

8. Re: Perceptron in Euphoria

-----Mensaje original-----
De: Irv Mullins <irv at ELLIJAY.COM>
Para: EUPHORIA at LISTSERV.MUOHIO.EDU <EUPHORIA at LISTSERV.MUOHIO.EDU>
Fecha: domingo 29 de noviembre de 1998 13:24
Asunto: Re: Perceptron in Euphoria


>On Sun, 29 Nov 1998 00:33:02 -0500, Alfredo Brand <abrand at ALUMINA.COM.CO>
wrote:
>
>>my first contibution to this list.
>>If you think It, you can make it.
>>After several days of programming I finally got It,
>>enjoy it.
>
>Congratulations! You tackled some difficult areas: numeric input,
>for example, and got them to work. No small feat.
>
>If I were using this in a programming class, I would use your
>code to discuss several ideas:
>
>1. Is there an easier and shorter way to write the date displays?
>2. Following up on Ralf's comment ("It's in Spanish!";), is there
>an easy way to internationalize this program?
>3. There is a lot of repetition of the tasks:
>   SetColors
>   SetPosition
>   puts(1,something)
>   Perhaps we could combine those into a one-liner?
>
>We can solve 1 and 2 with a single concept: The days never change.
>There are always seven. Day[2] is (in Euphoria) always Monday/Lunes.
>The months never change, month 1 is always January/Enero.
>They are - umm...constant.
>Why not put them into a list, and reference them by number?
>What's more, if we put the list at the top of our program, it will
>be easy for anyone to change the names of days and months into the
>language of their choice.
>
>Doing this will also simplify our logic quite a bit. See below.
>
>Problem 3 is even more easily solved, resulting in shorter code.
>See the Display() function below:
>
>-- Ingenieria de Sistemas III
>-- Inteligencia Artificial
>-- Profesor : Ricardo Chavarriaga
>-- Alfredo Brand
>-- albrand65 at hotmail.com
>-- brand
>-- Funciones
>--- with modifications by Irv Mullins
>
>constant month = {"Enero","Febrero","Marzo","Abril",
>                  "Mayo","Junio","Julio","Agosto",
>                  "Septiembre","Octubre","Noviembre","Diciembre"}
>
>constant days =  {"Dom","Lun","Mar","Mie","Jue","Vie","Sab"}
>
>global procedure Display(sequence coords, sequence colors, sequence text)
>   position(coords[1],coords[2])
>   text_color(colors[2])
>   bk_color(colors[1])
>   puts(1,text)
>end procedure
>
>global procedure fecha_hora()
>sequence dt, colors, ampm
>integer mo, da, yr, hr, min, sec
>   colors = {BLACK,WHITE}
>   Display({4,02},colors,"Inteligencia Artificial")
>   Display({5,02},colors,"Ingenieria de Sistemas")
>   for i =  1 to 3 do
>     Display({5,i+24},{BLACK,i+1},"I") -- trick
>   end for
>   Display({6,02},colors,"Alfredo Brand")
>   Display({7,02},colors,"Profesor")
>   Display({8,02},colors,"Ricardo Chavarriaga")
>
>   dt = date() -- convert the date
>   yr = dt[1] mo = dt[2] da = dt[3]
>   hr = dt[4] min = dt[5] sec = dt[6]
>   if compare(dt[4..6],{12,0,0}) = 1 then -- anyone see an error here?
>    if hr > 12 then hr = hr - 12 end if
>    ampm = "pm"
>   else ampm = "am"
>   end if
>
>      position(1,1) -- display the days of the week
>      for d = 1 to 7 do
>          if d = dt[7] then
>          text_color(BRIGHT_RED)
>          bk_color(RED)
>          else text_color(RED)
>          bk_color(BLACK)
>          end if
>          printf(1," %3s ",{days[d]})
>      end for
>
>      Display({1,40},{BLUE,YELLOW},
>         sprintf(" %s %d, %d ",{month[mo],da,yr+1900}))
>         -- note: you cannot use "19%d",yr here! Why not?
>      Display({2,40},{BLUE,WHITE},
>         sprintf(" %02d:%02d %s",{hr,min,ampm}))
>
>end procedure
>
>This is only a first attempt. No doubt there are easier ways to do
>some of this. Any takers?
>And does anyone not know why the year must be displayed as shown
>above?
>
>Irv
Thanks for checking the code, you made it short.
well job with the function
>global procedure Display(sequence coords, sequence colors, sequence text)
>         sprintf(" %s %d, %d ",{month[mo],da,yr+1900}))
about this  yr is two digits, that's why you plus 1900.
printf(1," %d, 19%d",{dt[3],dt[1]})
It has the same effect.
I made the changes you suggested to the code I'm sending.

new topic     » goto parent     » topic index » view message » categorize

9. Re: Perceptron in Euphoria

------=_NextPart_000_0019_01BE1BD6.9E926C60
        charset="iso-8859-1"


-----Mensaje original-----
De: Irv Mullins <irv at ELLIJAY.COM>
Para: EUPHORIA at LISTSERV.MUOHIO.EDU <EUPHORIA at LISTSERV.MUOHIO.EDU>
Fecha: domingo 29 de noviembre de 1998 13:24
Asunto: Re: Perceptron in Euphoria


>On Sun, 29 Nov 1998 00:33:02 -0500, Alfredo Brand <abrand at ALUMINA.COM.CO>
wrote:
>
>>my first contibution to this list.
>>If you think It, you can make it.
>>After several days of programming I finally got It,
>>enjoy it.
>
>Congratulations! You tackled some difficult areas: numeric input,
>for example, and got them to work. No small feat.
>
>If I were using this in a programming class, I would use your
>code to discuss several ideas:
>
>1. Is there an easier and shorter way to write the date displays?
>2. Following up on Ralf's comment ("It's in Spanish!";), is there
>an easy way to internationalize this program?
>3. There is a lot of repetition of the tasks:
>   SetColors
>   SetPosition
>   puts(1,something)
>   Perhaps we could combine those into a one-liner?
>
>We can solve 1 and 2 with a single concept: The days never change.
>There are always seven. Day[2] is (in Euphoria) always Monday/Lunes.
>The months never change, month 1 is always January/Enero.
>They are - umm...constant.
>Why not put them into a list, and reference them by number?
>What's more, if we put the list at the top of our program, it will
>be easy for anyone to change the names of days and months into the
>language of their choice.
>
>Doing this will also simplify our logic quite a bit. See below.
>
>Problem 3 is even more easily solved, resulting in shorter code.
>See the Display() function below:
>
>-- Ingenieria de Sistemas III
>-- Inteligencia Artificial
>-- Profesor : Ricardo Chavarriaga
>-- Alfredo Brand
>-- albrand65 at hotmail.com
>-- brand
>-- Funciones
>--- with modifications by Irv Mullins
>
>constant month = {"Enero","Febrero","Marzo","Abril",
>                  "Mayo","Junio","Julio","Agosto",
>                  "Septiembre","Octubre","Noviembre","Diciembre"}
>
>constant days =  {"Dom","Lun","Mar","Mie","Jue","Vie","Sab"}
>
>global procedure Display(sequence coords, sequence colors, sequence text)
>   position(coords[1],coords[2])
>   text_color(colors[2])
>   bk_color(colors[1])
>   puts(1,text)
>end procedure
>
>global procedure fecha_hora()
>sequence dt, colors, ampm
>integer mo, da, yr, hr, min, sec
>   colors = {BLACK,WHITE}
>   Display({4,02},colors,"Inteligencia Artificial")
>   Display({5,02},colors,"Ingenieria de Sistemas")
>   for i =  1 to 3 do
>     Display({5,i+24},{BLACK,i+1},"I") -- trick
>   end for
>   Display({6,02},colors,"Alfredo Brand")
>   Display({7,02},colors,"Profesor")
>   Display({8,02},colors,"Ricardo Chavarriaga")
>
>   dt = date() -- convert the date
>   yr = dt[1] mo = dt[2] da = dt[3]
>   hr = dt[4] min = dt[5] sec = dt[6]
>   if compare(dt[4..6],{12,0,0}) = 1 then -- anyone see an error here?
>    if hr > 12 then hr = hr - 12 end if
>    ampm = "pm"
>   else ampm = "am"
>   end if
>
>      position(1,1) -- display the days of the week
>      for d = 1 to 7 do
>          if d = dt[7] then
>          text_color(BRIGHT_RED)
>          bk_color(RED)
>          else text_color(RED)
>          bk_color(BLACK)
>          end if
>          printf(1," %3s ",{days[d]})
>      end for
>
>      Display({1,40},{BLUE,YELLOW},
>         sprintf(" %s %d, %d ",{month[mo],da,yr+1900}))
>         -- note: you cannot use "19%d",yr here! Why not?
>      Display({2,40},{BLUE,WHITE},
>         sprintf(" %02d:%02d %s",{hr,min,ampm}))
>
>end procedure
>
>This is only a first attempt. No doubt there are easier ways to do
>some of this. Any takers?
>And does anyone not know why the year must be displayed as shown
>above?
>
>Irv
Thanks for checking the code, you made it short.
well job with the function
>global procedure Display(sequence coords, sequence colors, sequence text)
>         sprintf(" %s %d, %d ",{month[mo],da,yr+1900}))
about this  yr is two digits, that's why you plus 1900.
printf(1," %d, 19%d",{dt[3],dt[1]})
It has the same effect.
I made the changes you suggested to the code I'm sending.



------=_NextPart_000_0019_01BE1BD6.9E926C60
        name="brand.e"
Content-Transfer-Encoding: quoted-printable

new topic     » goto parent     » topic index » view message » categorize

10. Re: Perceptron in Euphoria

EU>-----Mensaje original-----
EU>De: Irv Mullins <irv at ELLIJAY.COM>
EU>Para: EUPHORIA at LISTSERV.MUOHIO.EDU <EUPHORIA at LISTSERV.MUOHIO.EDU>
EU>Fecha: domingo 29 de noviembre de 1998 13:24
EU>Asunto: Re: Perceptron in Euphoria

>>         sprintf(" %s %d, %d ",{month[mo],da,yr+1900}))
>about this  yr is two digits, that's why you plus 1900.
printf(1," %d, 19%d",{dt[3],dt[1]}) -- Year 2000 bug!! In the year 2000,
it will display 19100.
>It has the same effect.
>I made the changes you suggested to the code I'm sending.

Jeffrey Fielding
JJProg at cyberbury.net
http://members.tripod.com/~JJProg/

new topic     » goto parent     » topic index » view message » categorize

11. Re: Perceptron in Euphoria

Alfredo Brand wrote:
*extreme snippage to produce a paragraph of coherence to a particular
 facet of the topic to discuss*
> The perceptron is a program that learn concepts, i.e. it can learn to
> respond with True (1) or False (0) for inputs we present to it, by
> repeatedly "studying" examples presented to it.
> The perceptron is trained to respond to each input vector with a
> corresponding target output of either 0 or 1. The learning rule has been
> proven to converge on a solution in finite time if a solution exists.
> Perceptron networks have several limitations. First, the output values of a
> perceptron can take on only one of two values (True or False). Second,
> perceptrons can only classify linearly separable sets of vectors.
> If the vectors are not linearly separable learning will never reach
> a point where all vectors are classified properly.
I wrote (on main EU contributions page) a library that i believe would
go nicely with this, if you are interested.  It would extend your
perceptron to the point that the limitations you describe would vanish.
Its a library for fuzzy logic, and that would give it the ability
to provide weighted answers for your weighted inputs that are
not linearly seperable vectors.

In other words, we can combine the ability to provide *meaningful*
answers to approximate questions with the ability to learn from
the questions, the answers, and the bias of the mistakes.

The fuzzy logic library can (especially if i could find the time
to reapply some speed tweaking tricks I have picked up) resolve
the vectors and responses in swift abandon, perhaps even faster
than resolving to a boolean answer (floating point co-proc).

You're welcome to snag the library and apply it however you
wish, and I believe the examples and documentation within it
will guide you in your adapting the fuzzy logic library as
a front/back end to your learning machine.

The result of that endeavor, especially being coded in nearly
pure or fully pure euphoria could be quite a feather in EU's cap.

Also, another frame of reference, although I am sorry to say
not a fully working prototype, was an experiment in AI by
... I want to say michael sabal... is that right?

The code itself, however, the algorithms contained within, could be
useful to you as well.

--Hawke'

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu