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

Goal seek update #232

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open

Goal seek update #232

wants to merge 30 commits into from

Conversation

seb231
Copy link
Contributor

@seb231 seb231 commented Feb 1, 2022

No description provided.

@seb231 seb231 requested a review from otfrom February 1, 2022 09:30
@seb231 seb231 self-assigned this Feb 1, 2022
Copy link
Member

@otfrom otfrom left a 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"}}
Copy link
Member

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]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is handy. thx

Copy link
Member

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

Comment on lines 14 to 16
[witan.send.adroddiad.simulated-transition-counts :as stc]
[witan.send.adroddiad.simulated-transition-counts.io :as stcio]
[witan.send.adroddiad.summary :as summary]))
Copy link
Member

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

Comment on lines 106 to 110
(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 +))]
Copy link
Member

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.

(every? identity (witan.send.model.prepare/test-predicates % state-map))))
(map #(select-keys % [:population :median]))
(apply merge-with +))]
(get result :population (get result :median))))
Copy link
Member

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?

Copy link
Contributor Author

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.

Comment on lines 107 to 108
(filter #(and (= (:calendar-year %) year)
(every? identity (witan.send.model.prepare/test-predicates % state-map))))
Copy link
Member

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.

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))]
Copy link
Member

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.

Comment on lines +227 to +231
(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)]
Copy link
Member

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.

@seb231
Copy link
Contributor Author

seb231 commented Feb 14, 2022

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

@seb231
Copy link
Contributor Author

seb231 commented Feb 14, 2022

Agreed that this needs to not be merged and moved to it's only library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants