Saltear al contenido principal

Hot! — Height Of Male Models

def height_outliers(self, multiplier: float = 1.5) -> List[Dict]: """Detect height outliers using IQR method""" if len(self.heights) < 4: return [] q1 = statistics.quantiles(self.heights, n=4)[0] q3 = statistics.quantiles(self.heights, n=4)[2] iqr = q3 - q1 lower_bound = q1 - multiplier * iqr upper_bound = q3 + multiplier * iqr outliers = [] for model in self.models: if model.height_cm < lower_bound or model.height_cm > upper_bound: outliers.append({ "id": model.id, "name": model.name, "height_cm": model.height_cm, "height_ft_in": model.height_ft_in, "deviation": "below" if model.height_cm < lower_bound else "above" }) return outliers

def basic_statistics(self) -> Dict: """Calculate basic height statistics""" if not self.heights: return {} return { "count": len(self.heights), "mean": round(statistics.mean(self.heights), 1), "median": round(statistics.median(self.heights), 1), "mode": round(statistics.mode(self.heights), 1) if self.heights else None, "min": min(self.heights), "max": max(self.heights), "range": round(max(self.heights) - min(self.heights), 1), "std_dev": round(statistics.stdev(self.heights), 1) if len(self.heights) > 1 else 0, "variance": round(statistics.variance(self.heights), 1) if len(self.heights) > 1 else 0 }

@app.get("/analyze/outliers") async def detect_outliers(multiplier: float = Query(1.5, ge=1.0, le=3.0)): """Detect height outliers using IQR method""" # Implementation would use analyzer pass # Sample data sample_models = [ MaleModel("M001", "John Doe", 188, "6'2\"", "Elite Models", "runway"), MaleModel("M002", "Mike Smith", 185, "6'1\"", "IMG Models", "runway"), MaleModel("M003", "Alex Chen", 178, "5'10\"", "Wilhelmina", "commercial"), MaleModel("M004", "Chris Evans", 183, "6'0\"", "Ford Models", "fitness"), MaleModel("M005", "David Kim", 192, "6'3.6\"", "Next Models", "runway"), MaleModel("M006", "Tom Wilson", 175, "5'9\"", "Elite Models", "commercial"), MaleModel("M007", "James Brown", 195, "6'4.8\"", "IMG Models", "runway"), ] Analyze analyzer = MaleModelHeightAnalyzer(sample_models) print(analyzer.generate_height_report()) Visualize visualizer = HeightVisualizer(analyzer) visualizer.plot_height_distribution("height_analysis.png") Get category fit category_fit = analyzer.category_fit() for model_id, info in category_fit.items(): print(f"{info['name']}: {info['height_ft_in']} - Suitable for {', '.join(info['suitable_categories'])}") height of male models

def __post_init__(self): if not self.height_ft_in and self.height_cm: self.height_ft_in = self.cm_to_ft_in(self.height_cm)

def distribution_by_category(self) -> Dict: """Analyze height distribution by modeling category""" categories = { "runway": [], "commercial": [], "fitness": [] } for model in self.models: if self.RUNWAY_MIN <= model.height_cm <= self.RUNWAY_MAX: categories["runway"].append(model.height_cm) if self.COMMERCIAL_MIN <= model.height_cm <= self.COMMERCIAL_MAX: categories["commercial"].append(model.height_cm) if self.FITNESS_MIN <= model.height_cm <= self.FITNESS_MAX: categories["fitness"].append(model.height_cm) results = {} for cat, heights in categories.items(): if heights: results[cat] = { "count": len(heights), "mean": round(statistics.mean(heights), 1), "range": f"{min(heights)}-{max(heights)}" } return results def height_outliers(self, multiplier: float = 1

def generate_height_report(self) -> str: """Generate comprehensive height analysis report""" stats = self.basic_statistics() percentiles = self.percentile_distribution() outliers = self.height_outliers() category_fit = self.category_fit() report = f""" ===== MALE MODEL HEIGHT ANALYSIS REPORT ===== BASIC STATISTICS: - Total Models: {stats.get('count', 0)} - Mean Height: {stats.get('mean', 'N/A')} cm - Median Height: {stats.get('median', 'N/A')} cm - Height Range: {stats.get('min', 'N/A')} - {stats.get('max', 'N/A')} cm - Standard Deviation: {stats.get('std_dev', 'N/A')} cm PERCENTILE DISTRIBUTION: {chr(10).join([f' - {k}: {v} cm' for k, v in percentiles.items()])} CATEGORY SUITABILITY: - Suitable for Runway: {sum(1 for v in category_fit.values() if v['is_ideal_runway'])} models - Below Industry Minimum: {sum(1 for v in category_fit.values() if 'short_for_industry' in v['suitable_categories'])} models - Above Industry Maximum: {sum(1 for v in category_fit.values() if 'tall_for_industry' in v['suitable_categories'])} models OUTLIERS DETECTED: {len(outliers)} {chr(10).join([f' - {o["name"]}: {o["height_ft_in"]} ({o["height_cm"]} cm) - {o["deviation"]} average' for o in outliers])} """ return report import matplotlib.pyplot as plt import seaborn as sns import numpy as np class HeightVisualizer: """Create visualizations for model height analysis"""

@app.post("/analyze/upload-models") async def upload_models(models: List[ModelInput]): """Upload multiple male models for analysis""" model_objects = [MaleModel( id=f"M{idx:04d}", name=m.name, height_cm=m.height_cm, agency=m.agency, category=m.category ) for idx, m in enumerate(models)] multiplier: float = 1.5) -&gt

from dataclasses import dataclass from datetime import datetime from typing import List, Optional, Dict import statistics @dataclass class MaleModel: id: str name: str height_cm: float # height in centimeters height_ft_in: Optional[str] = None # e.g., "6'1"" agency: Optional[str] = None category: Optional[str] = None # runway, commercial, fitness, etc. measurement_date: Optional[datetime] = None

Volver arriba