Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Washington's updates to calibration 0.3 and 0.4 - part 1 #200

Merged
merged 11 commits into from
Dec 16, 2017
3 changes: 1 addition & 2 deletions examples/daisy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ local m = MultipleRuns{
model = Daisyworld,
parameters = {
sunLuminosity = Choice{min = 0.4, max = 1.6, step = 0.01},
},
output = {"blackArea", "whiteArea", "emptyArea"}
}
}

chart = Chart{
Expand Down
3 changes: 1 addition & 2 deletions examples/sir-mr-campaign.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ runs = MultipleRuns{
model = SIR,
parameters = {
maximum = Choice{min = 100, max = 4000, step = 10}
},
output = {"maxInfected", "susceptible"}
}
}

chart = Chart{
Expand Down
1 change: 0 additions & 1 deletion examples/sir-mr-probability.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ runs = MultipleRuns{
probability = Choice{min = 0.05, max = 0.3, step = 0.001}
},
--output = {"infected", "probability"} -- error!
output = {"susceptible", "maxInfected"}
}

chart = Chart{
Expand Down
32 changes: 10 additions & 22 deletions lua/GoodnessOfFit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -259,47 +259,35 @@ multiLevel = function(data)
end

local fitnessSum = pixelByPixel(data.cs1, data.cs2, data.attribute, data.attribute, data.continuous)
local fitChart = Cell{sqrFit = fitnessSum}
if data.graphics == true then
Chart{ --SKIP
title = "MultiLevel Results", --SKIP
target = fitChart, --SKIP
select = {"sqrFit"} --SKIP
} --SKIP
fitChart:notify(0) --SKIP
end

local fitSquareTable = {}
local resolutionTable = {}
table.insert(fitSquareTable, fitnessSum)
table.insert(resolutionTable, 0)
if data.continuous == true then
for i = 1, (largerSquare) do
-- increase the square size and calculate fitness for each square.
local fitSquare = continuousSquareBySquare(i, data.cs1, data.cs2, data.attribute)
if fitSquare ~= -1 then
if data.graphics == true then
fitChart.sqrFit = fitSquare --SKIP
fitChart:notify(i) --SKIP
end

table.insert(fitSquareTable, fitSquare)
table.insert(resolutionTable, i)
fitnessSum = fitnessSum + (fitSquare * math.exp(-k * 2 ^ (i - 1)))
exp = exp + math.exp(-k * 2 ^ (i - 1))
end
end

else
for i = 1, (largerSquare) do
-- increase the square size and calculate fitness for each square.
local fitSquare = newDiscreteSquareBySquare(i, data.cs1, data.cs2, data.attribute)
if fitSquare ~= -1 then
if data.graphics == true then
fitChart.sqrFit = fitSquare --SKIP
fitChart:notify(i) --SKIP
end

table.insert(fitSquareTable, fitSquare)
table.insert(resolutionTable, i)
fitnessSum = fitnessSum + (fitSquare * math.exp(-k * 2 ^ (i - 1)))
exp = exp + math.exp(-k * 2 ^ (i - 1))
end
end
end

local fitness = fitnessSum / exp
return fitness
local df = DataFrame{fit = fitSquareTable, resolution = resolutionTable}
return fitness, df
end
Loading