public void assignSubToCenters ( KDTreeNode node , Instances centers , int [ ] centList , int [ ] assignments ) throws Exception { // todo: undecided situations int numCent = centList . length ; // WARNING: assignments is "input/output-parameter" // should not be null and the following should not happen if ( assignments == null ) { assignments = new int [ m_Instances . numInstances ( ) ] ; for ( int i = 0 ; i < assignments . length ; i ++ ) { assignments [ i ] = - 1 ; } } // set assignments for all instances of this node for ( int i = node . m_Start ; i <= node . m_End ; i ++ ) { int instIndex = m_InstList [ i ] ; Instance inst = m_Instances . instance ( instIndex ) ; // if (instList[i] == 664) System.out.println("664***"); int newC = m_EuclideanDistance . closestPoint ( inst , centers , centList ) ; // int newC = clusterProcessedInstance(inst, centers); assignments [ instIndex ] = newC ; } }
Assigns instances of this node to center . Center to be assign to is decided by the distance function .