CompressionAnalyzer<T>
Models & Types · AiDotNet.ModelCompression
Analyzes model weights to determine optimal compression strategies.
For Beginners
Before compressing a model, it helps to understand its weights.
This analyzer looks at your model’s weights and answers questions like:
- Are many weights already close to zero? (Good for pruning)
- Are weights clustered around certain values? (Good for quantization)
- What’s the distribution of weight values? (Affects all techniques)
Based on this analysis, it recommends:
- Which compression technique to use
- What settings (hyperparameters) to use
- What compression ratio to expect
This helps you make informed decisions without trial-and-error.
How It Works
CompressionAnalyzer examines model weight distributions to recommend the best compression technique and hyperparameters. It analyzes properties like weight sparsity, magnitude distribution, and redundancy to make informed recommendations.
Constructors
| Constructor | Summary |
|---|---|
CompressionAnalyzer(double nearZeroThreshold, int histogramBins) |
Initializes a new instance of the CompressionAnalyzer class. |
Methods
| Method | Summary |
|---|---|
WeightAnalysisResult<T> Analyze(Vector<T> weights, bool isConvolutional) |
Analyzes model weights and returns compression recommendations. |
string GenerateReport(WeightAnalysisResult<T> result) |
Generates a detailed analysis report. |