Skip to content

Duplicate functions and unclear link function #252

@BaihengChen

Description

@BaihengChen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions