Completed
Push — develop ( 95bfc8...365a9b )
by Arkadiusz
02:42
created

SVR::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 7
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 7
loc 7
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 5
nc 1
nop 9

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
declare (strict_types = 1);
4
5
namespace Phpml\Regression;
6
7
use Phpml\SupportVectorMachine\Kernel;
8
use Phpml\SupportVectorMachine\SupportVectorMachine;
9
use Phpml\SupportVectorMachine\Type;
10
11 View Code Duplication
class SVR extends SupportVectorMachine implements Regression
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    /**
14
     * @param int        $kernel
15
     * @param int        $degree
16
     * @param float      $epsilon
17
     * @param float      $cost
18
     * @param float|null $gamma
19
     * @param float      $coef0
20
     * @param float      $tolerance
21
     * @param int        $cacheSize
22
     * @param bool       $shrinking
23
     */
24
    public function __construct(
25
        int $kernel = Kernel::RBF, int $degree = 3, float $epsilon = 0.1, float $cost = 1.0,
26
        float $gamma = null, float $coef0 = 0.0,  float $tolerance = 0.001,
27
        int $cacheSize = 100, bool $shrinking = true
28
    ) {
29
        parent::__construct(Type::EPSILON_SVR, $kernel, $cost, 0.5, $degree, $gamma, $coef0, $epsilon, $tolerance, $cacheSize, $shrinking, false);
30
    }
31
}
32