Author Topic: Ask Peter anything  (Read 34636 times)

0 Members and 1 Guest are viewing this topic.

Offline Pyraxis

  • Werewolf Wrangler of the Aspie Elite
  • Caretaker Admin
  • Almighty Postwhore
  • *****
  • Posts: 16663
  • Karma: 1430
  • aka Daria
Re: Ask Peter anything
« Reply #930 on: July 06, 2009, 08:25:42 PM »
What's your latest coding project?
You'll never self-actualize the subconscious canopy of stardust with that attitude.

Offline Peter

  • Amazing Cyber-Human Hybrid
  • Elder
  • Insane Postwhore
  • *****
  • Posts: 11846
  • Karma: 1115
  • Gender: Male
Re: Ask Peter anything
« Reply #931 on: July 07, 2009, 10:21:03 AM »
It's a neuroevolution project, written in C++. 

My previous neuroevolution projects were written in Python, which is very easy to work with, but generally runs about 100 times slower than C++.  Python can be speeded up by using various packages that convert python code into C++ code or by using external C++ libraries for number crunching, but I found that the techniques which were easy to use didn't improve performance by much, and the other techniques were such a headache that I decided I was better off just learning C++ and starting from scratch.

For this latest project, I'm implementing an evolutionary algorithm inspired by NEAT.  There's a genetic algorithm component which allows for sexual recombination between individuals, rather than purely asexual reproduction as was the case in my earlier attempts, which increases the diversity of individuals, allows selection to operate separately on good and bad mutations and is less prone to getting stuck at local maximums in the fitness landscape.  NEAT also uses a system that splits a population into different species and limits competition and interbreeding between species to encourage greater diversity, and increases competition and interbreeding when the number of species exceeds a certain limit, and I'm planning to implement my own version of this, too.

The new approach also makes a distinction between genotype and phenotype.  In my previous attempts, a new organism was a direct copy of it's parent, with a few mutations, which meant that it 'knew' whatever it's parent knew at the point of reproduction.  With a separate genotype and phenotype, organisms won't pass on what they learn over the course of their lifespan, but will pass on genes that code for a set of useful instincts and, possibly, genes that give new organisms the innate ability to learn and adapt to some degree, though for that to happen, I think I'll have to include some learning algorithms and a system whereby genes can specify where and when those algorithms are applied. 

The distinction also means that data which is only needed during reproduction can be kept separate from data that's needed while the organism is processing information and interacting with it's environment, so the datastructures where the heaviest processing takes place can be kept smaller, take up less space in the CPU cache and be processed more efficiently.

Writing it in C++ is proving quite challenging, but I'm glad I made the move, and I'm learning a lot.  At the moment, I'm trying to get a handle on dynamic memory allocation, which is something I never had to deal with in Python, and I'm a bit fuzzy on various other aspects of the language.  I've made significant revisions to my code several times so far, as I've figured out better ways of doing things, and I've spent a lot of time experimenting with fragments of code to figure out what works and what doesn't, as well as browsing online reference sources and flicking through a C++ study guide that I picked up in a charity shop, so my progress has been slow and I'm still working on getting the fundamentals right.
Quote
14:10 - Moarskrillex42: She said something about knowing why I wanted to move to Glasgow when she came in. She plopped down on my bed and told me to go ahead and open it for her.

14:11 - Peter5930: So, she thought I was your lover and that I was sending you a box full of sex toys, and that you wanted to move to Glasgow to be with me?

Offline odeon

  • Witchlet of the Aspie Elite
  • Webmaster
  • Postwhore Beyond Repair
  • *****
  • Posts: 108818
  • Karma: 4477
  • Gender: Male
  • Replacement Despot
Re: Ask Peter anything
« Reply #932 on: July 07, 2009, 01:51:36 PM »
Will you release your code somewhere, eventually?
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former."

- Albert Einstein

Offline Peter

  • Amazing Cyber-Human Hybrid
  • Elder
  • Insane Postwhore
  • *****
  • Posts: 11846
  • Karma: 1115
  • Gender: Male
Re: Ask Peter anything
« Reply #933 on: July 07, 2009, 04:08:44 PM »
I'll post the source here when I have something worth showing, along with a link to a compiled binary.
Quote
14:10 - Moarskrillex42: She said something about knowing why I wanted to move to Glasgow when she came in. She plopped down on my bed and told me to go ahead and open it for her.

14:11 - Peter5930: So, she thought I was your lover and that I was sending you a box full of sex toys, and that you wanted to move to Glasgow to be with me?

Offline odeon

  • Witchlet of the Aspie Elite
  • Webmaster
  • Postwhore Beyond Repair
  • *****
  • Posts: 108818
  • Karma: 4477
  • Gender: Male
  • Replacement Despot
Re: Ask Peter anything
« Reply #934 on: July 07, 2009, 04:40:48 PM »
 :thumbup:
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former."

- Albert Einstein

Offline The Member Formerly Known As Sophist

  • Too Eliter for the Aspie Elite
  • Elder
  • Postwhore
  • *****
  • Posts: 1293
  • Karma: 191
  • Gender: Female
  • I am what I am and that's all what I am.
    • Gestalt: An Autism Forum
Re: Ask Peter anything
« Reply #935 on: July 07, 2009, 05:05:14 PM »
Are you implementing any sort of additive effect to your phenotypes? E.g., parent A = 1.0; parent B = 2.0; offspring = 1.5
Flibbit.

Offline Peter

  • Amazing Cyber-Human Hybrid
  • Elder
  • Insane Postwhore
  • *****
  • Posts: 11846
  • Karma: 1115
  • Gender: Male
Re: Ask Peter anything
« Reply #936 on: July 08, 2009, 09:55:51 AM »
Are you implementing any sort of additive effect to your phenotypes? E.g., parent A = 1.0; parent B = 2.0; offspring = 1.5

No, more like parent A = 1.0; parent B = 2.0; offspring = 1.0 or 2.0, at least as far as individual genes go.

The genome that's used to construct each organism is quite simple, and looks like this:

class Genome
{
   public:
      list<Connection_gene> con_genes;
      int n_bias;
      int n_inputs;
      int n_outputs;
      int n_hidden;
};

It holds a list of genes, each of which codes for a connection between two nodes, and it keeps track of the numbers of each type of node.  When an organism is created, an array is made which holds (n_bias+n_inputs+n_outputs+n_hidden) nodes; nodes 0 to n_bias are bias nodes, n_inputs to n_outputs are input nodes etc.  This way, it's not necessary to have a separate list of genes that code for individual nodes.

Each connection gene looks like this:

class Connection_gene
{
   public:
      int id;
      int origin;
      int target;
      float weight;
      bool enabled;
};

Origin and target are indexes for the nodes the gene connects and weight affects how strong the signal is from the origin node to the target node, and whether it's excitatory or inhibitory.  If enabled is set to 0, the gene is ignored when constructing an organism and behaves like a pseudogene in real organisms, with the potential to be reactivated by a future mutation.

Id is important for sexual recombination; when a new connection gene is created through a mutation, it's assigned a unique identification number, and each genome can only hold one gene with a particular id.  When two genomes are crossed, the genes are compared and if the parents share a gene with the same id (which means they both inherited that gene from a common ancestor), only one copy is passed onto the offspring.  Id also indicates how old a gene is, with older genes having lower id's than younger ones, and this means that mutations can be applied preferentially to younger genes.  This allows for older, well-established structures and functions to be preserved while allowing for change and innovation to take place in new structures and functions, somewhat along the lines of the nested fish brain/reptile brain/mammal brain pattern in humans, and similar to how real organisms have more stable and less stable stretches of DNA.
Quote
14:10 - Moarskrillex42: She said something about knowing why I wanted to move to Glasgow when she came in. She plopped down on my bed and told me to go ahead and open it for her.

14:11 - Peter5930: So, she thought I was your lover and that I was sending you a box full of sex toys, and that you wanted to move to Glasgow to be with me?

Offline Christopher McCandless

  • Wild Wanderer of the Aspie Elite
  • Elder
  • Insane Postwhore
  • *****
  • Posts: 10626
  • Karma: 132
  • Gender: Male
  • "I HAVE HAD A HAPPY LIFE AND THANK THE LORD. GOODB
    • Into the Wild
Re: Ask Peter anything
« Reply #937 on: July 08, 2009, 10:38:19 AM »
Sounds like a lot of fun stuff. I get to study it all next year to a degree, doing something called mathematical biology.

Offline Peter

  • Amazing Cyber-Human Hybrid
  • Elder
  • Insane Postwhore
  • *****
  • Posts: 11846
  • Karma: 1115
  • Gender: Male
Re: Ask Peter anything
« Reply #938 on: July 08, 2009, 04:49:25 PM »
Sounds like a lot of fun stuff. I get to study it all next year to a degree, doing something called mathematical biology.

What else are you/will you be studying?
Quote
14:10 - Moarskrillex42: She said something about knowing why I wanted to move to Glasgow when she came in. She plopped down on my bed and told me to go ahead and open it for her.

14:11 - Peter5930: So, she thought I was your lover and that I was sending you a box full of sex toys, and that you wanted to move to Glasgow to be with me?

Offline Pyraxis

  • Werewolf Wrangler of the Aspie Elite
  • Caretaker Admin
  • Almighty Postwhore
  • *****
  • Posts: 16663
  • Karma: 1430
  • aka Daria
Re: Ask Peter anything
« Reply #939 on: July 09, 2009, 06:54:30 AM »
I discovered this yesterday, thought you might find it interesting. Dunno if it would be useful for your current project since it sounds like you've got a different kind of algorithm structure, but nonetheless:

http://www.newscientist.com/article/mg20327151.600-memristor-minds-the-future-of-artificial-intelligence.html

Plus some stuff on self-organized criticality and the patterns/balance of neurons firing:

http://www.newscientist.com/article/mg20227141.200-disorderly-genius-how-chaos-drives-the-brain.html
You'll never self-actualize the subconscious canopy of stardust with that attitude.

Offline Christopher McCandless

  • Wild Wanderer of the Aspie Elite
  • Elder
  • Insane Postwhore
  • *****
  • Posts: 10626
  • Karma: 132
  • Gender: Male
  • "I HAVE HAD A HAPPY LIFE AND THANK THE LORD. GOODB
    • Into the Wild
Re: Ask Peter anything
« Reply #940 on: July 09, 2009, 07:00:07 AM »
Sounds like a lot of fun stuff. I get to study it all next year to a degree, doing something called mathematical biology.

What else are you/will you be studying?
Thats got all the details about the module in it:
http://www.maths.dur.ac.uk/Ug/coursebooks/3H/booklet.pdf
Also doing Decision Theory, Differential Geometry and Maths Teaching from there, as well as a couple of politics modules. Probably the easiest 3rd year I could have.

Offline El

  • Unofficial Weird News Reporter of the Aspie Elite
  • News Box Slave
  • Almighty Postwhore
  • *****
  • Posts: 21926
  • Karma: 2615
Re: Ask Peter anything
« Reply #941 on: July 09, 2009, 07:01:09 AM »
Are you getting paid for the coding stuff, or is it a hobby?
it is well known that PMS Elle is evil.
I think you'd fit in a 12" or at least a 16" firework mortar
You win this thread because that's most unsettling to even think about.

Offline Peter

  • Amazing Cyber-Human Hybrid
  • Elder
  • Insane Postwhore
  • *****
  • Posts: 11846
  • Karma: 1115
  • Gender: Male
Re: Ask Peter anything
« Reply #942 on: July 09, 2009, 09:23:47 AM »
Are you getting paid for the coding stuff, or is it a hobby?

It's a hobby; it would be nice if I found a way to make some money from it, but I do it because I find it interesting.  So far, I don't think I've created anything that other people would find interesting or useful enough to give me money for; I'm not skilled or experienced when it comes to programming, and generally just muddle along, gradually learning as I go.
Quote
14:10 - Moarskrillex42: She said something about knowing why I wanted to move to Glasgow when she came in. She plopped down on my bed and told me to go ahead and open it for her.

14:11 - Peter5930: So, she thought I was your lover and that I was sending you a box full of sex toys, and that you wanted to move to Glasgow to be with me?

Offline Christopher McCandless

  • Wild Wanderer of the Aspie Elite
  • Elder
  • Insane Postwhore
  • *****
  • Posts: 10626
  • Karma: 132
  • Gender: Male
  • "I HAVE HAD A HAPPY LIFE AND THANK THE LORD. GOODB
    • Into the Wild
Re: Ask Peter anything
« Reply #943 on: July 09, 2009, 09:56:55 AM »
Are you getting paid for the coding stuff, or is it a hobby?

It's a hobby; it would be nice if I found a way to make some money from it, but I do it because I find it interesting.  So far, I don't think I've created anything that other people would find interesting or useful enough to give me money for; I'm not skilled or experienced when it comes to programming, and generally just muddle along, gradually learning as I go.
Why don't you sign yourself onto some courses, or something along those lines?

Offline Peter

  • Amazing Cyber-Human Hybrid
  • Elder
  • Insane Postwhore
  • *****
  • Posts: 11846
  • Karma: 1115
  • Gender: Male
Re: Ask Peter anything
« Reply #944 on: July 09, 2009, 10:41:06 AM »
Are you getting paid for the coding stuff, or is it a hobby?

It's a hobby; it would be nice if I found a way to make some money from it, but I do it because I find it interesting.  So far, I don't think I've created anything that other people would find interesting or useful enough to give me money for; I'm not skilled or experienced when it comes to programming, and generally just muddle along, gradually learning as I go.
Why don't you sign yourself onto some courses, or something along those lines?

I've always learned more effectively when pursuing things on my own than when following a curriculum.  I tend to get stressed and anxious about assignments and exams, and spend more time worrying than studying, which isn't an issue if I'm taking things at my own pace and don't have any obligations.  It would also cost significant sums of money for a university-level course, relative to my income.  I already have a B.Sc in geography, so I don't qualify for much in the way of financial aid (and the aid I got for my first degree was all in the form of student loans that I still owe).
Quote
14:10 - Moarskrillex42: She said something about knowing why I wanted to move to Glasgow when she came in. She plopped down on my bed and told me to go ahead and open it for her.

14:11 - Peter5930: So, she thought I was your lover and that I was sending you a box full of sex toys, and that you wanted to move to Glasgow to be with me?