<?php

/*******************************************
****            PHP example             ****
**** (c) 2017-2019, Alessandro Pedretti ****
*******************************************/


require 'financial_service.php';

$Model = new T2PHP_FINANCIAL_SERVICE();


/**** Prediction example 1 ****/

$Model -> LifeStyle = T2PHP_FINANCIAL_SERVICE::C_LIFESTYLE_SPENDGSAVING;
$Model -> Type      = T2PHP_FINANCIAL_SERVICE::C_TYPE_STUDENT;
$Model -> Vacation  = 6.0;
$Model -> eCredit   = 40.0;
$Model -> property  = 3.2804;
$Model -> salary    = 13.62;

echo "\n* Example #1\n";
echo "  Domain violations: " . $Model -> DomCheck() . " (must be 0)\n";
echo "  Predicted class:   " . $Model -> Classify() . " (real 0)\n";


/**** Prediction example 2 ****/

$Model -> LifeStyle = T2PHP_FINANCIAL_SERVICE::C_LIFESTYLE_SPENDGSAVING;
$Model -> Type      = T2PHP_FINANCIAL_SERVICE::C_TYPE_LIBRARIAN;
$Model -> Vacation  = 7.0;
$Model -> eCredit   = 10.0;
$Model -> property  = 1.2225;
$Model -> salary    = 18.1751;

echo "\n* Example #2\n";
echo "  Domain violations: " . $Model -> DomCheck() . " (must be 0)\n";
echo "  Predicted class:   " . $Model -> Classify() . " (real 1)\n";


/**** Prediction example 3 ****/

$Model -> LifeStyle = T2PHP_FINANCIAL_SERVICE::C_LIFESTYLE_SPENDLSAVING;
$Model -> Type      = T2PHP_FINANCIAL_SERVICE::C_TYPE_STUDENT;
$Model -> Vacation  = 6.0;
$Model -> eCredit   = 73.0;
$Model -> property  = 4.8256;
$Model -> salary    = 31.75;

echo "\n* Example #3\n";
echo "  Domain violations: " . $Model -> DomCheck() . " (must be 0)\n";
echo "  Predicted class:   " . $Model -> Classify() . " (real 2)\n";


/**** Prediction example 4 ****/

$Model -> LifeStyle = T2PHP_FINANCIAL_SERVICE::C_LIFESTYLE_SPENDLSAVING;
$Model -> Type      = T2PHP_FINANCIAL_SERVICE::C_TYPE_DOCTOR;
$Model -> Vacation  = 47.0;
$Model -> eCredit   = 51.0;
$Model -> property  = 5.6494;
$Model -> salary    = 18.45;

echo "\n* Example #4\n";
echo "  Domain violations: " . $Model -> DomCheck() . " (must be 0)\n";
echo "  Predicted class:   " . $Model -> Classify() . " (real 3)\n";


/**** Prediction example 5 ****/

$Model -> LifeStyle = T2PHP_FINANCIAL_SERVICE::C_LIFESTYLE_SPENDGSAVING;
$Model -> Type      = T2PHP_FINANCIAL_SERVICE::C_TYPE_PROFESSOR;
$Model -> Vacation  = 48.0;
$Model -> eCredit   = 5.0;
$Model -> property  = 1.7536;
$Model -> salary    = 20.39;

echo "\n* Example #5\n";
echo "  Domain violations: " . $Model -> DomCheck() . " (must be 0)\n";
echo "  Predicted class:   " . $Model -> Classify() . " (real 4)\n";

?>
