how to check convergence
    39 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Dion Liu
 el 5 de Sept. de 2018
  
    
    
    
    
    Comentada: KSSV
      
      
 el 5 de Sept. de 2018
            I want to stop this while loop if the means array does not change anymore, so basically when convergence occurs.
while i <= maxIterations
    k = size(seedMeans,1);
    means = UpdateMeans(A,k, clusters);
    i = i+1;
How should I do this?
0 comentarios
Respuesta aceptada
  KSSV
      
      
 el 5 de Sept. de 2018
        YOu have to proceed something like this:
means0 = 0 ;
while i <= maxIterations
    k = size(seedMeans,1);
    means = UpdateMeans(A,k, clusters);
    dm = means0-means ;
    means0 = means ;
    if abs(dm)<=10^-3
        break
    end
    i = i+1;
end
7 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


