MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

thanks and further question

  • To: mathgroup at
  • Subject: [mg89013] thanks and further question
  • From: Francisco Gutierrez <fgutiers2002 at>
  • Date: Fri, 23 May 2008 03:11:00 -0400 (EDT)

Many thanks (with a time lag, due to a terrible flu) to Daniel, Szabolcs, and the other friends who offered me solutions.
  My problems is that I want something like a NestWhileList which compares the penultimate and the last results until they are very near. I want this because full convergence is not guaranteed.
  I think I'd rather show all my code, with the risk of cluttering this message. This is a clustering code, so it implies having a list of centers and a dataset.
  First two auxiliary functions:
  losmus[punto_,prototipo_,centro_]:=Module[{alfin=Map[Total,Table[(punto-prototipo[[i]])^2,{i,1,Length[punto]}]]},Total[Table[alfin[[centro]]/alfin[[i]],{i,1,Length[alfin]}]]^-1 //N]
  Then the main function, which finds centers and level of belonging of each point:
  veamos[dataset_,prototipos_]:=Module[{centros=Range[Length[prototipos]], musitos},musitos=Table[Table[losmus[dataset[[i]], prototipos,centros[[j]]], {i,1, Length[dataset]}],{j,1,Length[centros]}]; Table[update[dataset, musitos[[i]]],{i,1,Length[musitos]}]]
  And then this, which works well with the majority of examples, but which clearly might not work:
  FixedPointList[veamos[dataset,#] &,prototipos, 10]
  So, as said above, what I want is to create a criterion that makes the function stop whenever the difference between the last two centers is less than, say, 0.01 (using, for example, an Euclidean distance or in general any type of distance).

  • Prev by Date: "Reduce" wierdness (or too slow?)
  • Next by Date: Re: Re: On which OS is Mathematica best implemented?
  • Previous by thread: Re: "Reduce" wierdness (or too slow?)
  • Next by thread: Re: thanks and further question