PHP code example of sensasi-delight / fuzzy-ce-php

1. Go to this page and download the library: Download sensasi-delight/fuzzy-ce-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sensasi-delight / fuzzy-ce-php example snippets


    $evaluation_index = [
        'u1' => ['u11', 'u12'],
        'u2' => ['u21', 'u22', 'u23'],
        'u3' => ['u31', 'u32'],
        'u4' => ['u41', 'u42'],
        'u5' => ['u51', 'u52']
    ];
    

    $weights = [
        'u1' => 0.133,
        'u2' => 0.310,
        'u3' => 0.330,
        'u4' => 0.118,
        'u5' => 0.109,
        'u11' => 0.667,
        'u12' => 0.333,
        'u21' => 0.200,
        'u22' => 0.400,
        'u23' => 0.400,
        'u31' => 0.333,
        'u32' => 0.667,
        'u41' => 0.667,
        'u42' => 0.333,
        'u51' => 0.750,
        'u52' => 0.250
    ];
    

    $assesment_scale = [
        'Excellent' => 5,
        'Good' => 4,
        'Medium' => 3,
        'Poor' => 2,
        'Worst' => 1
    ];
    

    $assesment_data = [
        "u11" => [
            "expert1" => 5,
            "expert2" => 4,
            "expert3" => 4,
            "expert4" => 4,
            "expert5" => 3,
        ], "u12" => [
            "expert1" => 5,
            "expert2" => 5,
            "expert3" => 4,
            "expert4" => 3,
            "expert5" => 3,
        ], 
        
        ...
        
        "u52" => [
            "expert1" => 4,
            "expert2" => 3,
            "expert3" => 3,
            "expert4" => 3,
            "expert5" => 3,
        ], ...

    ];
    

    $fuzzyCE = new FuzzyCE(
        $evaluation_index,
        $weights,
        $assesment_scale,
        $assesment_data
    );
    

    $fuzzyCE = new FuzzyCE();

    $fuzzyCE->set_evaluation_index($evaluation_index);
    $fuzzyCE->set_weights($weights);
    $fuzzyCE->set_assesment_scale($assesment_scale);
    $fuzzyCE->set_assesment_data($assesment_data);
    

        print_r($fuzzyCE->get_evaluation());
        

        echo $fuzzyCE->get_grade();
        

        echo $fuzzyCE->get_grade_score();