Fixing python demo 6, where the multivariate array conversion wasn't working for Python3 with Jpype. Fixed to use recommended array conversion as per UseInPython wiki. Addresses issue raised in PR #87 also.

This commit is contained in:
jlizier 2022-09-05 23:13:52 +10:00
parent 2b0a5cb943
commit 65aa685d11
1 changed files with 2 additions and 2 deletions

View File

@ -92,7 +92,7 @@ miCalc = miCalcClass()
# a. Initialise the calculator for a univariate calculation: # a. Initialise the calculator for a univariate calculation:
miCalc.initialise(1, 1) miCalc.initialise(1, 1)
# b. Supply the observations to compute the PDFs from: # b. Supply the observations to compute the PDFs from:
miCalc.setObservations(univariateSeries1, univariateSeries2) miCalc.setObservations(JArray(JDouble, 1)(univariateSeries1.tolist()), JArray(JDouble, 1)(univariateSeries2.tolist()))
# c. Make the MI calculation: # c. Make the MI calculation:
miUnivariateValue = miCalc.computeAverageLocalOfObservations() miUnivariateValue = miCalc.computeAverageLocalOfObservations()
@ -103,7 +103,7 @@ miUnivariateValue = miCalc.computeAverageLocalOfObservations()
# to use the required number of dimensions for each variable: # to use the required number of dimensions for each variable:
miCalc.initialise(len(jointVariable1Columns), len(jointVariable2Columns)) miCalc.initialise(len(jointVariable1Columns), len(jointVariable2Columns))
# b. Supply the observations to compute the PDFs from: # b. Supply the observations to compute the PDFs from:
miCalc.setObservations(jointVariable1, jointVariable2) miCalc.setObservations(JArray(JDouble, 2)(jointVariable1.tolist()), JArray(JDouble, 2)(jointVariable2.tolist()))
# c. Make the MI calculation: # c. Make the MI calculation:
miJointValue = miCalc.computeAverageLocalOfObservations() miJointValue = miCalc.computeAverageLocalOfObservations()