From gtrajkovski at towson.edu Sun Apr 1 13:46:18 2007 From: gtrajkovski at towson.edu (Goran Trajkovski) Date: Sun Apr 1 13:47:20 2007 Subject: [Pyro-users] 2007 AAAI Fall Symposium: EMERGENT AGENTS AND SOCIALITIES: SOCIAL AND ORGANIZATIONAL ASPECTS OF INTELLIGENCE Message-ID: Apologies for cross-posting. ============================ 2007 FALL AAAI SYMPOSIUM EMERGENT AGENTS AND SOCIALITIES: SOCIAL AND ORGANIZATIONAL ASPECTS OF INTELLIGENCE Washington, DC * November 8?11, 2007 http://pages.towson.edu/gtrajkov/FSS07 http://www.aaai.org/Symposia/Fall/fss07.php The study of agency and multiagent systems crosses disciplinary boundaries by focusing on society, culture and communication as emerging from interactions of autonomous agents. Poised at the intersections of AI, cybernetics, sociology, semiotics and anthropology, this strand of multiagent systems research enables a powerful perspective illuminating not only how we live and learn, but also, through focusing on emergence, how we anticipate the future. This symposium focuses on second order emergence. The constituents in a system are aware of an emergent phenomenon and adapt accordingly. New agents emerge as human and nonhuman agents interact, hinting at new qualities that may enable us to push the use of technology to its maximum capacity, and in the process imbricating both the observer and the observed in successive cycles of emergence. In most studies to date, the non-human agent is subordinate to the human agents. Without the human input (and in the absence of another obstacle), the non-human agent goes nowhere. On the other hand, if we look at these interactions as emergent socialities, the non-human agent has a pivotal role?that of amanuensis for all subsequent social interaction. That is, without the non-human agent, there can be no emergent social interaction to begin with. Theories of emergence suggest a dynamic, multi-directionality of perception organized socially as multi-agent systems. What is less studied is the messiness of those multi-agent systems themselves, the way they involve complex ?translations? between human and non-human agents, or ?transcodings? between different representational and discursive modalities. The symposium proposes to delve into the messiness of the social, approaching it from multiple perspectives simultaneously?computational, sociological, linguistic and cybernetic?in such a way as to stimulate our own sites of emergence at the borders of these disciplines. Focal areas: 1) Concepts, definitions and theories 2) Cognitive aspects of emergence in interactions 3) Tools and methods for studying emergent phenomena 4) Simulations and experiments in agency, interaction, and emergence 5) Emergent of society, and societal phenomena 6) Organization and societies, interaction and communication ORGANIZING COMMITTEE Goran Trajkovski (co-chair), Towson University, USA Samuel Collins (co-chair), Towson University, USA Laszlo Gulyas, AITIA International Inc., Hungary Michael North, Argonne National Laboratories, USA Keith Sawyer, Washington University in St Louis, MO, USA Richard Schilling, Cognition Group Inc, USA Georgi Stojanov, American University in Paris, France Please submit all questions to Goran Trajkovski, gtrajkovski@towson.edu (http://pages.towson.edu/gtrajkov) Submission details Those interested in participating in this symposium should send either a full paper (8 pages maximum) or a position paper (1-2 pages) in AAAI format in PDF to interaction.emergence@gmail.com. The abstracts are due by May 1, 2007. Acceptance/rejection notices will be mailed on or about May 21, 2007. Full versions of papers will be expected by July 1st, 2007, and, if accepted, the camera-ready version of the paper will be due by September 1, 2007. Limited financial support is available for students-participants of this symposium. -- Cordially yours, Goran Trajkovski http://pages.towson.edu/gtrajkov From quadpl_03 at yahoo.com Mon Apr 2 09:48:42 2007 From: quadpl_03 at yahoo.com (Daniel Brian Myers) Date: Mon Apr 2 09:48:43 2007 Subject: [Pyro-users] can't control Intellibrain-bot from within pyrobot Message-ID: <868288.32632.qm@web60816.mail.yahoo.com> The handshaking was switched off in the software, but I forgot to switch off the dip switch on the actual AIRcable adaptor. After switching that off, the robot works. I only have one more question: this is the first time I ever messed with Python, so can anyone tell me how the Python code is interacting with the Java class on the robot? Thanks, -Daniel Daniel Brian Myers wrote: James, I do get a clear screen after starting the program, and I am fairly sure that the bluetooth pairing went okay, however I neglected to make sure that hardware handshaking is disabled, so that may be my problem. Unfortunately, I won't get a chance to look into this until Monday, so I'll post back what I find out then. Thanks, - Daniel James Snow wrote:Daniel, After you load the file onto the IBB what kind of prompt are you getting after you push the start button. You should be getting a clear screen. Are you sure that the bluetooth pairing went okay? We found that the IBB doesn't support hardware handshaking, if you can't disable it then you need to "spoof" it. The diretions are on the wiki. If that doesn't help could you tell us exactly which steps you are taking? - James --------------------------------- No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started. --------------------------------- Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20070402/049a6775/attachment.htm From dblank at brynmawr.edu Mon Apr 2 13:50:21 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Mon Apr 2 13:51:24 2007 Subject: [Pyro-users] Using the fiducial sensor with the Stage Simulator In-Reply-To: <460426EC.1090404@seas.upenn.edu> References: <460426EC.1090404@seas.upenn.edu> Message-ID: <4611425D.7020402@brynmawr.edu> Nick, I haven't looked at the fiducial interface from Player much, but here are some hints. You can get to the first internal Player Fiducial Proxy object for a robot here: robot.fiducial[0]._dev From here, one can: dir(robot.fiducial[0]._dev) and work your way through the objects. I see that robot.fiducial[0]._dev.fiducials is a list. Looking at the playerc.py and trying some things, I can: for item in robot.fiducial[0]._dev.fiducials: print item.pose.ppitch, item.pose.proll, item.pose.px, print item.pose.py, item.pose.pyaw, item.pose.pz print item.upose.ppitch, item.upose.proll, item.upose.px, print item.upose.py, item.upose.pyaw, item.upose.pz # item.id.acquire(), item.id.append(), item.id.next() # item.id.disown(), item.id.own() I'm not sure how this works, but if you figure it out we can add some code in the player robot class to make this useful and easy. -Doug Nick Vander Valk wrote: > Hi, > > I am currently running off of the pyrobot-5.0.0.iso image and I am > trying to set up a stage simulation using pyrobot. I am having problems > using the fiducial sensor on a simple robot that I created. I tried > using the included everything.world and everything.cfg as a model for > this sensor. When I load the server, all of the devices seem to be > created without a problem. The issue arises when I attempt to load the > robot. I use the supplied Player6665.py script and it loads the > simulation, position, and laser, but does not seem to load the fiducial > sensor. So, I looked through the Player.py script and it seems that the > fiducial sensor is never started by the PlayerRobot() class > initialization script. I then tried to manually start the sensor by > typing "robot.startDevice('fiducial')" and I get the message: > > > > After doing this, if I select View->fiducial data, I can see a green > line pointing at the objects and each object shows the number returned > by the fiducial sensor. My problem now comes when trying to retrieve > this information with the pyrobot interface. I first tried using the > object viewer to see the fiducial device. Within that tree (fiducial > devices->fiducial[0]->List[0-31]), I get the following attribute error > when trying to view the SensorValue: > > " 'NoneType' object has no attribute '__dict___' " > > The only thread already in the mailing list that I came across this post: > > > http://emergent.brynmawr.edu/pipermail/pyro-users/2006-February/000261.html > > When typing " print self.robot.fiducial[0].getDeviceData() " in the > command window, I get a list of outputs that look like this: > > 'player_ficuial_item_t *' at 0x835e6c8> > > I am not very familiar with python, but I am assuming this is just > telling me the data type of the object that is stored there. The end > result I am looking for is to extract the range and bearing of the > detected object from the fiducial sensor. I also need to know the > fiducial id of the object that is being detected so I can discriminate > among many landmark objects. If anyone can help me to set up and > extract this information from the fiducial sensor, I would really > appreciate it. Thanks in advance for your time. > > Regards, > Nick > > Here are the sections of my world files that I created: > > simple.cfg: > > driver > ( name "stage" > provides ["7000:simulation:0" ] > plugin "libstageplugin" > # load the named file into the simulator > worldfile "simple.world" ) > driver > ( > name "stage" > provides ["map:0"] > model "border" > ) > driver > ( > name "stage" > provides ["position2d:0" "laser:0" "fiducial:0"] > model "robot1" > ) > > simple.world: > > rect_robot > ( > name "robot1" > color "red" > pose [-6.5 -6.5 0] > sick_laser( ) > fiducialfinder( range_max 8 range_max_id 5 ) > ) > > > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > From quadpl_03 at yahoo.com Mon Apr 2 16:22:45 2007 From: quadpl_03 at yahoo.com (Daniel Brian Myers) Date: Mon Apr 2 16:22:46 2007 Subject: [Pyro-users] can't control Intellibrain-bot from within pyrobot Message-ID: <966592.77622.qm@web60823.mail.yahoo.com> Nevermind that last question, I was able to figure it out after taking a closer look at the code. It's using the switch statement at the bottom of the IBB.java file to read in a single letter code followed by two values sent by the Python code. The method to use is determined by the single letter code and the two values are passed to it as parameters. Thanks for your help, - Daniel Daniel Brian Myers wrote:can anyone tell me how the Python code is interacting with the Java class on the robot? Thanks, -Daniel --------------------------------- Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20070402/289f31fc/attachment.htm From snow91 at potsdam.edu Tue Apr 3 09:24:39 2007 From: snow91 at potsdam.edu (James Snow) Date: Tue Apr 3 09:24:43 2007 Subject: [Pyro-users] Re: Pyro-users Digest, Vol 39, Issue 2 In-Reply-To: <200704021600.l32G03dS002752@emergent.brynmawr.edu> References: <200704021600.l32G03dS002752@emergent.brynmawr.edu> Message-ID: <49343.72.230.68.188.1175606679.squirrel@bearmail.potsdam.edu> Python/Pyro sends a string to the IBB like "D(0.5,0.5)"; the IBB grabs/parses the 1st character from the input string. Dependent on that character the IBB does a specific action. In this case it would be move. Then the two values inside of the parenthesis are used within the specified function. In this case they would be (translate,rotate). Hope this helps you understand. - James > Daniel Brian Myers wrote: > The handshaking was switched off in the software, but I forgot to > switch off the dip switch on the actual AIRcable adaptor. After > switching that off, the robot works. I only have one more question: > this is the first time I ever messed with Python, so can anyone tell > me how the Python code is interacting with the Java class on the > robot? > > Thanks, > -Daniel > Daniel Brian Myers wrote: James, > > I do get a clear screen after starting the program, and I am fairly > sure that the bluetooth pairing went okay, however I neglected to > make sure that hardware handshaking is disabled, so that may > be my problem. Unfortunately, I won't get a chance to look into > this until Monday, so I'll post back what I find out then. > Thanks, > > - Daniel > > James Snow wrote:Daniel, > After you load the file onto the IBB what kind of prompt are you > getting after you push the start button. You should be getting a > clear screen. Are you sure that the bluetooth pairing went okay? > We found that the IBB doesn't support hardware handshaking, if > you can't disable it then you need to "spoof" it. The diretions are > on the wiki. If that doesn't help could you tell us exactly which > steps you are taking? > - James > From bthom at cs.hmc.edu Tue Apr 3 13:02:21 2007 From: bthom at cs.hmc.edu (belinda thom) Date: Tue Apr 3 13:02:20 2007 Subject: [Pyro-users] conx questions Message-ID: <3379C074-57A2-4367-9767-E21D01BDCAD8@cs.hmc.edu> Hi, I've just finished looking at: http://emergent.brynmawr.edu/emergent/ Conx_20Implementation_20Details#preview where I was hoping to find insight into how to use k-fold cross validation. I did find: This class uses the simpliest form of cross validation, called the holdout method. This method divides the data into two sets: the training data, and the testing data. There are other more complex cross validation methods, including k-fold and leave-one-out. But after searching thru conx for "cross" I found nothing that appeared related to k-fold usage. In case this is useful to you, I did find a comment that seems truncated (the last sentence appears to be a fragment that makes no sense and should be removed). def setSweepReportRate(self, value): """ Sets self.sweepReportRate to value. sweep() will report when epoch % sweepReportRate == 0. there is a cross validation data set. """ Advice on where to find info for using k-fold w/conx graciously appreciated. Thx, --b From dblank at brynmawr.edu Tue Apr 3 22:06:41 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Tue Apr 3 22:06:42 2007 Subject: [Pyro-users] conx questions In-Reply-To: <3379C074-57A2-4367-9767-E21D01BDCAD8@cs.hmc.edu> References: <3379C074-57A2-4367-9767-E21D01BDCAD8@cs.hmc.edu> Message-ID: <23839.69.139.80.254.1175652401.squirrel@webmail.brynmawr.edu> On Tue, April 3, 2007 1:02 pm, belinda thom said: > Hi, > > I've just finished looking at: > > http://emergent.brynmawr.edu/emergent/ > Conx_20Implementation_20Details#preview > > where I was hoping to find insight into how to use k-fold cross > validation. I did find: > > This class uses the simpliest form of cross validation, called the > holdout method. This method divides the data into two sets: the > training data, and the testing data. There are other more complex > cross validation methods, including k-fold and leave-one-out. Hi Belinda, That last sentence should probably be: "More complex cross validation methods exist (such as k-fold and leave-one-out); however, conx does not implement those." Patches implementing more sophisticated validation methods gladly accepted :) -Doug > But after searching thru conx for "cross" I found nothing that > appeared related to k-fold usage. In case this is useful to you, I > did find a comment that seems truncated (the last sentence appears to > be a fragment that makes no sense and should be removed). > > def setSweepReportRate(self, value): > """ > Sets self.sweepReportRate to value. sweep() will report > when epoch % sweepReportRate == 0. there is a cross > validation data set. > """ > > Advice on where to find info for using k-fold w/conx graciously > appreciated. > > Thx, > > --b > > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 6501 From edzela at yahoo.com Thu Apr 5 07:59:43 2007 From: edzela at yahoo.com (wester zela) Date: Thu Apr 5 07:59:45 2007 Subject: [Pyro-users] sine/cosine functions Message-ID: <293337.72026.qm@web39705.mail.mud.yahoo.com> Hi I'm new using pyrobot. I have to use sine/cosine functions in Pyrobot. How can I use it?. Is it implement in Pyrobot (With Phyton)? Regards Wester ____________________________________________________________________________________ Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains. http://farechase.yahoo.com/promo-generic-14795097 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20070405/60826b12/attachment.htm From dblank at brynmawr.edu Thu Apr 5 08:21:11 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Thu Apr 5 08:21:14 2007 Subject: [Pyro-users] sine/cosine functions In-Reply-To: <293337.72026.qm@web39705.mail.mud.yahoo.com> References: <293337.72026.qm@web39705.mail.mud.yahoo.com> Message-ID: <2414.208.187.103.34.1175775671.squirrel@webmail.brynmawr.edu> On Thu, April 5, 2007 7:59 am, wester zela said: > Hi > I'm new using pyrobot. I have to use sine/cosine functions in Pyrobot. How > can I use it?. Is it implement in Pyrobot (With Phyton)? Webster, It sounds like you are asking a Python question. To use any math function, you need to: import math x = math.sin(1) y = math.cos(0) For more information see http://python.org/ -Doug > Regards > Wester > > > > ____________________________________________________________________________________ > Finding fabulous fares is fun. > Let Yahoo! FareChase search your favorite travel sites to find flight and > hotel bargains. > http://farechase.yahoo.com/promo-generic-14795097_______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 6501 From bthom at cs.hmc.edu Thu Apr 5 13:09:41 2007 From: bthom at cs.hmc.edu (belinda thom) Date: Thu Apr 5 13:09:41 2007 Subject: [Pyro-users] sine/cosine functions In-Reply-To: <293337.72026.qm@web39705.mail.mud.yahoo.com> References: <293337.72026.qm@web39705.mail.mud.yahoo.com> Message-ID: <6FF3818C-AF42-4DB8-A0C2-0993C25FDCBD@cs.hmc.edu> You can use the stuff Python provides by doing: import math math.sin(...) For more info on a particular math function, do help(math.sin). HTH, --b On Apr 5, 2007, at 4:59 AM, wester zela wrote: > Hi > > I'm new using pyrobot. I have to use sine/cosine functions in > Pyrobot. How can I use it?. Is it implement in Pyrobot (With Phyton)? > > > Regards > Wester > > Don't pick lemons. > See all the new 2007 cars at Yahoo! Autos. > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users From dblank at brynmawr.edu Fri Apr 6 14:21:03 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Fri Apr 6 14:21:03 2007 Subject: [Pyro-users] Porting player make system to x86_64 Message-ID: <4559.68.58.43.61.1175883663.squirrel@webmail.brynmawr.edu> ---------------------------- Original Message ---------------------------- Subject: Porting player make system to x86_64 From: "Julio Martinez" Date: Fri, April 6, 2007 1:12 pm To: dblank@brynmawr.edu -------------------------------------------------------------------------- I am currently porting pyrobot to my gentoo amd64 system. I already have the working ebuilds for the latest versions of gazebo, player, stage and all of their dependencies. The problem is that i'm running in native 64 bit mode and that requires that all my shared code be built using the -fPIC flag for the linking process. As far as i can see the build system as of player-4.9.3 does not support this and from what i can tell putting it in cleanly would require to edit all the files in the build system. Is there a more efficient way of doing this or has someone else done it before? If not it's ok I'm willing to do the modifications. Btw this is some great software and thanks for making available to everybody. -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 6501 From doug.orr at gmail.com Thu Apr 12 15:44:01 2007 From: doug.orr at gmail.com (Doug Orr) Date: Thu Apr 12 15:44:05 2007 Subject: [Pyro-users] artmap fuzzy "and" question Message-ID: <7669b64f0704121244m416655a4h12c3cefcf6c4d79b@mail.gmail.com> Hey, I have a question for someone familiar with the fuzzy artmap algorithm implemented in python in the "brain" area. It seems in the classification that they're using fuzzy "and" to calculate how close the input vectors are to the weight vectors that they build up in training. There are two places where this happens -- one where they're getting the "activation levels" and one where they are calculating the match value. The activation levels are only used to order the categories so that (presumably) the most likely categories get checked first. Then, the match is calculated to see if it exceeds the vigilance level to signal a match. The thing that's concerning is that fuzzy "and" isn't symmetric across these vectors. a ^ b != b ^ a. And, one of the calculations is input ^ weight and the other is weight ^ input. Does anyone know what value is derived by the different orientations of the equation? (I'm asking because of a low level optimization I could make if the comparisons were the same... I'm assuming they are not for some good reason, but I'm not intuiting what that reason might be...) Doug -------------- next part -------------- An HTML attachment was scrubbed... URL: http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20070412/2c20b998/attachment.htm From edzela at yahoo.com Sat Apr 14 14:20:26 2007 From: edzela at yahoo.com (wester zela) Date: Sat Apr 14 14:20:29 2007 Subject: [Pyro-users] GAFindBlobNNProgram.py error Message-ID: <742942.51849.qm@web39705.mail.mud.yahoo.com> Hi all I was runing this program I have this error. please can you tell me why?. this is an example of GA programs and NN. or What I have to check. python GAFindBlobNNProgram.py Conx, version 1.234 (regular speed) Traceback (most recent call last): File "GAFindBlobNNProgram.py", line 105, in ? ga = chaseGA(10,'try') File "GAFindBlobNNProgram.py", line 24, in __init__ worldfile = 'chase.world') File "/usr/lib/python2.4/site-packages/PIL/__init__.py", line 51, in __init__ File "/usr/lib/python2.4/site-packages/PIL/__init__.py", line 146, in loadSimulator AttributeError: 'NoneType' object has no attribute 'lower' Thanks Wester __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20070414/3bd78b70/attachment.htm From dblank at brynmawr.edu Sat Apr 14 15:06:42 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Sat Apr 14 15:06:42 2007 Subject: [Pyro-users] GAFindBlobNNProgram.py error In-Reply-To: <742942.51849.qm@web39705.mail.mud.yahoo.com> References: <742942.51849.qm@web39705.mail.mud.yahoo.com> Message-ID: <55844.76.98.12.59.1176577602.squirrel@webmail.brynmawr.edu> Wester, There was an issues with Pyro5, so if you are running Pyro5, then you need to get the latest version from CVS. (Pyro5 is nearing completion). For more details on using our CVS, see: http://pyrorobotics.org/?page=PyroDeveloperCVS It seems to work for me in Pyro5 (after a couple of fixes). If you are running an earlier version, you may have to provided more information, such as OS and Pyro versions and how you installed Pyro. -Doug On Sat, April 14, 2007 2:20 pm, wester zela said: > Hi all > I was runing this program I have this error. please can you tell me why?. > this is an example of GA programs and NN. or What I have to check. > > python GAFindBlobNNProgram.py > Conx, version 1.234 (regular speed) > Traceback (most recent call last): > File "GAFindBlobNNProgram.py", line 105, in ? > ga = chaseGA(10,'try') > File "GAFindBlobNNProgram.py", line 24, in __init__ > worldfile = 'chase.world') > File "/usr/lib/python2.4/site-packages/PIL/__init__.py", line 51, in > __init__ > File "/usr/lib/python2.4/site-packages/PIL/__init__.py", line 146, in > loadSimulator > AttributeError: 'NoneType' object has no attribute 'lower' > > > Thanks > Wester > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 6501 From kay at elvis.rowan.edu Tue Apr 17 11:06:47 2007 From: kay at elvis.rowan.edu (Jennifer Kay) Date: Tue Apr 17 11:08:13 2007 Subject: [Pyro-users] Simulate a robot with a pen? Message-ID: <4624E287.2030203@elvis.rowan.edu> Is there any type of simulated robot in Pyro that can drop a pen to draw the path it has traveled? Thanks, -- Jennie -- Jennifer Kay, Chair Rowan University email: kay@elvis.rowan.edu Computer Science Department voice: 856-256-4806 201 Mullica Hill Road fax: 856-256-4741 Glassboro, NJ 08028 web: http://www.rowan.edu/~kay/ From dblank at brynmawr.edu Tue Apr 17 11:27:17 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Tue Apr 17 11:27:50 2007 Subject: [Pyro-users] Simulate a robot with a pen? In-Reply-To: <4624E287.2030203@elvis.rowan.edu> References: <4624E287.2030203@elvis.rowan.edu> Message-ID: <4624E755.2010507@brynmawr.edu> Yes. You can see a simulated robot's path using the Pyrobot Simulator. You can turn on the path from the menu: View -> Path (which is a toggle on/off). -Doug Jennifer Kay wrote: > Is there any type of simulated robot in Pyro that can drop a pen to draw > the path it has traveled? > > Thanks, > > -- Jennie > From bthom at cs.hmc.edu Tue Apr 17 14:54:24 2007 From: bthom at cs.hmc.edu (belinda thom) Date: Tue Apr 17 14:54:22 2007 Subject: [Pyro-users] conx question Message-ID: Hi, FYI: I'm using conx version 1.233 (regular speed) and I noticed that I am not able to use the getEpsilon() method that is discussed on http://pyrorobotics.org/?page=Conx_20Implementation_20Details (In fact, there, network.getEpsilon() is provided as an example.) If I do a dir on a network, setEpsilon and epsilon are listed, but not getEpsilon. I could use network.epsilon, but presumably this is not what the authors intended :-). --b From bthom at cs.hmc.edu Tue Apr 17 15:08:10 2007 From: bthom at cs.hmc.edu (belinda thom) Date: Tue Apr 17 15:08:10 2007 Subject: [Pyro-users] recording weight updates in conx Message-ID: Hi, Is there an easy way to record the changes made to weights during train, or would I have to basically rewrite that procedure to do what I want? I realize in non-toy problems, you'd probably not want to do this, but for simple examples (like And or fig 4.7 in Tom Mitchell's Machine Learning book) being able to access the weights as they change over time---e.g. to plot them---can be a useful pedagogical tool. Please advise, Thanks! --b From bthom at cs.hmc.edu Tue Apr 17 15:38:10 2007 From: bthom at cs.hmc.edu (belinda thom) Date: Tue Apr 17 15:38:14 2007 Subject: [Pyro-users] recording weight updates in conx In-Reply-To: <46251E9F.7020405@slc.edu> References: <46251E9F.7020405@slc.edu> Message-ID: Hi Jim, Great to hear from you. Thanks for the advice. Seems we've been doing a lot of similar work of late! (I wrote my own perceptron and unthresholded unit classes recently and had the students use them to produce various demos; the best part from a pedagogical point of view was the 3-d plots it generated; you can see http://millscs.jot.com/WikiHome/AIWeek13 and http://millscs.jot.com/ WikiHome/AIWeek12 for more if your interested.) I used matplotlib (an old version, whose 3d plot routines were problematic), but have generally been happy with that interface (it produces high quality graphs and shares some of the benefits that Matlab has in this regard), so weight space trajectories during learning, as well as how output values changed during learning, were easy to construct and seemed to facilitate student learning. I MAY have found a hack for doing what I want in the conx realm that requires no change to train. (My students haven't had calculus, so the NN derivation is out of scope, as is having them implement a multi-layer sigmoid-based learning alg). Here's my current thinking, which is motivated by perusing the conx train method: 1) make the crossvalidation set be identical to the training set 2) set the savenetworkfile flag that's used when crossvalidation is set weights of the successive networks can then presumably be retrieved from this file. I'll report back if I can actually get this hack to work. --b On Apr 17, 2007, at 12:23 PM, Jim Marshall wrote: > Hi Belinda, > > I think you would need to rewrite the train method to record the > weights. However, I just had my class do a simpler version of this > exercise for a homework assignment, using gnuplot and a basic > perceptron (implemented in pure Python, not Conx). The link to the > assignment is here: > > http://science.slc.edu/~jmarshall/courses/2007/spring/robotics/ > assignments/a05/ > > In addition, I'll attach the completed code if you want to try it > out. Hope this helps. > -jim > > > --------------------------- > Jim Marshall > Computer Science Department > Sarah Lawrence College > Bronxville, New York > > > belinda thom wrote: >> Hi, >> Is there an easy way to record the changes made to weights during >> train, or would I have to basically rewrite that procedure to do >> what I want? I realize in non-toy problems, you'd probably not >> want to do this, but for simple examples (like And or fig 4.7 in >> Tom Mitchell's Machine Learning book) being able to access the >> weights as they change over time---e.g. to plot them---can be a >> useful pedagogical tool. >> Please advise, >> Thanks! >> --b >> _______________________________________________ >> Pyro-users mailing list >> Pyro-users@pyrorobotics.org >> http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > import random, string > > def dotProduct(a, b): > sum = 0.0 > for i in range(len(a)): > sum = sum + a[i] * b[i] > return sum > > def pretty(values): > return string.join(['%.3f' % v for v in values]) > > #--------------------------------------------------------------------- > ----------- > > class Unit: > > def __init__(self, activation=0.0): > self.activation = activation > self.incomingConnections = [] > self.outgoingConnections = [] > > def update(self): > activations = [c.fromUnit.activation for c in > self.incomingConnections] > weights = [c.weight for c in self.incomingConnections] > netActivation = dotProduct(activations, weights) > self.activation = self.stepFunction(netActivation) > > def stepFunction(self, x): > if x > 0: > return 1 > else: > return 0 > > #--------------------------------------------------------------------- > ----------- > > class Connection: > > def __init__(self, fromUnit, toUnit): > self.fromUnit = fromUnit > self.toUnit = toUnit > self.randomize() > > def randomize(self): > self.weight = random.uniform(-0.1, +0.1) > > #--------------------------------------------------------------------- > ----------- > > class SimplePerceptron: > > def __init__(self, numInputs): > # create the units > self.outputUnit = Unit() > self.inputLayer = [Unit() for k in range(numInputs)] > # wire up the network > self.allConnections = [] > for unit in self.inputLayer: > self.connect(unit, self.outputUnit) > # connect the bias unit > biasUnit = Unit(1.0) > self.connect(biasUnit, self.outputUnit) > self.learningRate = 0.1 > > def connect(self, fromUnit, toUnit): > c = Connection(fromUnit, toUnit) > fromUnit.outgoingConnections.append(c) > toUnit.incomingConnections.append(c) > self.allConnections.append(c) > > def setWeights(self, newWeights): > assert len(newWeights) == len(self.allConnections), 'wrong > number of weights' > for (c, w) in zip(self.allConnections, newWeights): > c.weight = w > > def initialize(self): > for c in self.allConnections: > c.randomize() > print 'weights randomized' > > def propagate(self, pattern): > assert len(pattern) == len(self.inputLayer), 'wrong pattern > size' > for (inputUnit, value) in zip(self.inputLayer, pattern): > assert 0 <= value <= 1, 'invalid pattern value %g' % value > inputUnit.activation = value > self.outputUnit.update() > return self.outputUnit.activation > > def test(self): > print 'weights =', pretty([c.weight for c in > self.allConnections]) > for pattern in self.inputs: > output = self.propagate(pattern) > print 'output on %s = %d' % (pattern, output) > print > > def computeError(self): > error = 0.0 > correct = 0 > for (pattern, target) in zip(self.inputs, self.targets): > output = self.propagate(pattern) > error = error + (target - output) ** 2 > if output == target: > correct = correct + 1 > total = len(self.inputs) > score = 100.0 * correct / total > return (correct, total, score, error) > > # perceptron learning rule > def teach(self, pattern, target): > output = self.propagate(pattern) > self.outputUnit.error = target - output > for c in self.allConnections: > increment = self.learningRate * c.toUnit.error * > c.fromUnit.activation > c.weight = c.weight + increment > > def teachDataset(self): > assert len(self.inputs) > 0, 'no training data' > dataset = zip(self.inputs, self.targets) > random.shuffle(dataset) > for (pattern, target) in dataset: > #print ' teaching %s -> %s' % (pattern, target) > self.teach(pattern, target) > > # changed > def train(self, cycles=1000): > assert len(self.inputs) > 0, 'no training data' > (correct, total, score, error) = self.computeError() > print 'Epoch # 0: TSS error %7.4f, %d/%d correct (%.1f% > %)' % \ > (error, correct, total, score) > self.learningRate = 0.001 > file = open('pathway.dat', mode='w') > for c in self.allConnections: > file.write('%12g ' % c.weight) > file.write('\n') > for t in range(1, cycles+1): > self.teachDataset() > (correct, total, score, error) = self.computeError() > print 'Epoch #%4d: TSS error %7.4f, %d/%d correct (%.1f% > %)' % \ > (t, error, correct, total, score) > for c in self.allConnections: > file.write('%12g ' % c.weight) > file.write('\n') > if correct == total: > print 'All patterns learned' > break > file.close() > > #--------------------------------------------------------------------- > ----------- > > # part 1 > n = SimplePerceptron(2) > n.inputs = [[0, 0], [0, 1], [1, 0], [1, 1]] > n.targets = [0, 0, 0, 1] # AND function > > # to see training pathway, do this: > # >>> n.train() > # gnuplot> set style data linespoints > # gnuplot splot 'pathway.dat' pt 7 > > # part 2 > carry = SimplePerceptron(3) > carry.inputs = [[0, 0, 0], > [0, 0, 1], > [0, 1, 0], > [0, 1, 1], > [1, 0, 0], > [1, 0, 1], > [1, 1, 0], > [1, 1, 1]] > carry.targets = [0, 0, 0, 1, 0, 1, 1, 1] > > sum = SimplePerceptron(3) > sum.inputs = carry.inputs > sum.targets = [0, 1, 1, 0, 1, 0, 0, 1] From jmarshall at slc.edu Tue Apr 17 15:23:11 2007 From: jmarshall at slc.edu (Jim Marshall) Date: Tue Apr 17 16:48:58 2007 Subject: [Pyro-users] recording weight updates in conx In-Reply-To: References: Message-ID: <46251E9F.7020405@slc.edu> Hi Belinda, I think you would need to rewrite the train method to record the weights. However, I just had my class do a simpler version of this exercise for a homework assignment, using gnuplot and a basic perceptron (implemented in pure Python, not Conx). The link to the assignment is here: http://science.slc.edu/~jmarshall/courses/2007/spring/robotics/assignments/a05/ In addition, I'll attach the completed code if you want to try it out. Hope this helps. -jim --------------------------- Jim Marshall Computer Science Department Sarah Lawrence College Bronxville, New York belinda thom wrote: > Hi, > > Is there an easy way to record the changes made to weights during > train, or would I have to basically rewrite that procedure to do what I > want? I realize in non-toy problems, you'd probably not want to do > this, but for simple examples (like And or fig 4.7 in Tom Mitchell's > Machine Learning book) being able to access the weights as they change > over time---e.g. to plot them---can be a useful pedagogical tool. > > Please advise, > > Thanks! > > --b > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users -------------- next part -------------- A non-text attachment was scrubbed... Name: simple-perceptron.py Type: text/x-python Size: 5605 bytes Desc: not available Url : http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20070417/5cae9d5d/simple-perceptron.py From edzela at yahoo.com Tue Apr 17 18:37:29 2007 From: edzela at yahoo.com (wester zela) Date: Tue Apr 17 18:37:33 2007 Subject: [Pyro-users] Set the robot to the original position Message-ID: <362494.16776.qm@web39705.mail.mud.yahoo.com> Hi all I'm training the NN that I'm implementing but I need to set the robot to the original position with the original orientation. I was using the command SetPose but is not working. any idea?, Which command I have to use?. Thanks in advance Wester __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20070417/18c8f02b/attachment.htm From dblank at brynmawr.edu Wed Apr 18 14:50:41 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Wed Apr 18 14:51:01 2007 Subject: [Pyro-users] Set the robot to the original position In-Reply-To: <362494.16776.qm@web39705.mail.mud.yahoo.com> References: <362494.16776.qm@web39705.mail.mud.yahoo.com> Message-ID: <46266881.4050607@brynmawr.edu> Wester, You should give more details when you run into a problem. For example, you should say exactly what you are doing, and explain what you mean when you say it "is not working"? Does it give an error message? If so, what is it? Or does it just not move the robot? What robot/simulator are you using? This works for me: pyrobot -r Player6665 -s StageSimulator -w everything.cfg -e "robot.simulation[0].setPose('robot1', 0, 0, 1)" Hope that helps! -Doug wester zela wrote: > Hi all > I'm training the NN that I'm implementing but I need to set the robot to > the original position with the original orientation. I was using the > command SetPose but is not working. any idea?, Which command I have to use?. > > Thanks in advance > > Wester > > ------------------------------------------------------------------------ > Ahhh...imagining that irresistible "new car" smell? > Check out new cars at Yahoo! Autos. > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users From bthom at cs.hmc.edu Wed Apr 18 18:50:33 2007 From: bthom at cs.hmc.edu (belinda thom) Date: Wed Apr 18 18:50:33 2007 Subject: [Pyro-users] using hooks in conx to save weights to file Message-ID: Hi, This is a continuation of http://emergent.brynmawr.edu/pipermail/pyro- users/2007-April/thread.html#584, recording weight updates in conx. After looking at conx's code, I noticed that there were some hooks, notably, postStep, which appeared to be intended for allowing one to add bits of code to various parts of train, presumably w/the intention of making it thus more general purpose. It took me quite some time to figure out how to actually use this feature, but I was able to do so, so will include the code I developed to do this below. I'd also like to know if I'm using the hook feature the way the creators of conx's train intended. Finally, I wrote some extensive comments in the code in the area that I had the most difficulty (having to do with how to override the postStep method). If anyone has insight into the issues I describe there, I'd love to hear from you. The solution I propose is for the particular (simple) case of a single output-2-input and function, but since I overrode the Network class in doing so, it should easily be applicable to other problems, and should thus allow one to generate figures like 4.8 in Tom Mitchell's Machine Learning text. (Aside: I've used matplotlib to generate the figures, but you can use whatever plotting facility you like, as I provide you with lists of weights over time). I've found these types of figures very useful for student learning, so if there's a desire to include my work in the Pyro collection somehow, feel free to use what's appropriate. Hope this is helpful to someone else, --b ======== #from IPython.Debugger import Tracer; debug_here = Tracer() """ demonstrates simple perceptron-like network trained to perform boolean and function. """ import pyrobot.brain.conx as C import pickle import pylab fname = 'network.pickle' class myNetwork(C.Network) : def __init__(self,name='Backprop Network',verbosity=0,fname=fname) : """ Create a conx Neural net, with the added ability to write its layers/connections data to a pickle file, allowing weight change over time, for example, to be explored. """ C.Network.__init__(self,name=name,verbosity=verbosity) self.fname = fname if self.fname != None : # pickling data as the net's training progresses is made # possible courtesy of conx.py's postStep self.fh = file(fname,'w') def myPostStep(**args) : self.dumpLayer() self.postStep = myPostStep # aside: what I found bizarre is taht I couldn't merely overwrite # postStep via, e.g. # # def postStep(**args) : self.dumpLayer() # # because that was treated as a local variable? the self.postStep= myPostStep # piece seems crucial. # # the other tricky thing about this solution was that it # required myPostStep, although a method, to not # explicitly include the self argument. def reportParams(n) : """ Some fluff I added to make viewing the network's meta parameters easier. Note: this is where I discovered that things like n.getEpsilon(), although documented on pyro's neural network curric. modules, doesn't work. """ s = "" s += " eta=%g " % n.epsilon s += " tol=%g " % n.tolerance if n.batch : s += "batch " else : s += "stochastic " if n.learning : s += "learn:on " else : s += "learn:off " s += "mom=%g " % n.momentum if n.orderedInputs : s += "train:deterministic " else : s += "train:randomized " s += "allowedErrors=%g " % n.stopPercent s += " resetEpoch=%d " % n.resetEpoch s += " resetLimit=%d " % n.resetLimit print s def setLearning(self,val) : """ Assumption: when you turn off learning, you wish to close the pickle file. """ if self.fname != None : self.fh.close() C.Network.setLearning(self,val) def dumpLayer(self) : """ The actual hook into train. """ pickle.dump((self.layers,self.connections),self.fh) def wtsOverTime(self,display=True,closeAll=True) : """ This method decodes the pickle file and returns the weights as they change over time. These weights are returned in a dictionary, where each entry is the list of values a particular weight has taken on over time. The display arg controls if you also get a view of these weights over time via matplotlib. """ assert self.fname != None, "bogus usage" f = file(self.fname,'r') data = [] try : while True : data.append(pickle.load(f)) except EOFError : f.close() except : raise n = len(data) assert n > 0, "bogus file read" # the following code was basically ripped out of conx's # write-weights-to-file functionality (layers,connections) = data[0] d = wtsFromLayersAndConnections(layers,connections) keys = d.keys() wts = {} for k in keys : wts[k] = [d[k]] for i in range(n) : (layers,connections) = data[i] d = wtsFromLayersAndConnections(layers,connections) if i == 0 : for k in d.keys() : wts[k] = [d[k]] else : for k in d.keys() : wts[k].append(d[k]) # displaying nWts = len(wts) if display : if closeAll : pylab.close('all') pylab.subplot(nWts,1,1) ct = 1 for k in d.keys() : pylab.subplot(nWts,1,ct) pylab.plot(wts[k]) pylab.ylabel(k) ct += 1 return wts def wtsFromLayersAndConnections(layers,connections) : """ convert layers/connections weight data into dictionary so its easier to understand """ d = {} for layer in layers: if layer.type != 'Input': for i in range(layer.size): d['%s_%d_bias'%(layer.name[0:3],i)]=layer.weight[i] for connection in connections: for i in range(connection.fromLayer.size): for j in range(connection.toLayer.size): d['%s:%d->%s:%d'%(connection.fromLayer.name[0:3],i, \ connection.toLayer.name[0:3],j)] = connection.weight[i][j] return d def makeNet(fname=fname) : """ create, train, and return a simple perceptron-like network trained to perform boolean and function. """ n = myNetwork(fname=fname) n.add(C.Layer('input',2)) # The input layer has two nodes n.add(C.Layer('output',1)) # The output layer has one node n.connect('input','output') # The input layer is connected to the output layer # provide training patterns n.setInputs([[0.0,0.0],[0.0,1.0],[1.0,0.0],[1.0,1.0]]) n.setOutputs([[0.0],[0.0],[0.0],[1.0]]) # specify learning parameters n.setEpsilon(0.5) # learning rate n.setTolerance(0.2) # when target - activation < .2, considered correct n.setReportRate(1) # report every update reportParams(n) n.train() n.setLearning(0) if fname != None : wts = n.wtsOverTime() return (n,wts) return n From ciaraldi at wpi.edu Tue Apr 24 00:54:05 2007 From: ciaraldi at wpi.edu (Mike Ciaraldi) Date: Tue Apr 24 00:54:14 2007 Subject: [Pyro-users] Summer Robotics Workshops? Message-ID: <462D8D6D.5010304@wpi.edu> Fellow Pyomaniacs, I keep telling people at my school (WPI) about the great summer workshops I have attended the last few years, including Pyro and Lego robotics, and the Alice programming environment. Now some of them are interested in attending. Does anyone know of any robotics workshops for college faculty this summer? For those who haven't heard, WPI will launch the first undergraduate major in the US in Robotics Engineering this fall. For more info, see http://robotics.wpi.edu/ Mike Ciaraldi Professor of Practice WPI Computer Science From dblank at brynmawr.edu Tue Apr 24 10:35:01 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Tue Apr 24 10:35:06 2007 Subject: [Pyro-users] Summer Robotics Workshops? In-Reply-To: <462D8D6D.5010304@wpi.edu> References: <462D8D6D.5010304@wpi.edu> Message-ID: <462E1595.7020900@brynmawr.edu> Mike, Congrats on the new program! Look forward to hearing more about it. We don't have a Pyro workshop this summer, but there is a workshop related to robotics and education, and some Alice workshops that I know of. First, "Robotics: Science and Systems" (RSS) will be in Atlanta, June 27-30. See http://www.robotics-conference.org/ for general information, and http://www.roboteducation.org/rss-2007/ for details on the "Workshop on Research in Robots for Education". I saw that Steve and Wanda posted some details on their Alice workshop schedule to the SIGCSE mailing list (excerpts below). Of course, there is the AAAI Mobile Robot Competition, too. See: http://www.aaai.org/Conferences/AAAI/2007/aaai07robotcall.php but that isn't a workshop, per se. I suspect that next summer we may have a workshop on our new Myro materials (using personal robots in CS1 and CS2), but that is a ways off. I suspect that there may be some robot activity at next year's SIGCSE as well. Anyone know of other workshops this summer related to robots and education? -Doug """ Here are the Alice workshops we will be running during this upcoming summer: May 30-31 -- Nassau Community College, NY Contact Lore Postnel (postnel@ncc.edu) or Darci Burdge (Darci.Burdge@ncc.edu) for details July 16-22 -- Carnegie Mellon University, PA Contact Don Slater (dslater@andrew.cmu.edu) for details July 26-28 -- Roger Williams University, RI Contact Barb Conover (bconover@sju.edu) for details August 1-3 -- Georgia Tech, GA Contact Barb Conover (bconover@sju.edu) for details August 8-10 -- California State University - Dominguez Hills, CA Contact Barb Conover (bconover@sju.edu) for details Further details are available at: http://www.aliceprogramming.net/workshop2007.html Some of these workshops are funded by NSF grants. For those specific workshops, there is no registration or lodging fee. The workshops in RI and GA will focus on teaching with Alice and Guzdial and Ericson's Media Computation in a single CS1 or APCS course. The other workshops focus only on Alice. Regards, Wanda Dann Steve Cooper """ Mike Ciaraldi wrote: > Fellow Pyomaniacs, > > I keep telling people at my school (WPI) about the great summer workshops > I have attended the last few years, including Pyro and Lego robotics, > and the Alice programming environment. Now some of them are interested > in attending. Does anyone know of any robotics workshops for college > faculty this summer? > > For those who haven't heard, WPI will launch the first undergraduate major > in the US in Robotics Engineering this fall. For more info, see > http://robotics.wpi.edu/ > > Mike Ciaraldi > Professor of Practice > WPI Computer Science > > > > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > From bthom at cs.hmc.edu Tue Apr 24 13:54:57 2007 From: bthom at cs.hmc.edu (belinda thom) Date: Tue Apr 24 13:55:01 2007 Subject: [Pyro-users] conx Undefined layer question Message-ID: Hi, I'd borrowed and then modified some code to store weights in a dictionary: for layer in layers: if layer.type != 'Input': for i in range(layer.size): debug_here() d['%s[%d][0]'%(layer.name[0:3],i+1)]=layer.weight[i] for connection in connections: for i in range(connection.fromLayer.size): for j in range(connection.toLayer.size): d['%s[%d]%s[%d]'%(connection.fromLayer.name[0:3],i+1, \ connection.toLayer.name[0:3],j+1)] = connection.weight[i][j] w/the hope that putting these things in a dictionary would make the actual weight values easier to understand/explain in class. My plan was to have connection weights available via, e.g. d['inp[1] hid[1]'] where this would access the 1st input to 1st hidden unit weight. For biases, I would do, e.g. d['hid[1][0]'] which would access 1st hidden unit's bias. My problem is with the "if layer.type != 'Input'" check (part of the code I inherited), as I'm getting more bias weights than make sense. So I started poking around in the debugger and noticed an 'Undefined' layer type. What is this? I think its the thing that's producing, e.g. d['inp[1][0]'], where I would expect the input layers to have no useful bias. Thanks, --b From dblank at brynmawr.edu Tue Apr 24 14:12:38 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Tue Apr 24 14:14:48 2007 Subject: [Pyro-users] conx Undefined layer question In-Reply-To: References: Message-ID: <462E4896.5080202@brynmawr.edu> Belinda, I don't think that a layer should be Undefined. Sounds like that layer hasn't been .connect() ed to another layer yet (when the layers get connected, there is logic there to determine if each of the layers are Input, Hidden, or Output types). Could there be a mistake in the topology? FYI, there are bias units (aka, .weight[]) on Input and Context layers, even though they are not used. Also, did you know that you can refer to weights with this syntax: A single weight: net["fromLayerName", "toLayerName"][fromPos][toPos] net["input", "hidden"][0][1] and the entire matrix: net["fromLayerName", "toLayerName"].weight net["input", "hidden"].weight If none of these bits help, feel free to send me some code and I'll take a look at it. -Doug belinda thom wrote: > Hi, > > I'd borrowed and then modified some code to store weights in a dictionary: > > for layer in layers: > if layer.type != 'Input': > for i in range(layer.size): > debug_here() > d['%s[%d][0]'%(layer.name[0:3],i+1)]=layer.weight[i] > for connection in connections: > for i in range(connection.fromLayer.size): > for j in range(connection.toLayer.size): > d['%s[%d]%s[%d]'%(connection.fromLayer.name[0:3],i+1, \ > connection.toLayer.name[0:3],j+1)] = > connection.weight[i][j] > > > w/the hope that putting these things in a dictionary would make the > actual weight values easier to understand/explain in class. > > My plan was to have connection weights available via, e.g. > d['inp[1]hid[1]'] where this would access the 1st input to 1st hidden > unit weight. For biases, I would do, e.g. d['hid[1][0]'] which would > access 1st hidden unit's bias. > > My problem is with the "if layer.type != 'Input'" check (part of the > code I inherited), as I'm getting more bias weights than make sense. So > I started poking around in the debugger and noticed an 'Undefined' layer > type. What is this? I think its the thing that's producing, e.g. > d['inp[1][0]'], where I would expect the input layers to have no useful > bias. > > Thanks, > > --b > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > From bthom at cs.hmc.edu Tue Apr 24 15:27:55 2007 From: bthom at cs.hmc.edu (belinda thom) Date: Tue Apr 24 15:28:01 2007 Subject: [Pyro-users] conx Undefined layer question In-Reply-To: <462E4896.5080202@brynmawr.edu> References: <462E4896.5080202@brynmawr.edu> Message-ID: I did indeed have a topology issue (I'd set up two layers both named input, and didn't get a conx-related error, which seems a bit unfortunate :-). Thanks for the pointer. I was aware of the syntax you discuss below. The issue that made it difficult for me to just use that stuff was that bias is not treated as a connection. Personally, it would have been easier for me to get my head around some of this stuff had it not been treated differently in the API, as many text just refer to the bias units as the 0th input to a unit. :-) --b On Apr 24, 2007, at 11:12 AM, Douglas S. Blank wrote: > Belinda, > > I don't think that a layer should be Undefined. Sounds like that > layer hasn't been .connect() ed to another layer yet (when the > layers get connected, there is logic there to determine if each of > the layers are Input, Hidden, or Output types). Could there be a > mistake in the topology? > > FYI, there are bias units (aka, .weight[]) on Input and Context > layers, even though they are not used. > > Also, did you know that you can refer to weights with this syntax: > > A single weight: > > net["fromLayerName", "toLayerName"][fromPos][toPos] > net["input", "hidden"][0][1] > > and the entire matrix: > > net["fromLayerName", "toLayerName"].weight > net["input", "hidden"].weight > > If none of these bits help, feel free to send me some code and I'll > take a look at it. > > -Doug > > belinda thom wrote: >> Hi, >> I'd borrowed and then modified some code to store weights in a >> dictionary: >> for layer in layers: >> if layer.type != 'Input': >> for i in range(layer.size): >> debug_here() >> d['%s[%d][0]'%(layer.name[0:3],i+1)]=layer.weight[i] >> for connection in connections: >> for i in range(connection.fromLayer.size): >> for j in range(connection.toLayer.size): >> d['%s[%d]%s[%d]'%(connection.fromLayer.name[0:3],i >> +1, \ >> connection.toLayer.name[0:3],j >> +1)] = connection.weight[i][j] >> w/the hope that putting these things in a dictionary would make >> the actual weight values easier to understand/explain in class. >> My plan was to have connection weights available via, e.g. d['inp >> [1]hid[1]'] where this would access the 1st input to 1st hidden >> unit weight. For biases, I would do, e.g. d['hid[1][0]'] which >> would access 1st hidden unit's bias. >> My problem is with the "if layer.type != 'Input'" check (part of >> the code I inherited), as I'm getting more bias weights than make >> sense. So I started poking around in the debugger and noticed an >> 'Undefined' layer type. What is this? I think its the thing that's >> producing, e.g. d['inp[1][0]'], where I would expect the input >> layers to have no useful bias. >> Thanks, >> --b >> _______________________________________________ >> Pyro-users mailing list >> Pyro-users@pyrorobotics.org >> http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > From dblank at brynmawr.edu Tue Apr 24 16:07:42 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Tue Apr 24 16:08:06 2007 Subject: [Pyro-users] conx Undefined layer question In-Reply-To: References: <462E4896.5080202@brynmawr.edu> Message-ID: <462E638E.8070308@brynmawr.edu> belinda thom wrote: > I did indeed have a topology issue (I'd set up two layers both named > input, and didn't get a conx-related error, which seems a bit > unfortunate :-). Thanks for the pointer. Fixed in CVS: def addLayer(self, name, size, verbosity = 0, position = None): assert (name not in self.layersByName), ("duplicate layer name '%s' is not allowed" % name) > I was aware of the syntax you discuss below. The issue that made it > difficult for me to just use that stuff was that bias is not treated as > a connection. Personally, it would have been easier for me to get my > head around some of this stuff had it not been treated differently in > the API, as many text just refer to the bias units as the 0th input to a > unit. :-) Yes, in hindsight, that may have been easier in the implementation too. We tried to correct that a couple of years back, but there were just too many places in other code that would have to change. Perhaps the next big rewrite... -Doug > --b > > On Apr 24, 2007, at 11:12 AM, Douglas S. Blank wrote: > >> Belinda, >> >> I don't think that a layer should be Undefined. Sounds like that layer >> hasn't been .connect() ed to another layer yet (when the layers get >> connected, there is logic there to determine if each of the layers are >> Input, Hidden, or Output types). Could there be a mistake in the >> topology? >> >> FYI, there are bias units (aka, .weight[]) on Input and Context >> layers, even though they are not used. >> >> Also, did you know that you can refer to weights with this syntax: >> >> A single weight: >> >> net["fromLayerName", "toLayerName"][fromPos][toPos] >> net["input", "hidden"][0][1] >> >> and the entire matrix: >> >> net["fromLayerName", "toLayerName"].weight >> net["input", "hidden"].weight >> >> If none of these bits help, feel free to send me some code and I'll >> take a look at it. >> >> -Doug >> >> belinda thom wrote: >>> Hi, >>> I'd borrowed and then modified some code to store weights in a >>> dictionary: >>> for layer in layers: >>> if layer.type != 'Input': >>> for i in range(layer.size): >>> debug_here() >>> d['%s[%d][0]'%(layer.name[0:3],i+1)]=layer.weight[i] >>> for connection in connections: >>> for i in range(connection.fromLayer.size): >>> for j in range(connection.toLayer.size): >>> d['%s[%d]%s[%d]'%(connection.fromLayer.name[0:3],i+1, \ >>> connection.toLayer.name[0:3],j+1)] >>> = connection.weight[i][j] >>> w/the hope that putting these things in a dictionary would make the >>> actual weight values easier to understand/explain in class. >>> My plan was to have connection weights available via, e.g. >>> d['inp[1]hid[1]'] where this would access the 1st input to 1st hidden >>> unit weight. For biases, I would do, e.g. d['hid[1][0]'] which would >>> access 1st hidden unit's bias. >>> My problem is with the "if layer.type != 'Input'" check (part of the >>> code I inherited), as I'm getting more bias weights than make sense. >>> So I started poking around in the debugger and noticed an 'Undefined' >>> layer type. What is this? I think its the thing that's producing, >>> e.g. d['inp[1][0]'], where I would expect the input layers to have no >>> useful bias. >>> Thanks, >>> --b >>> _______________________________________________ >>> Pyro-users mailing list >>> Pyro-users@pyrorobotics.org >>> http://emergent.brynmawr.edu/mailman/listinfo/pyro-users >> > From t.kato at usm.sys.okayama-u.ac.jp Wed Apr 25 04:46:28 2007 From: t.kato at usm.sys.okayama-u.ac.jp (Tatsuya Kato) Date: Wed Apr 25 06:10:26 2007 Subject: [Pyro-users] Looking for pyro-3.x.x for Windows Message-ID: <003d01c78716$36da3990$6b00a8c0@pckato> Dear Sir: I am Japanese student studying in university. I have a question. I want to use pyro-3.x.x in WindowsXP. But I couldn't have found it for Windows ( .tar file for linux was found ). There is no pyro-3.x.x file for Windows? If you know the place of the file, could you tell me its URL? I would be very happy to hear from you. Best regards Tatsuya KATO e-mail : t.kato@usm.sys.okayama-u.ac.jp -------------- next part -------------- An HTML attachment was scrubbed... URL: http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20070425/41969630/attachment.htm From dblank at brynmawr.edu Wed Apr 25 15:03:45 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Wed Apr 25 15:03:54 2007 Subject: [Pyro-users] Looking for pyro-3.x.x for Windows In-Reply-To: <003d01c78716$36da3990$6b00a8c0@pckato> References: <003d01c78716$36da3990$6b00a8c0@pckato> Message-ID: <462FA611.5030100@brynmawr.edu> Are you sure you want to use a really old version of Pyro? Version 3 dates to around 2004. There are many bug fixes and enhancements since then. There are nice windows installers at: http://pyrorobotics.org/?page=PyroInstallation in section 1.1. But if you really want to run any version of Pyro under Windows, you can try any version with the instructions at the bottom of that section. (Instead of getting the source out of CVS, you can get it from http://pyrorobotics.org/tars/ untar it and then follow those instructions.) -Doug Tatsuya Kato wrote: > Dear Sir: > > I am Japanese student studying in university. I have a question. > > I want to use pyro-3.x.x in WindowsXP. But I couldn't have found > it for Windows ( .tar file for linux was found ). There is no > pyro-3.x.x file for Windows? > > If you know the place of the file, could you tell me its URL? > > I would be very happy to hear from you. > > Best regards > Tatsuya KATO > e-mail : t.kato@usm.sys.okayama-u.ac.jp > > > ------------------------------------------------------------------------ > > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users From edzela at yahoo.com Thu Apr 26 04:05:00 2007 From: edzela at yahoo.com (wester zela) Date: Thu Apr 26 04:05:08 2007 Subject: [Pyro-users] Problems to run programs Message-ID: <602235.32037.qm@web39714.mail.mud.yahoo.com> Hi Mr. Douglas I still have problems trying to run these programs. From the example of the GA . GAFindBlobNNProgram.py, I'm using the pyro CD live version pyrobot-4.8.5.iso Please, someone had the same problem and how did you solve it?. I think the problem is about the PYTHONPATH directories. I tried in many orders, firt this one, second this other one,etc.. I think first python look for __init__.py and I need the correct __init__.py, right?. The programs are in the current directory. the details: knoppix@3[pyro5_parking]$ python GAFindBlobNNProgram.py Traceback (most recent call last): File "GAFindBlobNNProgram.py", line 105, in ? ga = chaseGA(10,'tty') File "GAFindBlobNNProgram.py", line 24, in __init__ worldfile = "chase.world") File "/usr/lib/python2.3/site-packages/pyrobot/engine/__init__.py", line 51, in __init__ self.loadSimulator(self.simfile, self.worldfile) File "/usr/lib/python2.3/site-packages/pyrobot/engine/__init__.py", line 146, in loadSimulator if self.config.get("pyrobot", "gui") .lower() == 'tty': AttributeError: 'NoneType' object has no attribute 'lower' The configuration of the sys.path is : knoppix@1[pyro5_parking]$ python Python 2.3.5 (#2, May 4 2005, 08:51:39) [GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path ['', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages/Numeric', '/usr/lib/python2.3/site-packages/PIL', '/usr/lib/python2.3/site-packages/wx-2.5.5-gtk2-ansi'] I used the variables PYTHONPATH and PYROBOT knoppix@3[pyro5_parking]$ echo $PYROBOT /usr/lib/python2.3/site-packages/pyrobot/plugins/simulators knoppix@3[pyro5_parking]$ echo $PYTHONPATH /usr/lib/python2.3/site-packages/pyrobot/engine/:/usr/lib/python2.3/site-packages/pyrobot/plugins/ :/usr/lib/python2.3/site-packages/pyrobot/engine/:/usr/lib/python2.3/site-packages/pyrobot/brain/: /usr/lib/python2.3/site-packages/pyrobot/system/:/usr/lib/python2.3/site-packages/pyrobot/simulators/: /usr/lib/python2.3/site-packages/pyrobot/gui:/usr/lib/python2.3/site-packages/pyrobot/plugins/: /usr/lib/python2.3/site-packages/pyrobot/robot/ Thanks a lot!. Wester __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20070426/7f1b8bde/attachment.htm From dblank at brynmawr.edu Thu Apr 26 07:18:18 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Thu Apr 26 07:18:20 2007 Subject: [Pyro-users] Re: Problems to run programs In-Reply-To: <602235.32037.qm@web39714.mail.mud.yahoo.com> References: <602235.32037.qm@web39714.mail.mud.yahoo.com> Message-ID: <19750.76.98.12.59.1177586298.squirrel@webmail.brynmawr.edu> > knoppix@3[pyro5_parking]$ echo $PYROBOT > /usr/lib/python2.3/site-packages/pyrobot/plugins/simulators Wester, This is your problem. PYROBOT should be set to the pyrobot directory: export PYROBOT=/usr/lib/python2.3/site-packages/pyrobot -Doug On Thu, April 26, 2007 4:05 am, wester zela said: > Hi Mr. Douglas > I still have problems trying to run these programs. From the example of > the GA . GAFindBlobNNProgram.py, I'm using the pyro CD live version > pyrobot-4.8.5.iso > > Please, someone had the same problem and how did you solve it?. I think > the problem is about the PYTHONPATH directories. I tried in many orders, > firt this one, second this other one,etc.. I think first python look for > __init__.py and I need the correct __init__.py, right?. > The programs are in the current directory. > > the details: > > knoppix@3[pyro5_parking]$ python GAFindBlobNNProgram.py > Traceback (most recent call last): > File "GAFindBlobNNProgram.py", line 105, in ? > ga = chaseGA(10,'tty') > File "GAFindBlobNNProgram.py", line 24, in __init__ > worldfile = "chase.world") > File "/usr/lib/python2.3/site-packages/pyrobot/engine/__init__.py", line > 51, in __init__ > self.loadSimulator(self.simfile, self.worldfile) > File "/usr/lib/python2.3/site-packages/pyrobot/engine/__init__.py", line > 146, in loadSimulator > if self.config.get("pyrobot", "gui") .lower() == 'tty': > AttributeError: 'NoneType' object has no attribute 'lower' > > The configuration of the sys.path is : > knoppix@1[pyro5_parking]$ python > Python 2.3.5 (#2, May 4 2005, 08:51:39) > [GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> import sys >>>> sys.path > ['', '/usr/lib/python23.zip', '/usr/lib/python2.3', > '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', > '/usr/lib/python2.3/lib-dynload', > '/usr/local/lib/python2.3/site-packages', > '/usr/lib/python2.3/site-packages', > '/usr/lib/python2.3/site-packages/Numeric', > '/usr/lib/python2.3/site-packages/PIL', > '/usr/lib/python2.3/site-packages/wx-2.5.5-gtk2-ansi'] > > I used the variables PYTHONPATH and PYROBOT > knoppix@3[pyro5_parking]$ echo $PYROBOT > /usr/lib/python2.3/site-packages/pyrobot/plugins/simulators > > knoppix@3[pyro5_parking]$ echo $PYTHONPATH > /usr/lib/python2.3/site-packages/pyrobot/engine/:/usr/lib/python2.3/site-packages/pyrobot/plugins/ > :/usr/lib/python2.3/site-packages/pyrobot/engine/:/usr/lib/python2.3/site-packages/pyrobot/brain/: > /usr/lib/python2.3/site-packages/pyrobot/system/:/usr/lib/python2.3/site-packages/pyrobot/simulators/: > /usr/lib/python2.3/site-packages/pyrobot/gui:/usr/lib/python2.3/site-packages/pyrobot/plugins/: > /usr/lib/python2.3/site-packages/pyrobot/robot/ > > Thanks a lot!. > Wester > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 6501 From dblank at brynmawr.edu Thu Apr 26 10:15:27 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Thu Apr 26 10:16:25 2007 Subject: [Pyro-users] using hooks in conx to save weights to file In-Reply-To: References: Message-ID: <4630B3FF.4030308@brynmawr.edu> Belinda, Yes, you are correct. There are post- and pre- methods for the major steps in the back-propagation steps: backprop, propagate, step, and sweep. Taking a look at your code: > if self.fname != None : > # pickling data as the net's training progresses is made > # possible courtesy of conx.py's postStep > self.fh = file(fname,'w') > def myPostStep(**args) : self.dumpLayer() > self.postStep = myPostStep > > # aside: what I found bizarre is taht I couldn't merely > overwrite > # postStep via, e.g. > # > # def postStep(**args) : self.dumpLayer() > # > # because that was treated as a local variable? the > self.postStep= myPostStep > # piece seems crucial. > # > # the other tricky thing about this solution was that it > # required myPostStep, although a method, to not > # explicitly include the self argument. ...I see that you are attempting to define a method conditionally. You can't actually do the "define" conditionally (because it becomes local, as you saw), but you can do an assignment conditionally. So, you could do this: if self.fname != None: self.postStep = self.myPostStep You could also define a myPostStep anonymously right there with a lambda: if self.fname != None: self.postStep = lambda *args: self.myPostStep(*args) But that is a little limiting (has to be an expression), and so would probably require your own method anyway. Or, you could just define a new class with postStep re-define: class MyNetwork(network): def postStep(self, **args): ... (You actually can do a method definition conditionally, but that would dive down into some really Python hackery. Let me know if you really want to pursue that line of thinking.) Hope that helps, -Doug belinda thom wrote: > Hi, > > This is a continuation of > http://emergent.brynmawr.edu/pipermail/pyro-users/2007-April/thread.html#584, > recording weight updates in conx. > > After looking at conx's code, I noticed that there were some hooks, > notably, postStep, which appeared to be intended for allowing one to add > bits of code to various parts of train, presumably w/the intention of > making it thus more general purpose. > > It took me quite some time to figure out how to actually use this > feature, but I was able to do so, so will include the code I developed > to do this below. > > I'd also like to know if I'm using the hook feature the way the creators > of conx's train intended. > > Finally, I wrote some extensive comments in the code in the area that I > had the most difficulty (having to do with how to override the postStep > method). If anyone has insight into the issues I describe there, I'd > love to hear from you. > > The solution I propose is for the particular (simple) case of a single > output-2-input and function, but since I overrode the Network class in > doing so, it should easily be applicable to other problems, and should > thus allow one to generate figures like 4.8 in Tom Mitchell's Machine > Learning text. (Aside: I've used matplotlib to generate the figures, but > you can use whatever plotting facility you like, as I provide you with > lists of weights over time). I've found these types of figures very > useful for student learning, so if there's a desire to include my work > in the Pyro collection somehow, feel free to use what's appropriate. > > Hope this is helpful to someone else, > > --b > > ======== > > #from IPython.Debugger import Tracer; debug_here = Tracer() > > """ > demonstrates simple perceptron-like network trained to perform boolean > and function. > """ > > import pyrobot.brain.conx as C > import pickle > import pylab > > fname = 'network.pickle' > class myNetwork(C.Network) : > > def __init__(self,name='Backprop Network',verbosity=0,fname=fname) : > """ > Create a conx Neural net, with the added ability to write > its layers/connections data to a pickle file, allowing weight > change over time, for example, to be explored. > """ > C.Network.__init__(self,name=name,verbosity=verbosity) > self.fname = fname > if self.fname != None : > # pickling data as the net's training progresses is made > # possible courtesy of conx.py's postStep > self.fh = file(fname,'w') > def myPostStep(**args) : self.dumpLayer() > self.postStep = myPostStep > > # aside: what I found bizarre is taht I couldn't merely > overwrite > # postStep via, e.g. > # > # def postStep(**args) : self.dumpLayer() > # > # because that was treated as a local variable? the > self.postStep= myPostStep > # piece seems crucial. > # > # the other tricky thing about this solution was that it > # required myPostStep, although a method, to not > # explicitly include the self argument. > > def reportParams(n) : > """ > Some fluff I added to make viewing the network's meta parameters > easier. > Note: this is where I discovered that things like > n.getEpsilon(), although > documented on pyro's neural network curric. modules, doesn't work. > """ > s = "" > s += " eta=%g " % n.epsilon > s += " tol=%g " % n.tolerance > if n.batch : > s += "batch " > else : > s += "stochastic " > if n.learning : > s += "learn:on " > else : > s += "learn:off " > s += "mom=%g " % n.momentum > if n.orderedInputs : > s += "train:deterministic " > else : > s += "train:randomized " > s += "allowedErrors=%g " % n.stopPercent > s += " resetEpoch=%d " % n.resetEpoch > s += " resetLimit=%d " % n.resetLimit > print s > > def setLearning(self,val) : > """ > Assumption: when you turn off learning, you wish to close the > pickle file. > """ > if self.fname != None : > self.fh.close() > C.Network.setLearning(self,val) > > def dumpLayer(self) : > """ > The actual hook into train. > """ > pickle.dump((self.layers,self.connections),self.fh) > > def wtsOverTime(self,display=True,closeAll=True) : > """ > This method decodes the pickle file and returns the weights as they > change over time. These weights are returned in a dictionary, where > each entry is the list of values a particular weight has taken > on over time. > > The display arg controls if you also get a view of these > weights over time via matplotlib. > """ > assert self.fname != None, "bogus usage" > f = file(self.fname,'r') > data = [] > try : > while True : > data.append(pickle.load(f)) > except EOFError : > f.close() > except : > raise > n = len(data) > assert n > 0, "bogus file read" > > # the following code was basically ripped out of conx's > # write-weights-to-file functionality > (layers,connections) = data[0] > d = wtsFromLayersAndConnections(layers,connections) > keys = d.keys() > wts = {} > for k in keys : > wts[k] = [d[k]] > for i in range(n) : > (layers,connections) = data[i] > d = wtsFromLayersAndConnections(layers,connections) > if i == 0 : > for k in d.keys() : > wts[k] = [d[k]] > else : > for k in d.keys() : > wts[k].append(d[k]) > # displaying > nWts = len(wts) > if display : > if closeAll : > pylab.close('all') > pylab.subplot(nWts,1,1) > ct = 1 > for k in d.keys() : > pylab.subplot(nWts,1,ct) > pylab.plot(wts[k]) > pylab.ylabel(k) > ct += 1 > return wts > > def wtsFromLayersAndConnections(layers,connections) : > """ > convert layers/connections weight data into dictionary so its > easier to understand > """ > d = {} > for layer in layers: > if layer.type != 'Input': > for i in range(layer.size): > d['%s_%d_bias'%(layer.name[0:3],i)]=layer.weight[i] > for connection in connections: > for i in range(connection.fromLayer.size): > for j in range(connection.toLayer.size): > d['%s:%d->%s:%d'%(connection.fromLayer.name[0:3],i, \ > connection.toLayer.name[0:3],j)] = > connection.weight[i][j] > return d > > def makeNet(fname=fname) : > """ > create, train, and return a simple perceptron-like network trained > to perform boolean and function. > """ > n = myNetwork(fname=fname) > n.add(C.Layer('input',2)) # The input layer has two nodes > n.add(C.Layer('output',1)) # The output layer has one node > n.connect('input','output') # The input layer is connected to the > output layer > > # provide training patterns > n.setInputs([[0.0,0.0],[0.0,1.0],[1.0,0.0],[1.0,1.0]]) > n.setOutputs([[0.0],[0.0],[0.0],[1.0]]) > > # specify learning parameters > n.setEpsilon(0.5) # learning rate > n.setTolerance(0.2) # when target - activation < .2, considered > correct > n.setReportRate(1) # report every update > reportParams(n) > > n.train() > n.setLearning(0) > if fname != None : > wts = n.wtsOverTime() > return (n,wts) > > return n > > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > From bthom at cs.hmc.edu Fri Apr 27 02:12:50 2007 From: bthom at cs.hmc.edu (belinda thom) Date: Fri Apr 27 02:12:59 2007 Subject: [Pyro-users] conx seed question Message-ID: Hi, Is there a cleaner way to set conx's seed so that I can run a repeatable training experiment? I ended up modifying conx's Network class's __init__, adding a seed flag to it, e.g. def __init__(self, name = 'Backprop Network', verbosity = 0, seed=None): """ Constructor for the Network class. Takes optional name and verbosity arguments. """ if seed==None : x = random.random() * 100000 + time.time() else : x = seed but would rather use a built-in method if there is one (I couldn't find it). Otherwise, if such a thing doesn't exist, it would be worth making this change so that, for teaching purposes, we can run a particular experiment in the classroom. Advice always appreciated. Thx, --b From bthom at cs.hmc.edu Fri Apr 27 02:52:45 2007 From: bthom at cs.hmc.edu (belinda thom) Date: Fri Apr 27 02:52:49 2007 Subject: [Pyro-users] conx rerandomize weights question Message-ID: Hi, I've been writing my own train function for a variety of reasons and have recently wanted to do several restarts so that I can see which gives the best result. What I can't figure out how to do is to set the weights before each attempt to train so that they are re-randomized. I had hoped the network.resetFlags() that conx's Network class's train method used would do the trick, but it doesn't re-randomize the initial weights. Any suggestions? Thanks, --b From dblank at brynmawr.edu Fri Apr 27 08:44:06 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Fri Apr 27 08:44:08 2007 Subject: [Pyro-users] conx rerandomize weights question In-Reply-To: References: Message-ID: <23987.76.98.12.59.1177677846.squirrel@webmail.brynmawr.edu> Belinda, You can use network.reset() to start the pseudo-random stream of numbers back to the beginning with the original seed, and then re-assign the weights again. network.initialize() will just re-assign the weights in the current position in the pseudo-random stream. So, you can rerun experiments over and over again with: network.setSeed(38736) network.train() network.reset() network.train() ... Or, if you wish to run a bunch of repeatable experiments in which no two are the same: network.setSeed(38736) network.train() network.initialize() network.train() network.initialize() network.train() ... BTW, conx prints out the seed number regardless of verbosity for a related reason. When I was in grad school, Jordan Pollack told us a story about this wonderful neural network that produced this beautiful "butterfly pattern" in weight space (you can probably can find the image by reading some of his papers from the early '90s). Well, he didn't save the initial seed of this network, and never (as far as I know) found another network like it, although he did spend some time trying. So, I always know what the initial seed is, just in case I want to go back and run that again. network.resetFlags() should be a hidden/private method; it is used to make sure that inputs and activations are set/computed appropriately (for example, it checks to make sure that you set all of the inputs once and only once). -Doug On Fri, April 27, 2007 2:52 am, belinda thom said: > Hi, > > I've been writing my own train function for a variety of reasons and > have recently wanted to do several restarts so that I can see which > gives the best result. > > What I can't figure out how to do is to set the weights before each > attempt to train so that they are re-randomized. I had hoped the > network.resetFlags() that conx's Network class's train method used > would do the trick, but it doesn't re-randomize the initial weights. > > Any suggestions? > > Thanks, > > --b > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 6501 From dblank at brynmawr.edu Fri Apr 27 09:06:20 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Fri Apr 27 09:06:22 2007 Subject: [Pyro-users] conx seed question Message-ID: <24061.76.98.12.59.1177679180.squirrel@webmail.brynmawr.edu> For historical reasons that I can't quite remember, we made it so that all of the network types took exactly the same initial parameters, but then allow setting additional properties before the network is actually created. For example, we could have made it so that the constructor also took layer names and sizes and actually made the layers. But we decided to not allow that, and broke up initialization of the network from the building of the network. So, (as mentioned in the previous email) you can accomplish the same affect with: network = Network() network.setSeed(38473) # create network, etc But, your suggestion to add the seed to the constructor makes a lot of sense, is intuitive, should be backwards compatible, and shouldn't cause any problems with networks that extend the Network class. I'll add this to the CVS version, and test it out. Thanks! -Doug On Fri, April 27, 2007 2:12 am, belinda thom said: > Hi, > > Is there a cleaner way to set conx's seed so that I can run a > repeatable training experiment? > > I ended up modifying conx's Network class's __init__, adding a seed flag to it, e.g. > > def __init__(self, name = 'Backprop Network', verbosity = 0, > seed=None): > """ > Constructor for the Network class. Takes optional name and verbosity arguments. > """ > if seed==None : > x = random.random() * 100000 + time.time() > else : > x = seed > > but would rather use a built-in method if there is one (I couldn't find it). Otherwise, if such a thing doesn't exist, it would be worth making this change so that, for teaching purposes, we can run a > particular experiment in the classroom. > > Advice always appreciated. > > Thx, > > --b > > > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 6501 -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 6501