/** * Prepare a Chain. One of the following:<br> * - Use pre-set chain. If there is none, then <br> * - Use default chain (1,2,...,L). Unless a different random seed has been set, then <br> * - Use a random chain. * @param L number of labels */ protected void prepareChain(int L) { int chain[] = retrieveChain(); // if has not yet been manually chosen ... if (chain == null) { // create the standard order (1,2,...,L) .. chain = A.make_sequence(L); // and shuffle if m_S > 0 if (m_S != 0) { m_R = new Random(m_S); A.shuffle(chain,m_R); } } // set it prepareChain(chain); }
/** * Prepare a Chain. One of the following:<br> * - Use pre-set chain. If there is none, then <br> * - Use default chain (1,2,...,L). Unless a different random seed has been set, then <br> * - Use a random chain. * @param L number of labels */ protected void prepareChain(int L) { int chain[] = retrieveChain(); // if has not yet been manually chosen ... if (chain == null) { // create the standard order (1,2,...,L) .. chain = A.make_sequence(L); // and shuffle if m_S > 0 if (m_S != 0) { m_R = new Random(m_S); A.shuffle(chain,m_R); } } // set it prepareChain(chain); }
/** * BuildCC - Build a CC of chain-order 's' on dataset 'D'. */ protected CC buildCC(int s[], Instances D) throws Exception { // a new classifier chain CC h = new CC(); // build this chain h.prepareChain(s); h.setClassifier(m_Classifier); h.buildClassifier(new Instances(D)); return h; }
/** * BuildCC - Given a base classifier 'g', build a new CC classifier on data D, given chain order 'chain'. */ public static CC buildCC(int chain[], Instances D, Classifier g) throws Exception { // a new classifier chain CC h = new CC(); // build this chain h.prepareChain(chain); h.setClassifier(g); h.buildClassifier(new Instances(D)); return h; }
/** * BuildCC - Given a base classifier 'g', build a new CC classifier on data D, given chain order 'chain'. */ public static CC buildCC(int chain[], Instances D, Classifier g) throws Exception { // a new classifier chain CC h = new CC(); // build this chain h.prepareChain(chain); h.setClassifier(g); h.buildClassifier(new Instances(D)); return h; }
/** * BuildCC - Build a CC of chain-order 's' on dataset 'D'. */ protected CC buildCC(int s[], Instances D) throws Exception { // a new classifier chain CC h = new CC(); // build this chain h.prepareChain(s); h.setClassifier(m_Classifier); h.buildClassifier(new Instances(D)); return h; }
@Override public void buildClassifier(Instances D) throws Exception { testCapabilities(D); int L = D.classIndex(); prepareChain(L); /* * make a classifier node for each label, taking the parents of all previous nodes */ if(getDebug()) System.out.print(":- Chain ("); nodes = new CNode[L]; int pa[] = new int[]{}; for(int j : m_Chain) { if (getDebug()) System.out.print(" "+D.attribute(j).name()); nodes[j] = new CNode(j, null, pa); nodes[j].build(D, m_Classifier); pa = A.append(pa,j); } if (getDebug()) System.out.println(" ) -:"); // to store posterior probabilities (confidences) confidences = new double[L]; }
@Override public void buildClassifier(Instances D) throws Exception { testCapabilities(D); int L = D.classIndex(); prepareChain(L); /* * make a classifier node for each label, taking the parents of all previous nodes */ if(getDebug()) System.out.print(":- Chain ("); nodes = new CNode[L]; int pa[] = new int[]{}; for(int j : m_Chain) { if (getDebug()) System.out.print(" "+D.attribute(j).name()); nodes[j] = new CNode(j, null, pa); nodes[j].build(D, m_Classifier); pa = A.append(pa,j); } if (getDebug()) System.out.println(" ) -:"); // to store posterior probabilities (confidences) confidences = new double[L]; }