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

Question about the data cleaning function #1

Open
scottshufe opened this issue Dec 12, 2024 · 0 comments
Open

Question about the data cleaning function #1

scottshufe opened this issue Dec 12, 2024 · 0 comments

Comments

@scottshufe
Copy link

Hi, thanks for your excellent work!

I find that the data cleaning process does not seem to successfully filter out users with less than 10 interactions.

casper/src/util.py

Lines 20 to 28 in 23012d8

users = users[counts>=10]
sequence_dic = {int(user):[] for user in set(raw_data[:,0])}
new_data = []
for i in range(raw_data.shape[0]):
if int(raw_data[i,0]) in user_dic:
new_data.append([int(raw_data[i,0]),int(raw_data[i,1]),raw_data[i,2],0])
new_data = np.array(new_data)

Although the variable "users" in Line 20 refers to those users having more than 10 interactions, it has not been used in the following codes. Could you please check this issue?

I suggest modifying this part of codes as follows:

users = users[counts >= 10]
# sequence_dic = {int(user): [] for user in set(raw_data[:, 0])}
sequence_dic = {int(user): [] for user in users}
new_data = []
for i in range(raw_data.shape[0]):
    # if int(raw_data[i, 0]) in user_dic:
    if int(raw_data[i, 0]) in users:
        new_data.append([int(raw_data[i, 0]), int(raw_data[i, 1]), raw_data[i, 2], 0])

new_data = np.array(new_data)

Thank you very much.

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

No branches or pull requests

1 participant