mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-11 06:28:40 +00:00
fixes
This commit is contained in:
parent
edd4693111
commit
4027a9159f
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
|
@ -193,7 +193,7 @@ jobs:
|
||||||
- name: Setup Composer
|
- name: Setup Composer
|
||||||
run: composer install
|
run: composer install
|
||||||
- name: phpcs
|
- name: phpcs
|
||||||
run: vendor/bin/phpcs ./ --standard="Build/Config/phpcs.xml" -s --report=full
|
run: vendor/bin/phpcs --severity=1 ./ --standard="Build/Config/phpcs.xml" -s --report=full
|
||||||
linting:
|
linting:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: "!contains(github.event.head_commit.message, 'NO_CI')"
|
if: "!contains(github.event.head_commit.message, 'NO_CI')"
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,8 @@ final class Metrics
|
||||||
* @param array $purchaseProbability Purchase probabilities for different periods
|
* @param array $purchaseProbability Purchase probabilities for different periods
|
||||||
* @param array $payoffs Payoff vector (first element = payoff - cost, other elements = -cost, last element = 0)
|
* @param array $payoffs Payoff vector (first element = payoff - cost, other elements = -cost, last element = 0)
|
||||||
*
|
*
|
||||||
* @return Matrix A vector which shows in row i the return of the customer if he didn't buy i - 1 times before (=recency of the customer = how many periods has it been since he bought the last time)
|
* @return Matrix A vector which shows in row i the return of the customer if he didn't buy i - 1 times before
|
||||||
|
* (=recency of the customer = how many periods has it been since he bought the last time)
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ In rare cases errors, failures or warnings during the automatic inspection are
|
||||||
Automated checks which are run during the review process:
|
Automated checks which are run during the review process:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
php ./vendor/bin/phpcs ./ --standard="Build/Config/phpcs.xml"
|
php ./vendor/bin/phpcs --severity=1 ./ --standard="Build/Config/phpcs.xml"
|
||||||
npx eslint ./ -c ./Build/Config/.eslintrc.json
|
npx eslint ./ -c ./Build/Config/.eslintrc.json
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,10 @@ final class NaiveBayesClassifier
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$p = (1 / \sqrt(2 * \M_PI * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'])
|
$p = (1 / \sqrt(2 * \M_PI * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'])
|
||||||
* \exp(-($value - $this->probabilities['criteria'][$criteria]['attr'][$attr]['mean']) ** 2 / (2 * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'])))
|
* \exp(-($value - $this->probabilities['criteria'][$criteria]['attr'][$attr]['mean']) ** 2
|
||||||
|
/ (2 * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'])
|
||||||
|
)
|
||||||
|
)
|
||||||
* ($this->probabilities['criteria'][$criteria]['count'] / $this->probabilities['count'])
|
* ($this->probabilities['criteria'][$criteria]['count'] / $this->probabilities['count'])
|
||||||
/ $this->probabilities['attr'][$attr]['data'];
|
/ $this->probabilities['attr'][$attr]['data'];
|
||||||
|
|
||||||
|
|
@ -177,14 +180,20 @@ final class NaiveBayesClassifier
|
||||||
foreach ($subDict as $attr => $valueArray) {
|
foreach ($subDict as $attr => $valueArray) {
|
||||||
if ($valueArray['type'] === 2) {
|
if ($valueArray['type'] === 2) {
|
||||||
$this->probabilities['criteria'][$criteria]['attr'][$attr]['mean'] = Average::arithmeticMean($this->dict[$criteria][$attr]['data']);
|
$this->probabilities['criteria'][$criteria]['attr'][$attr]['mean'] = Average::arithmeticMean($this->dict[$criteria][$attr]['data']);
|
||||||
$this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'] = MeasureOfDispersion::sampleVariance($this->dict[$criteria][$attr]['data'], $this->probabilities['criteria'][$criteria]['attr'][$attr]['mean']);
|
$this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'] = MeasureOfDispersion::sampleVariance(
|
||||||
|
$this->dict[$criteria][$attr]['data'],
|
||||||
|
$this->probabilities['criteria'][$criteria]['attr'][$attr]['mean']
|
||||||
|
);
|
||||||
|
|
||||||
if (!isset($this->probabilities['attr'][$attr])) {
|
if (!isset($this->probabilities['attr'][$attr])) {
|
||||||
$this->probabilities['attr'][$attr] = ['data' => 0.0];
|
$this->probabilities['attr'][$attr] = ['data' => 0.0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->probabilities['attr'][$attr]['data'] += (1 / \sqrt(2 * \M_PI * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'])
|
$this->probabilities['attr'][$attr]['data'] += (1 / \sqrt(2 * \M_PI * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'])
|
||||||
* \exp(-($toMatch[$attr] - $this->probabilities['criteria'][$criteria]['attr'][$attr]['mean']) ** 2 / (2 * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'])))
|
* \exp(-($toMatch[$attr] - $this->probabilities['criteria'][$criteria]['attr'][$attr]['mean']) ** 2
|
||||||
|
/ (2 * $this->probabilities['criteria'][$criteria]['attr'][$attr]['variance'])
|
||||||
|
)
|
||||||
|
)
|
||||||
* ($this->probabilities['criteria'][$criteria]['count'] / $this->probabilities['count']);
|
* ($this->probabilities['criteria'][$criteria]['count'] / $this->probabilities['count']);
|
||||||
} else {
|
} else {
|
||||||
if (!isset($this->probabilities['attr'][$attr])) {
|
if (!isset($this->probabilities['attr'][$attr])) {
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ final class ConsoleResponse extends ResponseAbstract implements RenderableInterf
|
||||||
$render .= StringUtils::stringify($response);
|
$render .= StringUtils::stringify($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $render;
|
return $optimize ? \trim($render) : $render;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,8 @@ final class Rest
|
||||||
$boundary = '----' . \uniqid();
|
$boundary = '----' . \uniqid();
|
||||||
$data = self::createMultipartData($boundary, $request->getData());
|
$data = self::createMultipartData($boundary, $request->getData());
|
||||||
|
|
||||||
// @todo: replace boundary/ with the correct boundary= in the future. Currently this cannot be done due to a bug. If we do it now the server cannot correclty populate php://input
|
// @todo: replace boundary/ with the correct boundary= in the future.
|
||||||
|
// Currently this cannot be done due to a bug. If we do it now the server cannot correclty populate php://input
|
||||||
$headers['content-type'] = 'Content-Type: multipart/form-data; boundary/' . $boundary;
|
$headers['content-type'] = 'Content-Type: multipart/form-data; boundary/' . $boundary;
|
||||||
$headers['content-length'] = 'Content-Length: ' . \strlen($data);
|
$headers['content-length'] = 'Content-Length: ' . \strlen($data);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user