@extends('layouts.app') @section('title', 'Report Hasil Training') @section('content')
{{-- Header --}}

Report Hasil Training

{{-- Flash Message --}} @if (session('message'))
{{ session('message') }}
@endif {{-- Filter Form --}}
{{-- Distribusi Sentimen --}} @if (!empty($results['distribution']))

Distribusi Sentimen

Grafik ini menunjukkan distribusi jumlah data pada masing-masing kategori sentimen.

@endif {{-- TF-IDF Top --}} @if (!empty($results['tfidf']))

TF-IDF Top (50)

Tabel ini menampilkan 50 kata dengan skor TF-IDF tertinggi.

@foreach (array_keys($results['tfidf'][0]) as $col) @endforeach @foreach ($results['tfidf'] as $row) @foreach ($row as $val) @endforeach @endforeach
{{ ucwords(str_replace('_', ' ', $col)) }}
{{ $val }}
@endif {{-- Confusion Matrix --}} @if (!empty($results['confusion'])) @php $matrix = $results['confusion']; $labels = array_keys($matrix[0]); $labelNames = ['netral', 'positif', 'negatif']; foreach ($matrix as &$row) { array_shift($row); } array_shift($labels); unset($row); $maxVal = max(array_map('max', array_map('array_values', $matrix))); @endphp

Confusion Matrix

Confusion Matrix memperlihatkan jumlah prediksi benar & salah untuk tiap kelas.

@foreach ($labels as $pred) @endforeach @foreach ($matrix as $i => $row) @foreach ($labels as $pred) @php $val = floatval($row[$pred]); $ratio = $maxVal > 0 ? $val / $maxVal : 0; // warna dasar untuk true positive hijau, else biru $baseColor = $labelNames[$i] === $pred ? [40, 167, 69] : [59, 130, 246]; // hitung rgba dengan opacity = ratio $bgColor = "rgba({$baseColor[0]},{$baseColor[1]},{$baseColor[2]},{$ratio})"; $textClass = $ratio > 0.5 ? 'text-white font-bold' : 'text-gray-800'; @endphp @endforeach @endforeach
Actual ↓ / Predicted →{{ ucfirst($pred) }}
{{ ucfirst($labelNames[$i] ?? $i) }} {{ $val > 0 ? $val : '0' }}
@endif {{-- Evaluation Full Data --}} @if (!empty($results['evaluation_full']))

Evaluation Full Data

Metrik evaluasi setelah dilatih pada seluruh data.

@foreach (array_keys($results['evaluation_full'][0]) as $col) @endforeach @foreach ($results['evaluation_full'] as $row) @foreach ($row as $val) @endforeach @endforeach
{{ ucwords(str_replace('_', ' ', $col)) }}
{{ is_numeric($val) ? number_format($val, 2) : $val }}
@if (!empty($results['evaluation_full_img']))
Evaluation Full Data
@endif
@endif {{-- Top Features --}} @if (!empty($results['top_features_img']))

Top Features per Class

Top Features
@endif {{-- WordClouds --}} @if (!empty($results['wordclouds']))

WordCloud per Kelas

@foreach ($results['wordclouds'] as $wc)
{{ ucfirst($wc['label']) }}
WC {{ $wc['label'] }}
@endforeach
@endif {{-- Action Buttons --}}
@endsection @push('scripts') @endpush