Re: InacessibleObjectException
Michael Hall <[email protected]> Tue, 22 Aug 2023 16:47:10 -0500
| Newsgroups | gmane.comp.ai.weka |
|---|---|
| Message-ID | <[email protected]> |
> On Aug 22, 2023, at 7:33 AM, [email protected] wrote: > > Hello everyone, > > I have the following code: > double[] evaluateGainRatio(Instances data) throws Exception{ > double[] gainRatios = new double[data.numAttributes()]; > for (int i = 0; i < data.numAttributes(); i++) { > GainRatioAttributeEval gainRatioAttributeEval = new GainRatioAttributeEval(); > gainRatioAttributeEval.buildEvaluator(data); > gainRatios[i] = gainRatioAttributeEval.evaluateAttribute(i); > } > return gainRatios; > } > > and the buildEvaluator method, throws an InaccessibleObjectException! > > Could you please help? > > Thank you for your time, > > Spyros Halkidis > _______________________________________________ I’m not sure but I think you might want to pull some of that out of the loop like… double[] evaluateGainRatio(Instances data) throws Exception{ double[] gainRatios = new double[data.numAttributes()]; GainRatioAttributeEval gainRatioAttributeEval = new GainRatioAttributeEval(); gainRatioAttributeEval.buildEvaluator(data); for (int i = 0; i < data.numAttributes(); i++) {. // or i < gainRatios.length gainRatios[i] = gainRatioAttributeEval.evaluateAttribute(i); } return gainRatios; } _______________________________________________ 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