Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array support #402

Closed
sepandhaghighi opened this issue Nov 15, 2021 · 0 comments · Fixed by #447
Closed

Array support #402

sepandhaghighi opened this issue Nov 15, 2021 · 0 comments · Fixed by #447
Assignees
Labels
enhancement New feature or request new feature
Milestone

Comments

@sepandhaghighi
Copy link
Owner

Description

Support numpy array or nested list

Steps/Code to Reproduce

>>> from pycm import ConfusionMatrix
>>> matrix = [[1,2,3],[4,6,1],[1,2,3]]
>>> cm = ConfusionMatrix(matrix = matrix)
>>> cm2 = ConfusionMatrix(matrix = matrix, classes=["L1","L2","L3"])

Expected Behavior

>>> cm.print_matrix()
Predict 0       1       2       
Actual
0       1       2       3       

1       4       6       1       

2       1       2       3       

>>> cm2.print_matrix()
Predict  L1       L2       L3       
Actual
L1       1        2        3        

L2       4        6        1        

L3       1        2        3 

Operating System

Windows 10

Python Version

Python 3.5.2

PyCM Version (Use : pycm.__version__)

3.3

@sepandhaghighi sepandhaghighi added enhancement New feature or request new feature labels Nov 15, 2021
@sadrasabouri sadrasabouri self-assigned this Jun 13, 2022
sadrasabouri added a commit that referenced this issue Jun 13, 2022
alirezazolanvari pushed a commit that referenced this issue Jul 1, 2022
* add : __obj_array_handler__ function added.

* edit : `matrix` is now accepting arrays.

* add : pycmArrayError added.

* test : tests added.

* log : changes logged. (#402)

* edit : minor edits.

* edit : pycmArrayError removed.

* test : tests added.

* add : transpose flag added to __obj_array_handler__.

* add : documents added.

* edit : minor edits in vector_check.

* update : documents updated.

* update : Document.ipynb updated.

* edit : tests edited.

* add : `classes` parameter added to `matrix_params_from_table`.

* log : changes logged.

* remove : class lenght check relocated to `matrix_params_from_table`.

* add : class and array len check added.

* add : classes subset check added.

* fix : trailing whitespaces in tests fixed.

* edit : table -> matrix.

* edit : __obj_matrix_handler__ arguments reordered.

* fix : minor typo in __init__ fixed.

* add : tests for numpy added.

* fix : typo fixed.

* remove : extra sections removed.

* edit : numpy.int64 -> numpy.integer.

* edit : `transpose` -> `self.transpose`.

* fix : typo fixed.

* edit : minor computational improvements in `matrix_params_from_table`.

* add : `classes` docstring added to `__obj_matrix_handler__`.

* edit : `CLASSES_LENGHT_ERROR` edited.

* update : CHANGELOG.md updated.
@sepandhaghighi sepandhaghighi added this to the PYCM 3.6 milestone Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants