statistics
Category-level statistics calculation for model reference data.
Provides functions to compute aggregate statistics over collections of model records. Statistics include model counts, baseline distributions, download information, and tag/style distributions.
ParameterBucketStats
Bases: BaseModel
Statistics about parameter count buckets for text generation models.
Used to group models by parameter size ranges for analysis.
Source code in src/horde_model_reference/analytics/statistics.py
model_config
class-attribute
instance-attribute
bucket_label
instance-attribute
Human-readable bucket label (e.g., '< 3B', '3B-6B', '70B-100B', '100B+').
min_params
class-attribute
instance-attribute
Minimum parameter count for this bucket (None for open-ended ranges).
max_params
class-attribute
instance-attribute
Maximum parameter count for this bucket (None for open-ended ranges like '100B+').
count
class-attribute
instance-attribute
Number of models in this parameter bucket.
BaselineStats
Bases: BaseModel
Statistics about model baselines in a category.
Source code in src/horde_model_reference/analytics/statistics.py
model_config
class-attribute
instance-attribute
baseline
instance-attribute
The baseline name (e.g., 'stable_diffusion_xl', 'stable_diffusion_1').
count
class-attribute
instance-attribute
Number of models using this baseline.
DownloadStats
Bases: BaseModel
Statistics about model downloads.
Source code in src/horde_model_reference/analytics/statistics.py
model_config
class-attribute
instance-attribute
total_models_with_downloads
class-attribute
instance-attribute
Number of models that have at least one download entry.
total_download_entries
class-attribute
instance-attribute
Total number of download entries across all models.
total_size_bytes
class-attribute
instance-attribute
Total size in bytes of all downloads (for models with size information).
models_with_size_info
class-attribute
instance-attribute
Number of models that have size_on_disk_bytes information.
average_size_bytes
class-attribute
instance-attribute
Average size in bytes for models with size information.
TagStats
Bases: BaseModel
Statistics about model tags or styles.
Source code in src/horde_model_reference/analytics/statistics.py
model_config
class-attribute
instance-attribute
count
class-attribute
instance-attribute
Number of models with this tag/style.
CategoryStatistics
Bases: BaseModel
Comprehensive statistics for a model reference category.
Contains aggregate metrics, distributions, and metadata about all models in a category.
Source code in src/horde_model_reference/analytics/statistics.py
model_config
class-attribute
instance-attribute
category
instance-attribute
The category these statistics describe.
total_models
class-attribute
instance-attribute
Total number of models in the category (before pagination).
returned_models
class-attribute
instance-attribute
Number of models returned in this response (after pagination).
offset
class-attribute
instance-attribute
Starting index for pagination (0 if not paginated).
limit
class-attribute
instance-attribute
Maximum number of models per page (None if not paginated).
nsfw_count
class-attribute
instance-attribute
Number of NSFW models (if applicable to category).
baseline_distribution
class-attribute
instance-attribute
Distribution of models across different baselines.
download_stats
class-attribute
instance-attribute
Aggregate download statistics.
top_tags
class-attribute
instance-attribute
Top tags by frequency (for categories with tags).
top_styles
class-attribute
instance-attribute
Top styles by frequency (for categories with styles).
parameter_buckets
class-attribute
instance-attribute
Distribution of text models by parameter count buckets (text generation only).
models_without_param_info
class-attribute
instance-attribute
Number of models without parameter count information (text generation only).
models_with_trigger_words
class-attribute
instance-attribute
Number of models with trigger words (image generation only).
models_with_inpainting
class-attribute
instance-attribute
Number of inpainting models (image generation only).
models_with_requirements
class-attribute
instance-attribute
Number of models with special requirements (image generation only).
models_with_showcases
class-attribute
instance-attribute
Number of models with showcase links.
calculate_category_statistics
calculate_category_statistics(
models: dict[str, Any],
category: MODEL_REFERENCE_CATEGORY,
) -> CategoryStatistics
Calculate comprehensive statistics for a category of models.
Parameters:
-
models(dict[str, Any]) –Dictionary mapping model names to model data dictionaries (raw JSON format).
-
category(MODEL_REFERENCE_CATEGORY) –The category these models belong to.
Returns:
-
CategoryStatistics–CategoryStatistics containing all computed metrics.
Example
models = manager.get_raw_model_reference_json(MODEL_REFERENCE_CATEGORY.image_generation) stats = calculate_category_statistics(models, MODEL_REFERENCE_CATEGORY.image_generation) print(f"Total models: {stats.total_models}") print(f"NSFW: {stats.nsfw_count}, SFW: {stats.sfw_count}")
Source code in src/horde_model_reference/analytics/statistics.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | |