forked from jorgecasas/php-ml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Optimizer initial theta randomization (#239)
* Fix Optimizer initial theta randomization * Add more tests for LUDecomposition and FuzzyCMeans
- Loading branch information
Showing
6 changed files
with
105 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Phpml\Tests\Math\LinearAlgebra; | ||
|
||
use Phpml\Exception\MatrixException; | ||
use Phpml\Math\LinearAlgebra\LUDecomposition; | ||
use Phpml\Math\Matrix; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* LUDecomposition is used and tested in Matrix::inverse method so not all tests are required | ||
*/ | ||
final class LUDecompositionTest extends TestCase | ||
{ | ||
public function testNotSquareMatrix(): void | ||
{ | ||
$this->expectException(MatrixException::class); | ||
|
||
new LUDecomposition(new Matrix([1, 2, 3, 4, 5])); | ||
} | ||
|
||
public function testSolveWithInvalidMatrix(): void | ||
{ | ||
$this->expectException(MatrixException::class); | ||
|
||
$lu = new LUDecomposition(new Matrix([[1, 2], [3, 4]])); | ||
$lu->solve(new Matrix([1, 2, 3])); | ||
} | ||
} |