JamesSaxon / access-old

Python module to calculate spatial access scores.
http://access.readthedocs.io
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

FCA, 2SFCA, E2SFCA, 3SFCA working, documented, tested #27

Closed 20bryan closed 5 years ago

20bryan commented 5 years ago

@JamesSaxon @jkoschinsky Brief Status Update:

Questions: How should the default weighting function for 2-Stage be administered? I can't always define a default weighting function for 2-Stage specifically, or else 2-Stage would always be enhanced 2-Stage.

Can I add a normalize parameter to the FCA method headers in the access class? You can ask to normalize the access values now, but the current method headers in the access class don't pass in this normalize boolean parameter.

For the weight_fn function in the weights file, if the time t is greater than all the keys of the user-inputted stepwise dictionary, the last value of the dictionary is returned (AKA the smallest weight). I did this in order to match how the weighting function for 3-Stage in Jamie's gist, t_to_w3, operates.

As shown below, for all time t greater than 40 minutes and going up to 60 minutes, t_to_w3 returns .042. The point is that, here, the max_cost of 60 minutes is applied in t_to_w3. In the weight_fn function in the weights file, the responsibility of having a max_cost upper limit falls to the user to implement that max_cost somewhere else.

The other option is that the weight_fn returns 0 for any time t greater than the keys of the dictionary. I'm just checking in to ensure that the current way weight_fn runs is the desired way.

w3 = {1 : 0.962, 2 : 0.704, 3 : 0.377, 4 : 0.042}
def t_to_w3(t, scale = 1.0):
    v = int(t / 10. / scale) + 1
    if v > 6: return 0
    if v > 4: v = 4

    return w3[v]
JamesSaxon commented 5 years ago

Hi Bryan --

Thanks for the fixes, in particular for changing to the indexes. "Weaving" those through was probably a bit of work, but hopefully it will be cleaner now that it's done. And getting all the debugging "set" is huge.

These questions are all super "on point" and thoughtful! Great!

How should the default weighting function for 2-Stage be administered? I can't always define a default weighting function for 2-Stage specifically, or else 2-Stage would always be enhanced 2-Stage.

Make another e2sfca function that just sets the default weights.

Can I add a normalize parameter to the FCA method headers ...

Yes, absolutely. But I might make it so that the raw values are returned and saved in self.demand_df and then the parameter (either passed to the function, or afterwards in accessor (like a.norm_access) just calculate the weighted sum and divide this out. If you have the raw values you can always swap towards normed, but not vice versa.

For the weight_fn function in the weights file, if the time t is greater than all the keys of the user-inputted stepwise dictionary, the last value of the dictionary is returned (AKA the smallest weight). I did this in order to match how the weighting function for 3-Stage in Jamie's gist, t_to_w3, operates.

I think that's not right. See FCA2 or FCA3 in the gist. If the integer is higher than the number of steps (as I wrote it), it returns 0. That is the behavior that you should create as well.

The other option is that the weight_fn returns 0 for any time t greater than the keys of the dictionary.

Yes -- that's right, and as in the code you quote from the gist, that's what it does....

Thanks!

Jamie