IFitData with Tuple breaks the fit
Brought to you by:
korry
Consider the following scenario:
Create an IFtData instance.
Create a connection with a tuple and an IEvaluator (list).
Trying to fit to this IFitData fails, because
File "/nfs/slac/g/lcd/mc/prj/sw/extern/python2.4/lib/python2.4/site-packages/paida/paida_core/IFitter.py", line 274, in fit
inRangeData = self._getInRangeData(fitData)
File "/nfs/slac/g/lcd/mc/prj/sw/extern/python2.4/lib/python2.4/site-packages/paida/paida_core/IFitter.py", line 471, in _getInRangeData
errorsP = fitData._connection[2]
IndexError: list index out of range
This in turn is caused by line 471 in IFitData.py:
self._connection = [centers, weights]
So, because the errors are undefined when creating the connection with a tuple, the fit fails.
Logged In: YES
user_id=734761
Originator: NO
I think your PAIDA files seem not to be updated. At least from the release 3.2.1_2.9, "self._connection = [centers, weights]" is not used. Would you check the release number in paida/paida_core/IConstants.py?
simple script to reproduce the problem
Logged In: YES
user_id=1366327
Originator: YES
Hi Koji,
thanks for the quick response.
Hmm, I don't know what happened, but it seems you were right.
I updated to cvs head, but now I have a new problem.
I applied the following patch
425d424
< evaluator.initialize(iTuple)
436c435
< for i in range(len(colData) - 1):
---
> for i in range(len(colNames) - 1):
and now I am stuck here
IFitter.py", line 290, in fit
x = binData[0][0]
IndexError: list index out of range
when trying to fit
result = fitter.fit(fitData, 'G')
in this case fitData is an IFitData instance that has been connected to a tuple and an IEvaluator.
Please see attachments.
File Added: bug.py
Logged In: YES
user_id=1366327
Originator: YES
File Added: bug.aida
aida file to go along with bug.py
Logged In: YES
user_id=1366327
Originator: YES
I followed th bug a bit more through the code.
The initialization of the IEvaluator should happen outside of the loop over the tuple.
It seems that the problem is that in IFitData.createConnection center is of length 1, so that centers becomes an array of empty arrays and all information is stored in the weights.
That's as far as I got.
Hope that helps.
Logged In: YES
user_id=1366327
Originator: YES
This is really a separate issue, but
trying to use createConnection with a list of strings as the second argument fails, too.
File "/nfs/slac/g/lcd/mc/prj/sw/extern/python2.4/lib/python2.4/site-packages/paida/paida_core/IFitData.py", line 371, in createConnection
evaluators.append(iTuple.getDouble)
NameError: global name 'evaluators' is not defined
Logged In: YES
user_id=734761
Originator: NO
Both of the two bugs seem to be fixed.