Skip to content

Commit 359cc24

Browse files
committed
Appease overbearing Stan
1 parent 838eb11 commit 359cc24

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"amphp/parallel": "^1.3",
3939
"psr/log": "^1.1",
4040
"rubix/tensor": "^3.0",
41-
"scienide/okbloomer": "^1.0",
41+
"andrewdalpino/okbloomer": "^1.0",
4242
"symfony/polyfill-mbstring": "^1.0",
4343
"symfony/polyfill-php80": "^1.17",
4444
"wamania/php-stemmer": "^2.0"

src/Transformers/IntervalDiscretizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class IntervalDiscretizer implements Transformer, Stateful, Persistable
4747
/**
4848
* The bin intervals of the fitted data.
4949
*
50-
* @var array<float[]>|null
50+
* @var array<(int|float)[]>|null
5151
*/
5252
protected ?array $intervals = null;
5353

@@ -92,7 +92,7 @@ public function fitted() : bool
9292
/**
9393
* Return the bin intervals of the fitted data.
9494
*
95-
* @return array<float[]>|null
95+
* @return array<(int|float)[]>|null
9696
*/
9797
public function intervals() : ?array
9898
{

src/Transformers/MinMaxNormalizer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ public function fit(Dataset $dataset) : void
137137
if ($type->isContinuous()) {
138138
$values = $dataset->feature($column);
139139

140+
/** @var int|float $min */
140141
$min = min($values);
142+
143+
/** @var int|float $max */
141144
$max = max($values);
142145

143146
$scale = ($this->max - $this->min) / (($max - $min) ?: EPSILON);
@@ -167,7 +170,10 @@ public function update(Dataset $dataset) : void
167170
foreach ($this->scales as $column => &$scale) {
168171
$values = $dataset->feature($column);
169172

173+
/** @var int|float $min */
170174
$min = min($this->minimums[$column], ...$values);
175+
176+
/** @var int|float $max */
171177
$max = max($this->maximums[$column], ...$values);
172178

173179
$scale = ($this->max - $this->min) / (($max - $min) ?: EPSILON);

src/Transformers/OneHotEncoder.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class OneHotEncoder implements Transformer, Stateful, Persistable
3737
/**
3838
* The set of unique possible categories per feature column of the training set.
3939
*
40-
* @var array<string[]>|null
40+
* @var array<int[]>|null
4141
*/
4242
protected ?array $categories = null;
4343

@@ -90,7 +90,10 @@ public function fit(Dataset $dataset) : void
9090

9191
$categories = array_values(array_unique($values));
9292

93-
$this->categories[$column] = array_flip($categories);
93+
/** @var int[] $offsets */
94+
$offsets = array_flip($categories);
95+
96+
$this->categories[$column] = $offsets;
9497
}
9598
}
9699
}

0 commit comments

Comments
 (0)