xix
LAMPIRAN
5.2.1 - Lampiran Biodata Peneliti
Nama Lengkap : Ardhian Yulihandra Hanum
NIM : 18111102
Alamat Lengkap : Pondok Wonolelo 1, Widodomartani, Ngemplak, Sleman, Yogyakarta.
No Handphone : 085725802623
Email : [email protected]
xx
5.2.2 - Lampiran Halaman Proses Apriori
xxi
xxii
5.2.3 - Lembar Form Konsultasi Skripsi
xxiii 5.2.4 - Lapiran Source Code Perhitungan Apriori
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class DataMiningController extends Controller {
public function apriori() {
return view('pages.mining.apriori');
}
public function processApriori(Request $request) {
try {
$start_time = microtime(true);
$request->validate([
'dateFrom' => 'required', 'dateTo' => 'required', 'support' => 'required', 'confidence' => 'required' ]);
$transactions = $this->__getTransaction($request-
>input('dateFrom'), $request->input('dateTo'));
$unique = $this->__uniqueItems($transactions);
$__itemset1 = $this->__itemset1($transactions,
$unique, (int)$request->input('support') / 100);
$data['total'] = count($transactions);
$data['dateFrom'] = $request->input('dateFrom');
$data['dateTo'] = $request->input('dateTo');
xxiv
$data['min_support'] = (int)$request->input('support') / 100;
$data['min_support_relative'] = ($request-
>input('support') / count($transactions)) * 100;
$data['min_confidence'] = (int)$request-
>input('confidence') / 100;
$data['itemset_1'] = $__itemset1;
$data['itemset_2'] = $this->__itemset2($transactions,
$__itemset1, (int)$request->input('support') / 100);
$data['association_itemset_2'] = $this-
>__association_itemset_2($data['itemset_2'], $transactions,
$data['min_confidence']);
$data['itemset_3'] = $this->__itemset3($transactions,
$data['itemset_2'], (int)$request->input('support') / 100);
$data['association_itemset_3'] = $this-
>__association_itemset_3($data['itemset_3'], $transactions,
$data['min_confidence']);
$data['itemset_4'] = $this->__itemset4($transactions,
$data['itemset_3'], (int)$request->input('support') / 100);
$data['association_itemset_4'] = $this-
>__association_itemset_4($data['itemset_4'], $transactions,
$data['min_confidence']);
$data['association_rule'] = $this-
>__association_rule($data['association_itemset_2'],
$data['association_itemset_3'], $data['association_itemset_4']);
$end_time = microtime(true);
$data['execution_time'] = ($end_time - $start_time);
return view('pages.mining.apriori', compact('data'));
} catch (\Throwable $th) { //throw $th;
return $this->responseJSON(
'error', 500,
$th->getMessage(), NULL
xxv
);
} }
public function resultApriori() {
return view('pages.mining.result.apriori');
}
protected function __getTransaction($from, $to) {
if ($from == "" || $from == null) $from = date("Y-m-d");
if ($to == "" || $to == null) $to = date("Y-m-d");
$tmp = [];
$orders = DB::table('orders')
->join('order_details', 'orders.id', '=', 'order_details.order_id')
->join('items', 'items.id', '=', 'order_details.item_id')
->join('outlets', 'outlets.id', 'orders.outlet_id') ->select('orders.invoice', 'orders.created_at', 'outlets.name as outlet', 'items.name as menu',
'orders.net_amount')
->where('orders.date', '>=', $from) ->where('orders.date', '<=', $to) ->whereNull("orders.deleted_at") ->get();
$index = 0;
$invoice = "";
foreach ($orders as $key => $value) {
if (!strstr(strtolower($value->menu), "paket")) { if ($invoice !== $value->invoice) {
if ($key !== 0) { $index++;
}
xxvi
$tmp[$index] = $value->menu;
$invoice = $value->invoice;
} else {
$tmp[$index] = $tmp[$index] . ", " . $value-
>menu;
} } }
$index = 0;
foreach ($tmp as $t) {
$totalMenu = explode(",", $t);
if (count($totalMenu) >= 2) { $data[$index] = $t;
$index++;
} }
return $data;
}
protected function __uniqueItems($data) {
$arrUnique = [];
$index = 0;
foreach ($data as $d) {
$menus = explode(", ", $d);
foreach ($menus as $m) {
if (!in_array($m, $arrUnique)) { $arrUnique[$index] = $m;
$index++;
} } }
return $arrUnique;
}
xxvii
protected function __passItem($data) {
$items = [];
$index = 0;
foreach ($data as $d) {
if ($d['result'] === 1) {
$items[$index] = $d['item'];
$index++;
} }
return $items;
}
protected function __itemset1($data, $unique, $support) {
$frequent = [];
foreach ($unique as $key => $u) { $frequent[$key]['item'] = $u;
$frequent[$key]['transaction'] = 0;
foreach ($data as $d) {
$menu = explode(", ", $d);
foreach ($menu as $m) { if ($m == $u) {
$frequent[$key]['transaction']++;
} } }
$frequent[$key]['support'] =
$frequent[$key]['transaction'] / count($data);
$frequent[$key]['result'] = $frequent[$key]['support']
>= $support ? 1 : 0;
}
usort($frequent, fn ($a, $b) => $b['transaction'] <=>
$a['transaction']);
return $frequent;
xxviii
}
protected function __itemset2($transactions, $itemset1,
$min_support) {
$passItem = $this->__passItem($itemset1);
$itemsets = [];
$uniqueSets = [];
$index = 0;
foreach ($passItem as $a) { foreach ($passItem as $b) { if ($a !== $b) {
$comb = $a . "-" . $b;
$comb2 = $b . "-" . $a;
if (!in_array($comb, $uniqueSets) &&
!in_array($comb2, $uniqueSets)) {
$count = 0;
foreach ($transactions as $t) { $menu = explode(", ", $t);
if (in_array($a, $menu) &&
in_array($b, $menu)) {
$count++;
} }
$support = $count / count($transactions);
if ($support >= $min_support) { $uniqueSets[$index] = $comb;
$itemsets[$index]['item_1'] = $a;
$itemsets[$index]['item_2'] = $b;
$itemsets[$index]['transaction'] =
$count;
$itemsets[$index]['support'] =
$support;
$itemsets[$index]['result'] = 1;
xxix
$index++;
} } } } }
return $itemsets;
}
protected function __association_itemset_2($data,
$transactions, $min_confidence) {
$index = 0;
$arr = [];
foreach ($data as $d) { $antecendent = 0;
$consequent1 = 0;
$consequent2 = 0;
$totalTrx = count($transactions);
foreach ($transactions as $t) { $menu = explode(", ", $t);
if (in_array($d['item_1'], $menu) &&
in_array($d['item_2'], $menu)) { $antecendent++;
}
if (in_array($d['item_2'], $menu)) { $consequent1++;
}
if (in_array($d['item_1'], $menu)) { $consequent2++;
} }
$confidance = $antecendent / $consequent1;
xxx
if ($confidance >= $min_confidence) {
$arr[$index]['rule'] = "Jika membeli " .
$d['item_1'] . ", maka membeli " . $d['item_2'];
$arr[$index]['antecendent'] = $antecendent;
$arr[$index]['consequent'] = $consequent1;
$arr[$index]['support'] = $d['support'];
$arr[$index]['confidence'] = $confidance;
$arr[$index]['lift_ratio'] = $confidance / ($consequent1 / $totalTrx);
$index++;
}
$confidance2 = $antecendent / $consequent2;
if ($confidance2 >= $min_confidence) {
$arr[$index]['rule'] = "Jika membeli " .
$d['item_2'] . ", maka membeli " . $d['item_1'];
$arr[$index]['antecendent'] = $antecendent;
$arr[$index]['consequent'] = $consequent2;
$arr[$index]['support'] = $d['support'];
$arr[$index]['confidence'] = $confidance2;
$arr[$index]['lift_ratio'] = $confidance2 / ($consequent2 / $totalTrx);
$index++;
} }
return $arr;
}
protected function __itemset3($transactions, $itemset2,
$min_support) {
$uniqueItem = [];
$indexItem = 0;
foreach ($itemset2 as $i) { if ($i['result'] === 1) {
xxxi
if (!in_array($i['item_1'], $uniqueItem)) { $uniqueItem[$indexItem] = $i['item_1'];
$indexItem++;
}
if (!in_array($i['item_2'], $uniqueItem)) { $uniqueItem[$indexItem] = $i['item_2'];
$indexItem++;
} } }
$itemset = [];
$uniqeSet = [];
$index = 0;
foreach ($itemset2 as $i) { $a = $i['item_1'];
$b = $i['item_2'];
foreach ($uniqueItem as $c) { if ($a !== $c && $b !== $c) {
$comb = $a . "-" . $b . "-" . $c;
$comb2 = $c . "-" . $a . "-" . $b;
$comb3 = $b . "-" . $c . "-" . $a;
$comb4 = $a . "-" . $c . "-" . $b;
$comb5 = $c . "-" . $b . "-" . $a;
$comb6 = $b . "-" . $a . "-" . $c;
if (
!in_array($comb, $uniqeSet) &&
!in_array($comb2, $uniqeSet) &&
!in_array($comb3, $uniqeSet) &&
!in_array($comb4, $uniqeSet) &&
!in_array($comb5, $uniqeSet) &&
!in_array($comb6, $uniqeSet)
) {
$count = 0;
xxxii
foreach ($transactions as $t) { $menu = explode(", ", $t);
if (in_array($a, $menu) &&
in_array($b, $menu) && in_array($c, $menu)) { $count++;
} }
$support = $count / count($transactions);
if ($support >= $min_support) { $uniqeSet[$index] = $comb;
$itemset[$index]['item_1'] = $a;
$itemset[$index]['item_2'] = $b;
$itemset[$index]['item_3'] = $c;
$itemset[$index]['transaction'] =
$count;
$itemset[$index]['support'] =
$support;
$itemset[$index]['result'] = 1;
$index++;
} } } } }
return $itemset;
}
protected function __association_itemset_3($data,
$transactions, $min_confidence) {
$index = 0;
$arr = [];
foreach ($data as $d) { $antecendent = 0;
xxxiii
$consequent1 = 0;
$consequent2 = 0;
$consequent3 = 0;
$item_1 = 0;
$item_2 = 0;
$item_3 = 0;
$totalTrx = count($transactions);
foreach ($transactions as $t) { $menu = explode(", ", $t);
if (in_array($d['item_1'], $menu) &&
in_array($d['item_2'], $menu) && in_array($d['item_3'], $menu)) { $antecendent++;
}
if (in_array($d['item_1'], $menu) &&
in_array($d['item_2'], $menu)) { $consequent1++;
}
if (in_array($d['item_1'], $menu) &&
in_array($d['item_3'], $menu)) { $consequent2++;
}
if (in_array($d['item_2'], $menu) &&
in_array($d['item_3'], $menu)) { $consequent3++;
}
if (in_array($d['item_1'], $menu)) { $item_1++;
}
if (in_array($d['item_2'], $menu)) { $item_2++;
}
xxxiv
if (in_array($d['item_3'], $menu)) { $item_3++;
} }
$confidance = $antecendent / $consequent1;
if ($confidance >= $min_confidence) {
$arr[$index]['rule'] = "Jika membeli " .
$d['item_1'] . " dan " . $d['item_2'] . ", maka membeli " .
$d['item_3'];
$arr[$index]['antecendent'] = $antecendent;
$arr[$index]['consequent'] = $consequent1;
$arr[$index]['support'] = $d['support'];
$arr[$index]['confidence'] = $confidance;
$arr[$index]['lift_ratio'] = $confidance / ($item_3 / $totalTrx);
$index++;
}
$confidance2 = $antecendent / $consequent2;
if ($confidance2 >= $min_confidence) {
$arr[$index]['rule'] = "Jika membeli " .
$d['item_1'] . " dan " . $d['item_3'] . ", maka membeli " .
$d['item_2'];
$arr[$index]['antecendent'] = $antecendent;
$arr[$index]['consequent'] = $consequent2;
$arr[$index]['support'] = $d['support'];
$arr[$index]['confidence'] = $confidance2;
$arr[$index]['lift_ratio'] = $confidance2 / ($item_2 / $totalTrx);
$index++;
}
$confidance3 = $antecendent / $consequent3;
xxxv
if ($confidance3 >= $min_confidence) {
$arr[$index]['rule'] = "Jika membeli " .
$d['item_2'] . " dan " . $d['item_3'] . ", maka membeli " .
$d['item_1'];
$arr[$index]['antecendent'] = $antecendent;
$arr[$index]['consequent'] = $consequent3;
$arr[$index]['support'] = $d['support'];
$arr[$index]['confidence'] = $confidance3;
$arr[$index]['lift_ratio'] = $confidance3 / ($item_1 / $totalTrx);
$index++;
} }
return $arr;
}
protected function __itemset4($transactions, $itemset3,
$min_support) {
$uniqueItem = [];
$indexItem = 0;
foreach ($itemset3 as $i) { if ($i['result'] === 1) {
if (!in_array($i['item_1'], $uniqueItem)) { $uniqueItem[$indexItem] = $i['item_1'];
$indexItem++;
}
if (!in_array($i['item_2'], $uniqueItem)) { $uniqueItem[$indexItem] = $i['item_2'];
$indexItem++;
}
if (!in_array($i['item_3'], $uniqueItem)) { $uniqueItem[$indexItem] = $i['item_3'];
$indexItem++;
xxxvi
} } }
$itemset = [];
$uniqeSet = [];
$index = 0;
foreach ($itemset3 as $i) { $a = $i['item_1'];
$b = $i['item_2'];
$c = $i['item_3'];
foreach ($uniqueItem as $d) {
if ($a !== $d && $b !== $d && $c !== $d) {
$comb = $a . "-" . $b . "-" . $c . "-" . $d;
$comb2 = $a . "-" . $d . "-" . $b . "-" . $c;
$comb3 = $a . "-" . $c . "-" . $d . "-" . $b;
$comb13 = $a . "-" . $b . "-" . $d . "-" . $c;
$comb15 = $a . "-" . $d . "-" . $c . "-" . $b;
$comb16 = $a . "-" . $c . "-" . $b . "-" . $d;
$comb4 = $b . "-" . $a . "-" . $c . "-" . $d;
$comb5 = $b . "-" . $d . "-" . $a . "-" . $c;
$comb6 = $b . "-" . $c . "-" . $d . "-" . $a;
$comb14 = $b . "-" . $a . "-" . $d . "-" . $c;
$comb17 = $b . "-" . $d . "-" . $c . "-" . $a;
$comb18 = $b . "-" . $c . "-" . $a . "-" . $d;
$comb7 = $c . "-" . $a . "-" . $b . "-" . $d;
$comb8 = $c . "-" . $d . "-" . $a . "-" . $b;
$comb9 = $c . "-" . $b . "-" . $d . "-" . $a;
$comb19 = $c . "-" . $a . "-" . $d . "-" . $b;
$comb20 = $c . "-" . $d . "-" . $b . "-" . $a;
$comb21 = $c . "-" . $b . "-" . $a . "-" . $d;
$comb10 = $d . "-" . $a . "-" . $b . "-" . $c;
$comb11 = $d . "-" . $c . "-" . $a . "-" . $b;
xxxvii
$comb12 = $d . "-" . $b . "-" . $c . "-" . $a;
$comb22 = $d . "-" . $a . "-" . $c . "-" . $b;
$comb23 = $d . "-" . $c . "-" . $b . "-" . $a;
$comb24 = $d . "-" . $b . "-" . $a . "-" . $c;
if (
!in_array($comb, $uniqeSet) &&
!in_array($comb2, $uniqeSet) &&
!in_array($comb3, $uniqeSet) &&
!in_array($comb4, $uniqeSet) &&
!in_array($comb5, $uniqeSet) &&
!in_array($comb6, $uniqeSet) &&
!in_array($comb7, $uniqeSet) &&
!in_array($comb8, $uniqeSet) &&
!in_array($comb9, $uniqeSet) &&
!in_array($comb10, $uniqeSet) &&
!in_array($comb11, $uniqeSet) &&
!in_array($comb12, $uniqeSet) &&
!in_array($comb13, $uniqeSet) &&
!in_array($comb14, $uniqeSet) &&
!in_array($comb15, $uniqeSet) &&
!in_array($comb16, $uniqeSet) &&
!in_array($comb17, $uniqeSet) &&
!in_array($comb18, $uniqeSet) &&
!in_array($comb19, $uniqeSet) &&
!in_array($comb20, $uniqeSet) &&
!in_array($comb21, $uniqeSet) &&
!in_array($comb22, $uniqeSet) &&
!in_array($comb23, $uniqeSet) &&
!in_array($comb24, $uniqeSet) ) {
$count = 0;
foreach ($transactions as $t) { $menu = explode(", ", $t);
xxxviii
if (in_array($a, $menu) &&
in_array($b, $menu) && in_array($c, $menu) && in_array($d, $menu)) {
$count++;
} }
$support = $count / count($transactions);
if ($support >= $min_support) { $uniqeSet[$index] = $comb;
$itemset[$index]['item_1'] = $a;
$itemset[$index]['item_2'] = $b;
$itemset[$index]['item_3'] = $c;
$itemset[$index]['item_4'] = $d;
$itemset[$index]['transaction'] =
$count;
$itemset[$index]['support'] =
$support;
$itemset[$index]['result'] = 1;
$index++;
} } } } }
return $itemset;
}
protected function __association_itemset_4($data,
$transactions, $min_confidence) {
$index = 0;
$arr = [];
foreach ($data as $d) { $antecendent = 0;
xxxix
$consequent1 = 0;
$consequent2 = 0;
$consequent3 = 0;
$consequent4 = 0;
$item_1 = 0;
$item_2 = 0;
$item_3 = 0;
$item_4 = 0;
$totalTrx = count($transactions);
foreach ($transactions as $t) { $menu = explode(", ", $t);
if (in_array($d['item_1'], $menu) &&
in_array($d['item_2'], $menu) && in_array($d['item_3'], $menu) &&
in_array($d['item_4'], $menu)) { $antecendent++;
}
if (in_array($d['item_1'], $menu) &&
in_array($d['item_2'], $menu) && in_array($d['item_3'], $menu)) { $consequent1++;
}
if (in_array($d['item_2'], $menu) &&
in_array($d['item_3'], $menu) && in_array($d['item_4'], $menu)) { $consequent2++;
}
if (in_array($d['item_3'], $menu) &&
in_array($d['item_4'], $menu) && in_array($d['item_1'], $menu)) { $consequent3++;
}
if (in_array($d['item_4'], $menu) &&
in_array($d['item_1'], $menu) && in_array($d['item_2'], $menu)) { $consequent4++;
xl
}
if (in_array($d['item_1'], $menu)) { $item_1++;
}
if (in_array($d['item_2'], $menu)) { $item_2++;
}
if (in_array($d['item_3'], $menu)) { $item_3++;
}
if (in_array($d['item_4'], $menu)) { $item_4++;
} }
$confidance = $antecendent / $consequent1;
if ($confidance >= $min_confidence) {
$arr[$index]['rule'] = "Jika membeli " .
$d['item_1'] . ", " . $d['item_2'] . " dan " . $d['item_3'] . ", maka membeli " . $d['item_4'];
$arr[$index]['antecendent'] = $antecendent;
$arr[$index]['consequent'] = $consequent1;
$arr[$index]['support'] = $d['support'];
$arr[$index]['confidence'] = $confidance;
$arr[$index]['lift_ratio'] = $confidance / ($item_4 / $totalTrx);
$index++;
}
$confidance2 = $antecendent / $consequent2;
if ($confidance2 >= $min_confidence) {
xli
$arr[$index]['rule'] = "Jika membeli " .
$d['item_2'] . ", " . $d['item_3'] . " dan " . $d['item_4'] . ", maka membeli " . $d['item_1'];
$arr[$index]['antecendent'] = $antecendent;
$arr[$index]['consequent'] = $consequent2;
$arr[$index]['support'] = $d['support'];
$arr[$index]['confidence'] = $confidance2;
$arr[$index]['lift_ratio'] = $confidance2 / ($item_1 / $totalTrx);
$index++;
}
$confidance3 = $antecendent / $consequent3;
if ($confidance3 >= $min_confidence) {
$arr[$index]['rule'] = "Jika membeli " .
$d['item_3'] . ", " . $d['item_4'] . " dan " . $d['item_1'] . ", maka membeli " . $d['item_2'];
$arr[$index]['antecendent'] = $antecendent;
$arr[$index]['consequent'] = $consequent3;
$arr[$index]['support'] = $d['support'];
$arr[$index]['confidence'] = $confidance3;
$arr[$index]['lift_ratio'] = $confidance3 / ($item_2 / $totalTrx);
$index++;
}
$confidance4 = $antecendent / $consequent4;
if ($confidance4 >= $min_confidence) {
$arr[$index]['rule'] = "Jika membeli " .
$d['item_4'] . ", " . $d['item_1'] . " dan " . $d['item_2'] . ", maka membeli " . $d['item_3'];
$arr[$index]['antecendent'] = $antecendent;
$arr[$index]['consequent'] = $consequent4;
$arr[$index]['support'] = $d['support'];
$arr[$index]['confidence'] = $confidance4;
xlii
$arr[$index]['lift_ratio'] = $confidance4 / ($item_3 / $totalTrx);
$index++;
} }
return $arr;
}
public function __association_rule($rule2, $rule3, $rule4) {
$arr = [];
$index = 0;
foreach ($rule2 as $value) { $arr[$index] = $value;
$index++;
}
foreach ($rule3 as $value) { $arr[$index] = $value;
$index++;
}
foreach ($rule4 as $value) { $arr[$index] = $value;
$index++;
}
return $arr;
} }
5.2.5 - Lampiran Source Code Tampilan Apriori
@extends('layouts.app')
@section('title','Data Mining Apriori')
@section('css')
xliii
<link rel="stylesheet"
href="{{asset('js/plugins/flatpickr/flatpickr.min.css')}}">
<link rel="stylesheet"
href="{{asset('plugins/datatables/dataTables.bootstrap4.css')}}">
@endsection
@section('content')
<x-block>
<div class="row justify-content-center">
<div class="col-12 col-md-6">
<h4 class="text-center">Data Mining Metode Apriori</h4>
<hr>
<form action="/mining/apriori" method="POST">
@csrf
<div class="form-group row">
<label class="col-lg-4 col-form-label">Tanggal Transaksi</label>
<div class="col-lg-4">
<input type="text" class="js-flatpickr form- control bg-white" name="dateFrom" value="<?= isset($data) && $data
!== null ? $data['dateFrom'] : ''; ?>">
</div>
<div class="col-lg-4">
<input type="text" class="js-flatpickr form- control bg-white" name="dateTo" value="<?= isset($data) && $data
!== null ? $data['dateTo'] : ''; ?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-4 col-form-label">Minimal Support</label>
<div class="col-lg-8">
<input type="text" class="form-control"
name="support">
</div>
</div>
<div class="form-group row">
<label class="col-lg-4 col-form-label">Minimal Confidence</label>
xliv
<div class="col-lg-8">
<input type="text" class="form-control"
name="confidence">
</div>
</div>
<div class="form-group row">
<span class="col-lg-4"></span>
<div class="col-lg-8">
<button class="btn btn-secondary btn- block">Proses Data</button>
</div>
</div>
</form>
</div>
</div>
</x-block>
<?php if (isset($data) && $data !== null) { ?>
<x-block>
<h3 class="text-center">Result Data Mining</h3>
<div class="d-flex justify-content-between align-items- center mb-3">
<p class="mb-0" style="font-size: 16px; font-weight:
600;">Total Transaksi: <?= $data['total']; ?></p>
<p class="mb-0" style="font-size: 16px; font-weight:
600;">Min Support: <?= $data['min_support']; ?>%</p>
</div>
<div class="d-flex justify-content-between align-items- center">
<p class="mb-0" style="font-size: 16px; font-weight:
600;">Waktu Pemrosesan: <?= $data['execution_time']; ?></p>
<p class="mb-0" style="font-size: 16px; font-weight:
600;">Min Confidence: <?= $data['min_confidence']; ?>%</p>
</div>
</x-block>
<x-block>
<h4>Itemset 1</h4>
xlv
<div class="block">
<ul class="nav nav-tabs nav-tabs-block" data- toggle="tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" href="#lolos">Lolos</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#tidak-lolos">Tidak Lolos</a>
</li>
</ul>
<div class="block-content tab-content">
<div class="tab-pane active" id="lolos"
role="tabpanel">
<table class="table table-bordered table-striped table-vcenter js-dataTable-full" id="js-dataTable-itemset1lolos">
<thead>
<tr>
<th>Nama Item</th>
<th class="text-center">Transaksi</th>
<th class="text-center">Nilai Support</th>
<th class="text-center">Keterangan</th>
</tr>
</thead>
<tbody>
<?php foreach ($data['itemset_1'] as $key =>
$value) { ?>
<?php if ($value['result'] == "1") { ?>
<tr>
<td><?= $value['item']; ?></td>
<td class="text-center"><?=
$value['transaction']; ?></td>
<td class="text-center"><?=
$value['support']; ?></td>
<td class="text-center">
<div class="badge badge- success">Lolos</div>
</td>
xlvi
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
</div>
<div class="tab-pane" id="tidak-lolos"
role="tabpanel">
<table class="table table-bordered table-striped table-vcenter js-dataTable-full" id="js-dataTable-
itemset1tidaklolos">
<thead>
<tr>
<th>Nama Item</th>
<th class="text-center">Transaksi</th>
<th class="text-center">Nilai Support</th>
<th class="text-center">Keterangan</th>
</tr>
</thead>
<tbody>
<?php foreach ($data['itemset_1'] as $key =>
$value) { ?>
<?php if ($value['result'] == "0") { ?>
<tr>
<td><?= $value['item']; ?></td>
<td class="text-center"><?=
$value['transaction']; ?></td>
<td class="text-center"><?=
$value['support']; ?></td>
<td class="text-center">
<div class="badge badge- danger">Tidak Lolos</div>
</td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
xlvii
</div>
</div>
</div>
</x-block>
<x-block>
<h4>Iterasi 2</h4>
<div class="block">
<ul class="nav nav-tabs nav-tabs-block" data- toggle="tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active"
href="#itemset2">Itemset</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#ruleset2">Association Rule</a>
</li>
</ul>
<div class="block-content tab-content">
<div class="tab-pane active" id="itemset2"
role="tabpanel">
<table class="table table-bordered table-striped table-vcenter js-dataTable-full" id="js-dataTable-itemset2">
<thead>
<tr>
<th>Item 1</th>
<th>Item 2</th>
<th class="text-center">Transaksi</th>
<th class="text-center">Nilai Support</th>
<th class="text-center">Keterangan</th>
</tr>
</thead>
<tbody>
<?php foreach ($data['itemset_2'] as $key =>
$value) { ?>
<tr>
<td><?= $value['item_1']; ?></td>
<td><?= $value['item_2']; ?></td>
xlviii
<td class="text-center"><?=
$value['transaction']; ?></td>
<td class="text-center"><?=
$value['support']; ?></td>
<td class="text-center">
<div class="badge badge- success">Lolos</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="tab-pane" id="ruleset2" role="tabpanel">
<table class="table table-bordered table-striped table-vcenter js-dataTable-full" id="js-dataTable-ruleset2">
<thead>
<tr>
<th>Rule</th>
<th class="text-center">X U Y</th>
<th class="text-center">X</th>
<th class="text-center">Nilai Support</th>
<th class="text-center">Nilai Confidence</th>
</tr>
</thead>
<tbody>
<?php foreach ($data['association_itemset_2']
as $key => $value) { ?>
<tr>
<td style="width: 40%;"><?=
$value['rule']; ?></td>
<td class="text-center"><?=
$value['antecendent']; ?></td>
<td class="text-center"><?=
$value['consequent']; ?></td>
<td class="text-center"><?=
$value['support']; ?></td>
xlix
<td class="text-center"><?=
$value['confidence']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</x-block>
<?php if ($data['itemset_3'] !== null &&
count($data['itemset_3']) > 0) { ?>
<x-block>
<h4>Iterasi 3</h4>
<div class="block">
<ul class="nav nav-tabs nav-tabs-block" data- toggle="tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active"
href="#itemset3">Itemset</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#ruleset3">Association Rule</a>
</li>
</ul>
<div class="block-content tab-content">
<div class="tab-pane active" id="itemset3"
role="tabpanel">
<table class="table table-bordered table-striped table-vcenter js-dataTable-full" id="js-dataTable-itemset3">
<thead>
<tr>
<th>Item 1</th>
<th>Item 2</th>
<th>Item 3</th>
<th class="text-center">Transaksi</th>
l
<th class="text-center">Nilai Support</th>
<th class="text-center">Keterangan</th>
</tr>
</thead>
<tbody>
<?php foreach ($data['itemset_3'] as $key
=> $value) { ?>
<tr>
<td><?= $value['item_1']; ?></td>
<td><?= $value['item_2']; ?></td>
<td><?= $value['item_3']; ?></td>
<td class="text-center"><?=
$value['transaction']; ?></td>
<td class="text-center"><?=
$value['support']; ?></td>
<td class="text-center">
<div class="badge badge- success">Lolos</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="tab-pane" id="ruleset3"
role="tabpanel">
<table class="table table-bordered table-striped table-vcenter js-dataTable-full" id="js-dataTable-ruleset3">
<thead>
<tr>
<th>Rule</th>
<th class="text-center">X U Y</th>
<th class="text-center">X</th>
<th class="text-center">Nilai Support</th>
<th class="text-center">Nilai Confidence</th>
li
</tr>
</thead>
<tbody>
<?php foreach
($data['association_itemset_3'] as $key => $value) { ?>
<tr>
<td style="width: 40%;"><?=
$value['rule']; ?></td>
<td class="text-center"><?=
$value['antecendent']; ?></td>
<td class="text-center"><?=
$value['consequent']; ?></td>
<td class="text-center"><?=
$value['support']; ?></td>
<td class="text-center"><?=
$value['confidence']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</x-block>
<?php } ?>
<?php if ($data['itemset_4'] !== null &&
count($data['itemset_4']) > 0) { ?>
<x-block>
<h4>Iterasi 4</h4>
<div class="block">
<ul class="nav nav-tabs nav-tabs-block" data- toggle="tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active"
href="#itemset4">Itemset</a>
</li>
<li class="nav-item">
lii
<a class="nav-link" href="#ruleset4">Association Rule</a>
</li>
</ul>
<div class="block-content tab-content">
<div class="tab-pane active" id="itemset4"
role="tabpanel">
<table class="table table-bordered table-striped table-vcenter js-dataTable-full" id="js-dataTable-itemset4">
<thead>
<tr>
<th>Item 1</th>
<th>Item 2</th>
<th>Item 3</th>
<th class="text-center">Transaksi</th>
<th class="text-center">Nilai Support</th>
<th class="text-center">Keterangan</th>
</tr>
</thead>
<tbody>
<?php foreach ($data['itemset_4'] as $key
=> $value) { ?>
<tr>
<td><?= $value['item_1']; ?></td>
<td><?= $value['item_2']; ?></td>
<td><?= $value['item_3']; ?></td>
<td class="text-center"><?=
$value['transaction']; ?></td>
<td class="text-center"><?=
$value['support']; ?></td>
<td class="text-center">
<div class="badge badge- success">Lolos</div>
</td>
</tr>
<?php } ?>
</tbody>
liii
</table>
</div>
<div class="tab-pane" id="ruleset4"
role="tabpanel">
<table class="table table-bordered table-striped table-vcenter js-dataTable-full" id="js-dataTable-ruleset4">
<thead>
<tr>
<th>Rule</th>
<th class="text-center">X U Y</th>
<th class="text-center">X</th>
<th class="text-center">Nilai Support</th>
<th class="text-center">Nilai Confidence</th>
</tr>
</thead>
<tbody>
<?php foreach
($data['association_itemset_4'] as $key => $value) { ?>
<tr>
<td style="width: 40%;"><?=
$value['rule']; ?></td>
<td class="text-center"><?=
$value['antecendent']; ?></td>
<td class="text-center"><?=
$value['consequent']; ?></td>
<td class="text-center"><?=
$value['support']; ?></td>
<td class="text-center"><?=
$value['confidence']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
liv
</x-block>
<?php } ?>
<x-block>
<h4>Aturan Asosiasi Final</h4>
<div class="block">
<table class="table table-bordered table-striped table- vcenter js-dataTable-full" id="js-dataTable-rule">
<thead>
<tr>
<th>Rule</th>
<th class="text-center">X U Y</th>
<th class="text-center">X</th>
<th class="text-center">Nilai Support</th>
<th class="text-center">Nilai Confidence</th>
<th class="text-center">Lift Ratio</th>
</tr>
</thead>
<tbody>
<?php foreach ($data['association_rule'] as $key =>
$value) { ?>
<tr>
<td style="width: 40%;"><?= $value['rule'];
?></td>
<td class="text-center"><?=
$value['antecendent']; ?></td>
<td class="text-center"><?=
$value['consequent']; ?></td>
<td class="text-center"><?=
$value['support']; ?></td>
<td class="text-center"><?=
$value['confidence']; ?></td>
<td class="text-center"><?=
$value['lift_ratio']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
lv
</x-block>
<?php } ?>
@endsection
@section('script')
<script
src="{{asset('js/plugins/flatpickr/flatpickr.min.js')}}"></script>
<script
src="{{asset('plugins/datatables/jquery.dataTables.min.js')}}"></s cript>
<script
src="{{asset('plugins/datatables/dataTables.bootstrap4.min.js')}}"
></script>
<script>
jQuery(function() {
Codebase.helpers(['flatpickr']);
});
$('#js-dataTable-itemset1lolos').DataTable();
$('#js-dataTable-itemset1tidaklolos').DataTable();
$('#js-dataTable-itemset2').DataTable();
$('#js-dataTable-ruleset2').DataTable();
$('#js-dataTable-itemset3').DataTable();
$('#js-dataTable-ruleset3').DataTable();
$('#js-dataTable-itemset4').DataTable();
$('#js-dataTable-ruleset4').DataTable();
$('#js-dataTable-rule').DataTable();
</script>
@endsection