How to best represent HTML for GP?

40 views
Skip to first unread message

Jarrad Hope

unread,
Apr 12, 2014, 5:15:51 AM4/12/14
to deap-...@googlegroups.com
I was wondering how I could best represent HTML (and later css) in DEAP for GP?

Particularly nesting of html elements - would I create a finite set of parameters for a primitive, params representing the max elements that element could hold? Then provide a null/empty primitive and hope they fill the params ?  or is there a better way to go about it?

thanks

Jarrad Hope

unread,
Apr 12, 2014, 1:00:22 PM4/12/14
to deap-...@googlegroups.com
Hmm looks like GE might be more suited

EBo

unread,
Apr 12, 2014, 1:41:48 PM4/12/14
to deap-...@googlegroups.com
grammatical evolution? I'm not familiar with any other GE...

Jarrad Hope

unread,
Apr 13, 2014, 4:25:20 AM4/13/14
to deap-...@googlegroups.com
Yes sorry should have been more clear, I'm new to the concept but seems interesting!

George Kouzmov

unread,
Apr 13, 2014, 2:39:12 PM4/13/14
to deap-...@googlegroups.com
Hi Jarrad,
I think it really depends on the purpose. But you can do simple code generation via XML parsers and later on use HTML evaluators as a basic fitness function and of course expand on it. However this assumes that you are trying to generate readable HTML only. If you want to generate useful HTML (for a website) you'll need to have to expand your fitness function to not only separate readable from non readable and that can be an entirely new system on it's own

Regards,
George


--
You received this message because you are subscribed to the Google Groups "deap-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

George Kouzmov

unread,
Apr 13, 2014, 2:48:49 PM4/13/14
to deap-...@googlegroups.com
To add,
Primitives can simply be generated by set of rules for example, all the possible HTML tags. However you don't know to have too big of a primitive set, so you can simply choose the most common tags ( they are not that many I think)
By representing each tag as a class, using strongly typed GP can create rules via the primitive set by defining which tags can be input/output to others. 

George

Yannick Hold-Geoffroy

unread,
Apr 13, 2014, 3:05:26 PM4/13/14
to deap-...@googlegroups.com
Hello,

I may be wrong, but GE does not seems like an Evolutionary Algorithm acronym to me. I'm not sure what Mr. Hope meant: GA (algorithms) or GP (programming)?

Mr Kouzmov explained a good idea on how to start, but it rises a bigger question for me: why are you trying to do this? What are you trying to achieve? You want to generate a random webpage (while being valid with the W3C HTML standard) to what extend? Voting for the best page among users (thereby having a human-based evaluation function) or automatically analyzing it using an evaluation function? If your evaluation function only checks for standard validity, shouldn't you simply use grammar-based library on your content instead of a stochastic approach? What would be the content of the webpage?

Data representation, and more importantly what you try to achieve, are of crucial importance in EAs. Without this knowledge, evolution will difficultly lead you anywhere...

Have a nice day,
Yannick Hold

Christian Gagné

unread,
Apr 13, 2014, 9:46:29 PM4/13/14
to yanni...@gmail.com, deap-...@googlegroups.com
Hello Yannick,

In fact, GE means Grammatical Evolution. It is a specific approach for doing GP by expressing the domain on which it is working with a grammar (a Backus-Naur Form grammar to be precise). Thanks to the use of the grammar, it can generate programs in "real" programming languages -- for instance it has been use to directly evolve C and Perl programs. It is probably the most know grammar-based GP method.

Best,

Christian
Christian Gagné
http://vision.gel.ulaval.ca/~cgagne

Yannick Hold-Geoffroy

unread,
Apr 13, 2014, 10:42:55 PM4/13/14
to deap-...@googlegroups.com, Yannick Hold-Geoffroy
Hello Christian,

Oh, didn't know that. Thanks for enlightening me!
We learn something new everyday!

Yannick

EBo

unread,
Apr 14, 2014, 12:31:42 AM4/14/14
to deap-...@googlegroups.com
Christian,

Do you have a citation for evolving C to do something practical?

Thanks and best regards,

EBo --

Jarrad Hope

unread,
Apr 14, 2014, 7:20:42 AM4/14/14
to deap-...@googlegroups.com
Thanks for the responses,
I'm mostly curious as to see what the results were - I think the idea of automatic webpage creation could be really cool.

George Ahh I didn't know you could do that with class based primitives for strongly typed GP.

For fitness function I figured simplest would have human selection while testing, but later I was thinking to ender the page in webkit and see how well it performed against a layout mask (turning this mask into a gradient)

Christian Gagné

unread,
Apr 14, 2014, 10:30:29 AM4/14/14
to e...@sandien.com, deap-...@googlegroups.com
Dear EBo,

Well, being practical for one may be quite conceptual for others. GE has been designed to evolve directly code in a given language, describe by the grammar. The key to have it to work is to define a grammar that is narrow enough to keep the search working, but fit to the problem at hand

For an example of « practical » evolution of C program with GE, see the following paper.

Burbidge, R.; Walker, J.H.; Wilson, M.S., "Grammatical evolution of a robot controller," Intelligent Robots and Systems, 2009. IROS 2009. IEEE/RSJ International Conference on , vol., no., pp.357,362, 10-15 Oct. 2009
doi: 10.1109/IROS.2009.5354411

Christian

EBo

unread,
Apr 14, 2014, 11:19:35 AM4/14/14
to deap-...@googlegroups.com
Christian,

Thank you kindly for the reference. I have downloaded the paper and
will review it ASAP.

Thanks again,

EBo --
Reply all
Reply to author
Forward
0 new messages