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

Add time sensitive approach #151

Open
wants to merge 1 commit into
base: 149-reproduce
Choose a base branch
from
Open

Add time sensitive approach #151

wants to merge 1 commit into from

Conversation

mcollardanuy
Copy link
Collaborator

No description provided.

@kasra-hosseini
Copy link
Member

@mcollardanuy I reviewed the implementation of weighted_gauss function (as I think the other changes are related to using weighted_gauss in the pipeline)

My only comment is on these lines:

https://github.com/Living-with-machines/TargetedSenseDisambiguation/blob/try-gauss/tasks/wsd.py#L244-L245

I was wondering if it is easier to work with offset and scale directly without weighting them by (max_date-min_date). Here is one example if you want to try it yourself (well, it is based on your code):

import matplotlib.pyplot as plt
import numpy as np

origin = 1850
min_date = 1800
max_date = 1900
year_arr = np.linspace(min_date, max_date, 100)
year_arr = np.sort(year_arr)

offset = 10.0
scale = 10.0

#offset = offset * (max_date-min_date)
#scale = scale * (max_date-min_date)

d = (abs(year_arr - origin)).clip(offset, None)
expr = 2**(-((d-offset)/scale)**2)

plt.plot(year_arr, expr)
plt.axvline(origin - offset, 0, 1, color="r", ls="--")
plt.axvline(origin + offset, 0, 1, color="r", ls="--")
plt.axvline(origin - offset - scale, 0, 1, color="g", ls="--")
plt.axvline(origin + offset + scale, 0, 1, color="g", ls="--")
plt.show()

@kasra-hosseini
Copy link
Member

The output of the above code is:

Screenshot 2021-05-25 at 11 44 11

@kasra-hosseini
Copy link
Member

which gives an easy way to control the flat top, scale and etc... Of course, the following also works:

offset = offset * (max_date-min_date)
scale = scale * (max_date-min_date)

but probably the first method is easier to control for this application?

@kasra-hosseini
Copy link
Member

Otherwise, it is good from my side.

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.

2 participants