Skip to main content
Top

2023 | OriginalPaper | Chapter

Grammatical Evolution with Code2vec

Authors : Michał Kowalczykiewicz, Piotr Lipiński

Published in: Genetic Programming

Publisher: Springer Nature Switzerland

Activate our intelligent search to find suitable subject content or patents.

search-config
loading …

Abstract

This paper concerns using the code2vec vector embeddings of the source code to improve automatic source code generation in Grammatical Evolution. Focusing on a particular programming language, such as Java in the research presented, and being able to represent each Java function in the form of a continuous vector in a linear space by the code2vec model, GE gains some additional knowledge on similarities between constructed functions in the linear space instead of semantic similarities, which are harder to process. We propose a few improvements to the regular GE algorithm, including a code2vec-based initialization of the evolutionary algorithm and a code2vec-based crossover operator. Computational experiments confirm the efficiency of the approach proposed on a few typical benchmarks.

Dont have a licence yet? Then find out more about our products and how to get one now:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Literature
1.
go back to reference Affenzeller, M., Wagner, S., Winkler, S., Beham, A.: Genetic Algorithms and Genetic Programming: Modern Concepts and Practical Applications. Chapman and Hall/CRC (2009) Affenzeller, M., Wagner, S., Winkler, S., Beham, A.: Genetic Algorithms and Genetic Programming: Modern Concepts and Practical Applications. Chapman and Hall/CRC (2009)
2.
go back to reference Alon, U., Brody, S., Levy, O., Yahav, E.: Code2seq: generating sequences from structured representations of code. arXiv preprint arXiv:1808.01400 (2018) Alon, U., Brody, S., Levy, O., Yahav, E.: Code2seq: generating sequences from structured representations of code. arXiv preprint arXiv:​1808.​01400 (2018)
3.
go back to reference Alon, U., Zilberstein, M., Levy, O., Yahav, E.: Code2vec: learning distributed representations of code. Proc. ACM Program. Lang. 3(POPL) (2019) Alon, U., Zilberstein, M., Levy, O., Yahav, E.: Code2vec: learning distributed representations of code. Proc. ACM Program. Lang. 3(POPL) (2019)
4.
go back to reference Burbidge, R., Walker, J.H., Wilson, M.S.: Grammatical evolution of a robot controller. In: 2009 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 357–362. IEEE (2009) Burbidge, R., Walker, J.H., Wilson, M.S.: Grammatical evolution of a robot controller. In: 2009 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 357–362. IEEE (2009)
5.
go back to reference Byrne, J., Cardiff, P., Brabazon, A., et al.: Evolving parametric aircraft models for design exploration and optimisation. Neurocomputing 142, 39–47 (2014)CrossRef Byrne, J., Cardiff, P., Brabazon, A., et al.: Evolving parametric aircraft models for design exploration and optimisation. Neurocomputing 142, 39–47 (2014)CrossRef
6.
go back to reference Compton, R., Frank, E., Patros, P., Koay, A.: Embedding Java classes with code2vec: improvements from variable obfuscation. In: Proceedings of the 17th International Conference on Mining Software Repositories, pp. 243–253 (2020) Compton, R., Frank, E., Patros, P., Koay, A.: Embedding Java classes with code2vec: improvements from variable obfuscation. In: Proceedings of the 17th International Conference on Mining Software Repositories, pp. 243–253 (2020)
7.
go back to reference Fagan, D., Fenton, M., O’Neill, M.: Exploring position independent initialisation in grammatical evolution. In: 2016 IEEE Congress on Evolutionary Computation (CEC), pp. 5060–5067. IEEE (2016) Fagan, D., Fenton, M., O’Neill, M.: Exploring position independent initialisation in grammatical evolution. In: 2016 IEEE Congress on Evolutionary Computation (CEC), pp. 5060–5067. IEEE (2016)
8.
go back to reference Forstenlechner, S., Nicolau, M., Fagan, D., O’Neill, M.: Introducing semantic-clustering selection in grammatical evolution. In: Proceedings of the Companion Publication of the 2015 Annual Conference on Genetic and Evolutionary Computation, pp. 1277–1284 (2015) Forstenlechner, S., Nicolau, M., Fagan, D., O’Neill, M.: Introducing semantic-clustering selection in grammatical evolution. In: Proceedings of the Companion Publication of the 2015 Annual Conference on Genetic and Evolutionary Computation, pp. 1277–1284 (2015)
9.
go back to reference Matsui, K.: New selection method to improve the population diversity in genetic algorithms. In: IEEE SMC 1999 Conference Proceedings. 1999 IEEE International Conference on Systems, Man, and Cybernetics (Cat. No. 99CH37028), vol. 1, pp. 625–630. IEEE (1999) Matsui, K.: New selection method to improve the population diversity in genetic algorithms. In: IEEE SMC 1999 Conference Proceedings. 1999 IEEE International Conference on Systems, Man, and Cybernetics (Cat. No. 99CH37028), vol. 1, pp. 625–630. IEEE (1999)
10.
go back to reference Mikolov, T., Sutskever, I., Chen, K., Corrado, G.S., Dean, J.: Distributed representations of words and phrases and their compositionality. In: Advances in Neural Information Processing Systems, vol. 26 (2013) Mikolov, T., Sutskever, I., Chen, K., Corrado, G.S., Dean, J.: Distributed representations of words and phrases and their compositionality. In: Advances in Neural Information Processing Systems, vol. 26 (2013)
11.
go back to reference O’Neill, M., Ryan, C.: Grammatical evolution. IEEE Trans. Evol. Comput. 5(4), 349–358 (2001)CrossRef O’Neill, M., Ryan, C.: Grammatical evolution. IEEE Trans. Evol. Comput. 5(4), 349–358 (2001)CrossRef
12.
go back to reference Pedregosa, F., et al.: Scikit-learn: machine learning in Python. J. Mach. Learn. Res. 12, 2825–2830 (2011)MathSciNetMATH Pedregosa, F., et al.: Scikit-learn: machine learning in Python. J. Mach. Learn. Res. 12, 2825–2830 (2011)MathSciNetMATH
13.
go back to reference Ryan, C., Azad, R.M.A.: Sensible initialisation in grammatical evolution. In: GECCO, pp. 142–145. AAAI (2003) Ryan, C., Azad, R.M.A.: Sensible initialisation in grammatical evolution. In: GECCO, pp. 142–145. AAAI (2003)
14.
go back to reference Ryan, C., Collins, J.J., Neill, M.O.: Grammatical evolution: evolving programs for an arbitrary language. In: Banzhaf, W., Poli, R., Schoenauer, M., Fogarty, T.C. (eds.) EuroGP 1998. LNCS, vol. 1391, pp. 83–96. Springer, Heidelberg (1998). https://doi.org/10.1007/BFb0055930CrossRef Ryan, C., Collins, J.J., Neill, M.O.: Grammatical evolution: evolving programs for an arbitrary language. In: Banzhaf, W., Poli, R., Schoenauer, M., Fogarty, T.C. (eds.) EuroGP 1998. LNCS, vol. 1391, pp. 83–96. Springer, Heidelberg (1998). https://​doi.​org/​10.​1007/​BFb0055930CrossRef
15.
go back to reference Shaker, N., Nicolau, M., Yannakakis, G.N., Togelius, J., O’neill, M.: Evolving levels for Super Mario Bros using grammatical evolution. In: 2012 IEEE Conference on Computational Intelligence and Games (CIG), pp. 304–311. IEEE (2012) Shaker, N., Nicolau, M., Yannakakis, G.N., Togelius, J., O’neill, M.: Evolving levels for Super Mario Bros using grammatical evolution. In: 2012 IEEE Conference on Computational Intelligence and Games (CIG), pp. 304–311. IEEE (2012)
Metadata
Title
Grammatical Evolution with Code2vec
Authors
Michał Kowalczykiewicz
Piotr Lipiński
Copyright Year
2023
DOI
https://doi.org/10.1007/978-3-031-29573-7_14

Premium Partner