Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
2554a3e
1
Parent(s):
1895300
Don't square weights
Browse files- julia/sr.jl +10 -4
- setup.py +1 -1
julia/sr.jl
CHANGED
@@ -6,12 +6,12 @@ const actualMaxsize = maxsize + maxdegree
|
|
6 |
|
7 |
# Sum of square error between two arrays
|
8 |
function SSE(x::Array{Float32}, y::Array{Float32})::Float32
|
|
|
9 |
if weighted
|
10 |
-
|
11 |
else
|
12 |
-
|
13 |
end
|
14 |
-
return sum(diff .* diff)
|
15 |
end
|
16 |
|
17 |
# Mean of square error between two arrays
|
@@ -20,7 +20,13 @@ function MSE(x::Array{Float32}, y::Array{Float32})::Float32
|
|
20 |
end
|
21 |
|
22 |
const len = size(X)[1]
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
const baselineSSE = SSE(y, convert(Array{Float32, 1}, ones(len) .* avgy))
|
25 |
|
26 |
id = (x,) -> x
|
|
|
6 |
|
7 |
# Sum of square error between two arrays
|
8 |
function SSE(x::Array{Float32}, y::Array{Float32})::Float32
|
9 |
+
diff = (x - y)
|
10 |
if weighted
|
11 |
+
return sum(diff .* diff .* weights)
|
12 |
else
|
13 |
+
return sum(diff .* diff)
|
14 |
end
|
|
|
15 |
end
|
16 |
|
17 |
# Mean of square error between two arrays
|
|
|
20 |
end
|
21 |
|
22 |
const len = size(X)[1]
|
23 |
+
|
24 |
+
if weighted
|
25 |
+
const avgy = sum(y .* weights)/len/sum(weights)
|
26 |
+
else
|
27 |
+
const avgy = sum(y)/len
|
28 |
+
end
|
29 |
+
|
30 |
const baselineSSE = SSE(y, convert(Array{Float32, 1}, ones(len) .* avgy))
|
31 |
|
32 |
id = (x,) -> x
|
setup.py
CHANGED
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
5 |
|
6 |
setuptools.setup(
|
7 |
name="pysr", # Replace with your own username
|
8 |
-
version="0.2.
|
9 |
author="Miles Cranmer",
|
10 |
author_email="[email protected]",
|
11 |
description="Simple and efficient symbolic regression",
|
|
|
5 |
|
6 |
setuptools.setup(
|
7 |
name="pysr", # Replace with your own username
|
8 |
+
version="0.2.2",
|
9 |
author="Miles Cranmer",
|
10 |
author_email="[email protected]",
|
11 |
description="Simple and efficient symbolic regression",
|