Spaces:
Running
Running
Commit
·
c4bc4e3
1
Parent(s):
ea6850d
Make parsimony relative to baseline loss
Browse files
eureqa.jl
CHANGED
|
@@ -16,7 +16,8 @@ function MSE(x::Array{Float32}, y::Array{Float32})::Float32
|
|
| 16 |
end
|
| 17 |
|
| 18 |
const len = size(X)[1]
|
| 19 |
-
const
|
|
|
|
| 20 |
|
| 21 |
id = (x,) -> x
|
| 22 |
const nuna = size(unaops)[1]
|
|
@@ -242,7 +243,7 @@ end
|
|
| 242 |
# Score an equation
|
| 243 |
function scoreFunc(tree::Node)::Float32
|
| 244 |
try
|
| 245 |
-
return
|
| 246 |
catch error
|
| 247 |
if isa(error, DomainError)
|
| 248 |
return 1f9
|
|
|
|
| 16 |
end
|
| 17 |
|
| 18 |
const len = size(X)[1]
|
| 19 |
+
const avgy = sum(y)/len
|
| 20 |
+
const baselineSSE = SSE(y, convert(Array{Float32, 1}, ones(len) .* avgy))
|
| 21 |
|
| 22 |
id = (x,) -> x
|
| 23 |
const nuna = size(unaops)[1]
|
|
|
|
| 243 |
# Score an equation
|
| 244 |
function scoreFunc(tree::Node)::Float32
|
| 245 |
try
|
| 246 |
+
return SSE(evalTreeArray(tree), y)/baselineSSE + countNodes(tree)*parsimony
|
| 247 |
catch error
|
| 248 |
if isa(error, DomainError)
|
| 249 |
return 1f9
|