A1essandro/neural-network

View on GitHub

Showing 5 of 7 total issues

Function teachKit has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function teachKit(array $kit, array $expectations, $error = 0.3, $maxIterations = 10000)
    {
        if (count($kit) != count($expectations)) {
            throw new Exception("Kit and expectations quantities must be equals");
        }
Severity: Minor
Found in src/BackpropagationTeacher.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function teach has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function teach(array $input, array $expectation)
    {
        $this->perceptron->input($input)->output();
        $nFilter = function ($node) {
            return $node instanceof Neuron;
Severity: Minor
Found in src/BackpropagationTeacher.php - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function generateSynapses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function generateSynapses()
    {
        for ($i = 0; $i < count($this->layers) - 1; $i++) {
            $curLayer = $this->layers[$i];
            $nextLayer = $this->layers[$i + 1];
Severity: Minor
Found in src/KohonenNetwork.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function getChildSigmas has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getChildSigmas($sigmas, $forNeuron)
    {
        $sigma = 0;
        foreach ($sigmas as $neuronWithSigma) {
            foreach ($neuronWithSigma->neuron->getSynapses() as $synapse) {
Severity: Minor
Found in src/BackpropagationTeacher.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function generateSynapses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function generateSynapses()
    {
        $filterNotBias = function($node) {
            return !$node instanceof Bias;
        };
Severity: Minor
Found in src/MultilayerPerceptron.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language