Giter VIP home page Giter VIP logo

juliagsgp's Introduction

JuliaGSGP

JuliaGSGP is a Julia implementation of Geometric Semantic Genetic Programming (GSGP) based on [1].

JuliaGSGP also includes implementations of Deterministic GSGP (with optimal mate selection)[2] and PrGP[3].

Documentation will be provided in the future.

Exapmle

using JuliaGSGP
using CSV, DataFrames
using ScikitLearn: CrossValidation.train_test_split

df = CSV.read("path/to/dataset", DataFrame)
df = df[2:end]
data = convert(Matrix, df)
X = data[:, 1:end-1]
y = data[:, end]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=1)
X_train = X_train' # columns corresponds to one instances
X_test = X_test'

aq(a, b) = a / sqrt(1+b^2)

pset = PrimitiveSet()
add_function!(pset, +, 2) #(pset, function, arity)
add_function!(pset, -, 2)
add_function!(pset, *, 2)
add_function!(pset, aq, 2)

for i in 1:size(X)[2]
    add_variable!(pset, i)
end

cfg = Config(population_size=100, num_generations=100, p_crossover=0.5, p_mutation=0.5, mutation_step=0.01, min_depth=1, max_depth=6, tournament_size=4, pset=pset, create_rand_tree=generate_grow, create_population=ramped_half_and_half, fitness=rmse)

best_idx, rec = gsgp(cfg, X_train, y_train, X_test, y_test);

# `reconstruct_tree()` will take long time to execute.
tree = reconstruct_tree(best_idx, cfg,mutation_step)

References

[1] Vanneschi L., Castelli M., Manzoni L., Silva S. (2013) A New Implementation of Geometric Semantic GP and Its Application to Problems in Pharmacokinetics. In: Krawiec K., Moraglio A., Hu T., Etaner-Uyar A.Ş., Hu B. (eds) Genetic Programming. EuroGP 2013. Lecture Notes in Computer Science, vol 7831. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-37207-0_18

[2] A. Hara, J. Kushida and T. Takahama, "Deterministic Geometric Semantic Genetic Programming with Optimal Mate Selection," 2016 IEEE International Conference on Systems, Man, and Cybernetics (SMC), Budapest, 2016, pp. 003387-003392, doi: 10.1109/SMC.2016.7844757.

[3] Graff, Mario & Tellez, Eric & Villaseñor García, Elio & Miranda-Jiménez, Sabino. (2015). Semantic Genetic Programming Operators Based on Projections in the Phenotype Space. Research in Computing Science. 94. 10.13053/rcs-94-1-6.

juliagsgp's People

Contributors

kogad avatar github-actions[bot] avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.