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

Issue in collaborative filtering code #2

Open
schopra6 opened this issue Jul 4, 2023 · 0 comments
Open

Issue in collaborative filtering code #2

schopra6 opened this issue Jul 4, 2023 · 0 comments

Comments

@schopra6
Copy link

schopra6 commented Jul 4, 2023

Hi , Could you please explain what you are trying to do in this part of the code.

for clust in range (0, num_clusters): 

        alpha = clust_to_items_1[clust, :]
        alpha_beta = beta.multiply(alpha)
        sum_row = alpha_beta.sum(1)[0, 0]
        num_nonzero = alpha_beta.nonzero()[1].__len__() + 0.001
        to_impute = sum_row/num_nonzero
        Z = np.repeat(to_impute, beta.shape[1])
        alpha_z = alpha.multiply(Z)
        idx = beta.nonzero()
        alpha_z[idx] = beta.data

It seems alpha_z was supposed to collection of beta.data instead getting reassigned at every iteration.

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