Skip to content

Commit

Permalink
Change random generation mutation
Browse files Browse the repository at this point in the history
It will now generate a tree of random size, rather than one of size 5.
  • Loading branch information
MilesCranmer committed Mar 9, 2022
1 parent 9508016 commit cd56d44
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Mutate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using FromFile
@from "LossFunctions.jl" import scoreFunc, scoreFuncBatch
@from "CheckConstraints.jl" import check_constraints
@from "PopMember.jl" import PopMember
@from "MutationFunctions.jl" import genRandomTree, mutateConstant, mutateOperator, appendRandomOp, prependRandomOp, insertRandomOp, deleteRandomOp, crossoverTrees
@from "MutationFunctions.jl" import genRandomTreeFixedSize, mutateConstant, mutateOperator, appendRandomOp, prependRandomOp, insertRandomOp, deleteRandomOp, crossoverTrees
@from "SimplifyEquation.jl" import simplifyTree, combineOperators, simplifyWithSymbolicUtils
@from "Recorder.jl" import @recorder

Expand Down Expand Up @@ -110,7 +110,11 @@ function nextGeneration(dataset::Dataset{T},
# to commutative operator...

elseif mutationChoice < cweights[7]
tree = genRandomTree(5, options, nfeatures) # Sometimes we generate a new tree completely tree
# Sometimes we generate a new tree completely tree
# We select a random size, though the generated tree
# may have fewer nodes than we request.
tree_size_to_generate = rand(1:curmaxsize)
tree = genRandomTreeFixedSize(tree_size_to_generate, options, nfeatures)
@recorder tmp_recorder["type"] = "regenerate"

is_success_always_possible = true
Expand Down

0 comments on commit cd56d44

Please sign in to comment.