Open BaihengChen opened 2 months ago
Hey @BaihengChen, I agree with both of these. This likely occurred as a result of a past refactor where we aggregated these various functions from different files into contextualized.functions
. If you'd like to take a shot at making the fixes, I think this could be a great first contribution.
Thanks for your reply! I will try to create a new fork and PR it later after I fix this!
For contextualized/functions.py,
Qusetion 1:
def linear(x, slope, intercept): return x * slope + intercept
def linear_link(x, slope, intercept): return x * slope + intercept
def linear_link_constructor(slope=1, intercept=0): return make_fn(linear_link, slope=slope, intercept=intercept)
def linear_constructor(slope=1, intercept=0): return make_fn(linear, slope=slope, intercept=intercept)
It seems like "linear_link" and "linear" is the same function. I wonder do we need both of them in the project?
Question 2:
LINK_FUNCTIONS = { "identity": linear_link_constructor(), "logistic": logistic_constructor(), "softmax": softmax_link_constructor(), }
After defining all the necessary functions, I noticed that the key-value pair "identity": linear_link_constructor() is a little bit weird. From the defalt parameters, linear function with slope=1 and intercept=0, linear_link is exactly identity function. But if we provide different input parameters, linear_link will no longer equals to the identity function. I wonder if this is a typo and do we need to fix this.