Skip to content

Issue in collaborative filtering code #2

Description

@schopra6

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions