function C=initng(X) % Initialize a structure that contains the cluster centers and the % parameters and other things that we need for Neural Gas, including the % connection matrix. % % The centers are in C.cen % The connections are in C.M [M,N]=size(X); % Parameters need to be set up first: C.NC=50; %Number of clusters C.lr=[0.3 0.05]; %initial, final learning rate epsilon C.nbr= [0.01*N 0.01]; %initial, final lambda (neighborhood size) C.tcon=[5*N 80*N]; %initial, final time (for connection matrix) C.tmax=200*N; %max number of iterations C.epochs=1; %number of epochs (each epoch runs tmax iterations, %and resets the training parameters after each.) C.tflag=1; %Training flag: 1=Use Connection, 0=Do not use Id=randperm(N); C.cen= X(:,Id(1:C.NC)); %Initialize the centers randomly from the data C.M=zeros(C.NC,C.NC); %Initialize the connection matrix (if tflag=1)