code fixes

This commit is contained in:
Dennis Eichhorn 2023-09-21 12:32:00 +00:00
parent 6b74b8d968
commit d1edf04232
3 changed files with 9 additions and 3 deletions

View File

@ -84,6 +84,7 @@ abstract class NgramParser
* @return array
*
* @since 1.0.0
* @phpstan-ignore
*/
protected function getNgrams(string $str) : array
{
@ -101,7 +102,6 @@ abstract class NgramParser
}
}
/** @var array|non-empty-array $tokens */
foreach ($tokens as $i => $token) {
$sum = \array_sum($token);
@ -115,7 +115,10 @@ abstract class NgramParser
}
$tokens = \array_merge(...$tokens);
if (isset($tokens['_'])) {
unset($tokens['_']);
}
\arsort($tokens, \SORT_NUMERIC);

View File

@ -58,6 +58,7 @@ final class KernelsND
$cov = $bandwithMatrix->mult($identityMatrix);
/** @phpstan-ignore-next-line */
$exponent = $distnaceMatrix->dot($cov->inverse())->mult($distnaceMatrix)->sum(1)->mult(-0.5);
return $exponent->exp()->mult((1 / \pow(2 * \M_PI, $dim / 2)) * \pow($cov->det(), 0.5))->matrix;

View File

@ -42,6 +42,8 @@ final class DataMapperAbstractTest extends \PHPUnit\Framework\TestCase
{
$this->model = new BaseModel();
var_dump($GLOBALS['dbpool']->get());
$GLOBALS['dbpool']->get()->con->prepare(
'CREATE TABLE `test_base` (
`test_base_id` int(11) NOT NULL AUTO_INCREMENT,