douglasrizzo / catsim

Computerized Adaptive Testing Simulator
GNU Lesser General Public License v3.0
124 stars 35 forks source link

Fix normalize_item_bank(...) #22

Closed frankier closed 3 years ago

frankier commented 3 years ago

Currently calling normalize_item_bank(...) on an array like so:

[[-2.0044746   1.1755979 ]
 [-1.7894522   1.047313  ]
 [-0.94069207  1.0814952 ]
 ...
 [-1.4703591   0.8663169 ]
 [ 0.59085643  0.7291509 ]
 [-1.177184    1.002756  ]]

Gives:

    bank = normalize_item_bank(bank)
  File "path/to/catsim/irt.py", line 336, in normalize_item_bank
    items = numpy.append(items, numpy.zeros((items.shape[0])), axis=1)
  File "<__array_function__ internals>", line 5, in append
  File "path/to/numpy/lib/function_base.py", line 4745, in append
    return concatenate((arr, values), axis=axis)
  File "<__array_function__ internals>", line 5, in concatenate
ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 2 dimension(s) and the array at index 1 has 1 dimension(s)

This PR fixes up the shapes of the extra columns.

douglasrizzo commented 3 years ago

Nice catch. Thanks for that. I was able to reproduce it on my end and the problem is now gone.