Calinski-Harabasz index for optimal LS partition

Input: partition Π of the set 𝒜 ⊂ (ℝ^n);
Output: CH index of the partition Π;
Submodules: WF[],WG[]

Clear[VCH]
VCH[PI_]:=Module[{k=Length[PI],m,FF,mj,F,G},
FF=Table[0,{j,Length[PI]}];
m=Sum[Length[PI[[j]]],{j,Length[PI]}];
z=Table[Mean[WeightedData[PI[[j,All,2]],PI[[j,All,1]]]],{j,Length[PI]}];
set=Flatten[PI,1];
cc=Mean[WeightedData[set[[All,2]],set[[All,1]]]];
Do[
mj=Length[PI[[j]]];
FF[[j]]=Sum[PI[[j,s,1]]*Norm[PI[[j,s,2]]-z[[j]] ]^2,{s,mj}];
   ,{j,Length[PI]}];
F=Total[FF];
G=Sum[Sum[PI[[j,s,1]],{s,Length[PI[[j]]]}]*Norm[z[[j]]-cc]^2,{j,Length[PI]}];
(m-Length[PI])*G/((Length[PI]-1)F)
                                     ]