-
Notifications
You must be signed in to change notification settings - Fork 0
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
Goal seek update #232
base: master
Are you sure you want to change the base?
Goal seek update #232
Conversation
…to goal-seek-update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I understand most of what is going on here. I think this probably belongs in another library and there are a few changes I'd like to make to it so we aren't doing things like writing the data out and re-reading it.
I wonder if the first step would be to make it so that run-send-model
returns better things that we can report on in better ways using adroddiad, but also allow us to access what is there in memory if we want to. (which would dump almost all of witan.send.output)
@@ -15,7 +15,8 @@ | |||
org.apache.commons/commons-math3 {:mvn/version "3.6.1"} | |||
;; upgrading to 2.1.10 causes a test to fail | |||
org.hdrhistogram/HdrHistogram {:mvn/version "2.1.9" #_"2.1.12"} | |||
same/ish {:mvn/version "0.1.4"}} | |||
same/ish {:mvn/version "0.1.4"} | |||
witan.send.adroddiad/witan.send.adroddiad {:local/root "../witan.send.adroddiad"}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I'm worried about this dependency. I think we'll get away with it as we use adroddiad as a library, but you are right that we should split this out of the model.
@@ -93,6 +93,9 @@ | |||
(def secondary-school | |||
(into key-stage-3 key-stage-4)) | |||
|
|||
;; Key Stages 1 to 5 | |||
(def school-age (reduce #(into %1 %2) (sorted-set) [primary-school secondary-school key-stage-5])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is handy. thx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seb231 I'd like to merge this bit even if we don't merge the rest but move it to another library
src/clj/witan/send/goal_seek.clj
Outdated
[witan.send.adroddiad.simulated-transition-counts :as stc] | ||
[witan.send.adroddiad.simulated-transition-counts.io :as stcio] | ||
[witan.send.adroddiad.summary :as summary])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would be fine if goal-seek was a separate lib
src/clj/witan/send/goal_seek.clj
Outdated
(let [result (->> baseline | ||
(filter #(and (= (:calendar-year %) year) | ||
(every? identity (witan.send.model.prepare/test-predicates % state-map)))) | ||
(map #(select-keys % [:population :median])) | ||
(apply merge-with +))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the data is small enough at this point that it doesn't matter that it is ->> rather than a transduce.
src/clj/witan/send/goal_seek.clj
Outdated
(every? identity (witan.send.model.prepare/test-predicates % state-map)))) | ||
(map #(select-keys % [:population :median])) | ||
(apply merge-with +))] | ||
(get result :population (get result :median)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to use summary
if we only want the median for goal-seek
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No probably not. Didn't really think about the fact that we could calculate it separately.
src/clj/witan/send/goal_seek.clj
Outdated
(filter #(and (= (:calendar-year %) year) | ||
(every? identity (witan.send.model.prepare/test-predicates % state-map)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like the important line I need to understand and I don't. I'm not sure why you are selecting things here to be summed later.
src/clj/witan/send/goal_seek.clj
Outdated
result (tc/dataset (eduction stcio/simulated-transitions->transition-counts-xf (:simulated-transitions projection))) | ||
census (stc/transition-counts->census-counts result (apply min (:calendar-year result))) | ||
summary (summary/seven-number-summary census [:calendar-year :setting :need :academic-year] :transition-count) | ||
target-pop-result (get-baseline-population (tc/rows summary :as-maps) target-year (dissoc m :modify-transition-by))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is possible to write get-baseline-population
as a tmd/tc thing that might run faster.
(let [pred-map (-> pred-map | ||
(rename-keys {:setting :setting-2, :need :need-2 :academic-year :academic-year-2}) | ||
(update :setting-2 keyword) | ||
(update :need-2 keyword)) | ||
result (filter (fn [t] (every? identity (test-predicates t pred-map))) transitions)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand why this is happening.
I think we already discussed this, but goal-seek doesn't output any files (or read in again) until it's found the optimum modifier |
Agreed that this needs to not be merged and moved to it's only library |
9b0a3c6
to
d56e1c8
Compare
d56e1c8
to
f06b7af
Compare
No description provided.