Convert input to float array with better error handling.
(arr, name)
| 67 | Ensures that all unique combinations of x and c are grouped. This should |
| 68 | reduce the chance of having arrays that are too long for the MLE fit. |
| 69 | """ |
| 70 | |
| 71 | # TODO: Change to numpy index |
| 72 | grouped = defaultdict(lambda: defaultdict(int)) |
| 73 | if x.ndim == 2: |
| 74 | for vx, vc, vn in zip(x, c, n): |
| 75 | grouped[tuple(vx)][vc] += vn |
| 76 | else: |
| 77 | for vx, vc, vn in zip(x, c, n): |
| 78 | grouped[vx][vc] += vn |
| 79 | |
| 80 | x_out = [] |
| 81 | c_out = [] |