Practical overview
When it fits
Use Pycm after a multiclass classifier has generated predictions, especially when class-by-class errors and a broad set of summary statistics are more useful than accuracy alone.
Who it is for
- Data scientists evaluating multiclass predictive models
- Python developers adding classification reports to machine-learning workflows
- Teams comparing several classifiers through consistent confusion-matrix metrics
- Developers building command-line evaluation utilities or dashboards
Documented uses
- Construct a confusion matrix from actual and predicted labels
- Analyze normalized and raw class-confusion counts
- Calculate class-level and overall classification statistics
- Compare evaluation outputs from multiple models
- Use existing confusion-matrix data as direct input
Requirements & limits
The repository is public and MIT-licensed. Installation is documented through PyPI, source code and Conda; MATLAB integration is also documented through a configured Python interpreter.
- Input can be supplied as actual and predicted vectors or as a direct confusion matrix.
- The library exposes both class-level and overall statistics.
- Plotting requires Matplotlib 3.0.0 or later or Seaborn 0.9.1 or later.
- Python is the native implementation language, with documented MATLAB integration.
- The project is suitable for local, self-hosted and command-line workflows rather than a hosted evaluation service.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Create a confusion matrix from actual and predicted labels
Construct a Pycm confusion matrix from two documented classification-result vectors and inspect summary statistics.
Before you start
- An installed Pycm environment
- Actual labels and predicted labels in corresponding vectors
Steps
Import Pycm's functionality.
Create a
ConfusionMatrixwithactual_vectorandpredict_vector.Inspect
classesandtable.Use
print_matrix()orprint_normalized_matrix()for matrix views.Call
stat(summary=True)for overall and class statistics.
Expected outcome
The evaluation object exposes class labels, matrix counts, normalized values and summary statistics.
Guide limitations
- The documented example uses multiclass label vectors; it does not describe data validation, persistence or dashboard integration.
- The guide reflects the repository example and is not a human-run execution test.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 3 October 2026
- Original website title
- sepandhaghighi/pycm · Official homepage title · retained in its source language

