396 convert regressors to num power 1#416
Conversation
| $this->holdOut = $holdOut; | ||
| $this->costFn = $costFn ?? new LeastSquares(); | ||
| $this->metric = $metric ?? new RMSE(); | ||
| $this->packSamples = $packSamples; |
There was a problem hiding this comment.
Can we autodetect whether we need to pack samples or not? If so I'd prefer we did that instead of passing it in at the constructor. What happens if someone passes in packed samples and then unpacked samples after that?
There was a problem hiding this comment.
Refactored with auto-detection of arrays, that need pack operation - see array_pack() function
| public function featureImportances() : array | ||
| { | ||
| if (!isset($this->ensemble, $this->featureCount)) { | ||
| if (!$this->ensemble || !$this->featureCount) { |
There was a problem hiding this comment.
This new lines is not the same as the old logic. Why did you change it?
| $this->network = new FeedForward( | ||
| new Placeholder1D($dataset->numFeatures()), | ||
| [new Dense(1, $this->l2Penalty, true, new Xavier2())], | ||
| [new Dense(1, $this->l2Penalty, true, new XavierUniform())], |
There was a problem hiding this comment.
Since XavierUniform implements Xavier1 initialization, this change is not equivalent to the old line. We'll need to implement Xavier2Uniform and rename XavierUniform to Xavier1Uniform.
| $this->network = new FeedForward( | ||
| new Placeholder1D($dataset->numFeatures()), | ||
| [new Dense(count($classes), $this->l2Penalty, true, new Xavier1())], | ||
| [new Dense(count($classes), $this->l2Penalty, true, new XavierNormal())], |
There was a problem hiding this comment.
XavierNormal is not equivalent to Xavier1 which samples from a uniform distribution.
| $hiddenLayers = $this->hiddenLayers; | ||
|
|
||
| $hiddenLayers[] = new Dense(count($classes), 0.0, true, new Xavier1()); | ||
| $hiddenLayers[] = new Dense(count($classes), 0.0, true, new XavierNormal()); |
There was a problem hiding this comment.
XavierNormal is not equivalent to Xavier1 which samples from a uniform distribution.
| $this->network = new FeedForward( | ||
| new Placeholder1D($dataset->numFeatures()), | ||
| [new Dense(1, $this->l2Penalty, true, new Xavier1())], | ||
| [new Dense(1, $this->l2Penalty, true, new XavierNormal())], |
There was a problem hiding this comment.
XavierNormal is not equivalent to Xavier1 which samples from a uniform distribution.
No description provided.