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

I don't think you are calculating the distances for updating the weights incorrectly #1

Open
raymondj-pace opened this issue Apr 11, 2022 · 0 comments

Comments

@raymondj-pace
Copy link

Hi, just a friendly note but I think it should be:

def updateWeights(weight_arr, C):
        denom = np.zeros(n)
        for i in range(n_clusters):
            
            dist = (X.iloc[:,:].values - centers[i])**2
            dist = np.sum(dist, axis=1)
            dist = np.sqrt(dist)
            dist = np.power(dist, 2) # I think this line is missing
            denom  = denom + np.power(1/dist, 1/(m-1))
            
        for i in range(n_clusters):
            dist = (X.iloc[:,:].values - centers[i])**2
            dist = np.sum(dist, axis=1)
            dist = np.sqrt(dist) # Up to here is the euclidean distance but for the equation for update the weights now squares the dist
            dist = np.power(dist, 2) # I think this line is missing
            weight_arr[:,i] = np.divide(np.power(1/dist, 1/(m-1)), denom)

  return weight_arr

I can't see your cell which has the equation for the computing the new weights - I'm not sure what is needed to fix that, I've never created an equation in a notebook cell....

(1 / (dist)^2)^(1/ (m-1)) / SUM(1 / (dist)^2)^(1/ (m-1))

@raymondj-pace raymondj-pace changed the title I don't think you are calculating the distances for updating the weights correctly I don't think you are calculating the distances for updating the weights incorrectly Apr 11, 2022
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