Closed gabeschoenbach closed 3 years ago
Lots of good stuff here - I like the switch to groups[0], groups[1] and think there will be more we can do down the line to keep making RxC and 2x2 more compatible (we're probably due for a bigger refactor there at some point, but I want to wait until we have the last couple methods implemented first). Glad you caught and fixed the percentile/probability issue, and thanks for putting in a corresponding test too!
Added the
RxC
polarization functions, and then provided tests for both the2x2
andRxC
versions.RxC
polarization function:2x2
: thegroups
the user is interested in, and thecandidate
upon which to compare preferences.Changes to the
2x2
polarization functions include:probability
/percentile
issue —np.percentile()
takes in a number between 0 and 100, not 0 and 1, so changed the arguments topercentile
instead ofprobability
and adjusted the arithmetic inside the function to give the correct results.group
andgroup_complement
togroups[0]
andgroups[1]
to better match the behavior of theRxC
function.plot_polarization_kde()
function to acceptgroups
so that it can be called on either the2x2
orRxC
polarization reports.Tests:
plot_polarization_kde()
function just by checking aMatplotlib
Axis
is returned.polarization_report()
: increasing the threshold should decrease the probability and decreasing the probability should increase the threshold.Also updated the
.pylintrc
config file to not ignore comments, since I have some duplicate code that should pass the linting. So then I just added some small comments around this duplicate code to get it to pass — a bit of a hack. Finally, added examples in both the2x2
andRxC
Santa Clara demo notebooks!