Commit 17f558a7 authored by Alexandre Croix's avatar Alexandre Croix

Add phpinsights analysis

parent d7114376
Pipeline #1736 failed with stages
in 3 minutes and 25 seconds
......@@ -19,6 +19,7 @@ test:7.1:
script:
- vendor/bin/phpcs
- vendor/bin/phpunit
- vendor/bin/phpinsights -v
test:7.2:
stage: test
......@@ -31,6 +32,7 @@ test:7.2:
script:
- vendor/bin/phpcs
- vendor/bin/phpunit
- vendor/bin/phpinsights -v
test:7.3:
stage: test
......@@ -43,5 +45,6 @@ test:7.3:
script:
- vendor/bin/phpcs
- vendor/bin/phpunit
- vendor/bin/phpinsights -v
......@@ -20,7 +20,8 @@
"require-dev": {
"squizlabs/php_codesniffer": "^3.3",
"phpunit/phpunit": "^7",
"monolog/monolog": "^1.23"
"monolog/monolog": "^1.23",
"nunomaduro/phpinsights": "^1.0"
},
"autoload": {
"psr-4": {
......
This diff is collapsed.
......@@ -36,29 +36,7 @@ if ($solutionType == 'distance') {
$solutionType = new SolutionAUC(5);
}
//$crossoverRate = 55;
//$populationSize = 170;
//$mutationRate = 17;
//$maxGeneration = 120;
//$generationInitialPopulationMethod = TrainerParameters::INITIAL_POPULATION_GENERATION_RANDOM;
//Read data and expected result
//$data = array_slice(unserialize(file_get_contents(__DIR__ . "/../webshell_data2.ser")), 0, 10);
//$expected = array_slice(unserialize(file_get_contents(__DIR__ . "/../webshell_expected2.ser")), 0, 10);
//$data = unserialize(file_get_contents(__DIR__ . "/../webshell_data2.ser"));
//$expected = unserialize(file_get_contents(__DIR__ . "/../webshell_expected2.ser"));
//$data = unserialize(file_get_contents(__DIR__ . "/../../../webshell-detector/trainer_files/data_file_3jyLSa"));
//$expected = unserialize(file_get_contents(
//__DIR__ . "/../../../webshell-detector/trainer_files/expected_file_abX2Ad"));
//$data = unserialize(file_get_contents(__DIR__ . "/../webshell_data2.ser"));
//$expected = unserialize(file_get_contents(__DIR__ . "/../webshell_expected2.ser"));
//$data = unserialize(file_get_contents(__DIR__ . "/../data_for_k_fold"));
//$expected = unserialize(file_get_contents(__DIR__ . "/../expected_for_k_fold"));
$data = unserialize(file_get_contents($dataFileName));
$expected = unserialize(file_get_contents($expectedFileName));
......@@ -105,42 +83,4 @@ echo "Average score : $averageScore \n";
$logger->debug("Execution time : " . $elepased_time . " seconds");
//$file = fopen('SimpleTest.csv', 'w');
//fputcsv($file, array('Wowa', 'Average', 'Expected'));
//for ($i = 0; $i < count($data); $i++) {
// $wowa = WOWA::wowa($result->weights_w, $result->weights_p, $data[$i]);
// $average = array_sum($data[$i]) / count($data[$i]);
// fputcsv(
// $file,
// array($wowa, $average, $expected[$i])
// );
//}
//Utils::computeStatisticalInformation($data, $expected, 50, 'Statistical.txt', $result);
/*
$weight_w = [0.1, 0.2, 0.3, 0.1, 0.3];
$weight_p = [0.3, 0.2, 0.2, 0.1, 0.2];
$data = [];
for ($i = 0; $i < 50; $i++) {
$elements = [];
for ($j = 0; $j < 5; $j++) {
$elements[$j] = mt_rand() / mt_getrandmax();
}
$data[$i] = $elements;
}
var_dump($data);
$expected = [];
for ($i = 0; $i < 50; $i++) {
$expected[$i] = WOWA::wowa($weight_w, $weight_p, $data[$i]);
}
$logger = new Logger('wowa-training-test');
$parameters = new TrainerParameters($logger);
$trainer = new Trainer($parameters, new SolutionDistance());
$solutions = $trainer->run($data, $expected);
var_dump($solutions);
*/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment