this.m_localModel is null

[email protected] Tue, 29 Aug 2023 14:58:21 -0000
Newsgroups gmane.comp.ai.weka
Message-ID <169332110191.2673.12708139889905008956@sys-mailman-prd.its.waikato.ac.nz>
Hello everyone,

I try to create the subtrees for C4.5 (J48) with the following code:

Instances[] localInstances=null;
        if (m_localModel.numSubsets() > 1) {
            localInstances = m_localModel.split(data);

            m_sons = new ClassifierTree[m_localModel.numSubsets()];
            for (int i = 0; i < m_sons.length; i++) {
                ClassifierTree newTree = new ClassifierTree(m_toSelectModel);
                localInstances[i].setClassIndex(localInstances[i].numAttributes() - 1);
                newTree.buildTree(localInstances[i], false);
                m_sons[i]=newTree;
                SiteMain siteMain = new SiteMain(hosts, ports, index, fullDatasetPath, noParties, m_sons[i].getTrainingData(), true);
            }

        } else {
            m_isLeaf = true;
            if (Utils.eq(data.sumOfWeights(), 0)) {
                m_isEmpty = true;
            }

        }

I get a NullPointerException, namely the following:

java.lang.NullPointerException: Cannot invoke "weka.classifiers.trees.j48.ClassifierSplitModel.numSubsets()" because "this.m_localModel" is null
	at weka.finito.training.SiteMain.<init>(SiteMain.java:167)
	at weka.finito.training.SiteMain.<init>(SiteMain.java:188)
	at weka.finito.training.SiteMain.main(SiteMain.java:113)

Before this code I have the following:
m_insts_union = mydata;
m_insts_union.setClassIndex(data.numAttributes() - 1);
m_toSelectModel = new BinC45ModelSelection(2, m_insts_union, true, false);
m_localModel = m_toSelectModel.selectModel(m_insts_union);

Is there a way to set m_localModel outside the Weka code?
I saw, there exists a getLocalModel method but no setLocalModel method!

Thank you for your time,

Spyros Halkidis
_______________________________________________
Wekalist mailing list -- [email protected]
Send posts to [email protected]
To unsubscribe send an email to [email protected]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html