Skip to content

Commit

Permalink
feat(TypeScript): introduce IArimaResult interface
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and bcoe committed Oct 8, 2019
1 parent c2c42c9 commit 4cd3a71
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ accept your pull requests.
1. Ensure that your code adheres to the existing style in the code to which
you are contributing.
1. Ensure that your code has an appropriate set of tests which all pass.
1. Title your pull request following [Conventional Commits](https://www.conventionalcommits.org/) styling.
1. Submit a pull request.

## Running the tests
Expand All @@ -46,8 +47,16 @@ accept your pull requests.

1. Run the tests:

# Run all tests.
npm test

# Run all unit tests.
npm run test-only

# Run all system tests.
gcloud auth application-default login
npm run system-test

1. Lint (and maybe fix) any changes:

npm run fix
Expand Down
98 changes: 98 additions & 0 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,103 @@ declare namespace bigquery {
name?: string;
};

/**
* Arima coefficients.
*/
type IArimaCoefficients = {
/**
* Auto-regressive coefficients, an array of double.
*/
autoRegressiveCoefficients?: Array<number>;
/**
* Intercept coefficient, just a double not an array.
*/
interceptCoefficient?: number;
/**
* Moving-average coefficients, an array of double.
*/
movingAverageCoefficients?: Array<number>;
};

/**
* ARIMA model fitting metrics.
*/
type IArimaFittingMetrics = {
/**
* AIC
*/
aic?: number;
/**
* log-likelihood
*/
logLikelihood?: number;
/**
* variance.
*/
variance?: number;
};

/**
* Arima model information.
*/
type IArimaModelInfo = {
/**
* Arima coefficients.
*/
arimaCoefficients?: IArimaCoefficients;
/**
* Arima fitting metrics.
*/
arimaFittingMetrics?: IArimaFittingMetrics;
/**
* Non-seasonal order.
*/
nonSeasonalOrder?: IArimaOrder;
};

/**
* Arima order, can be used for both non-seasonal and seasonal parts.
*/
type IArimaOrder = {
/**
* Order of the differencing part.
*/
d?: string;
/**
* Order of the autoregressive part.
*/
p?: string;
/**
* Order of the moving-average part.
*/
q?: string;
};

/**
* (Auto-)arima fitting result. Wrap everything in ArimaResult for easier
* refactoring if we want to use model-specific iteration results.
*/
type IArimaResult = {
/**
* This message is repeated because there are multiple arima models
* fitted in auto-arima. For non-auto-arima model, its size is one.
*/
arimaModelInfo?: Array<IArimaModelInfo>;
/**
* Seasonal periods. Repeated because multiple periods are supported for
* one time series.
*/
seasonalPeriods?: Array<
| 'SEASONAL_PERIOD_TYPE_UNSPECIFIED'
| 'NO_SEASONALITY'
| 'DAILY'
| 'WEEKLY'
| 'MONTHLY'
| 'QUARTERLY'
| 'YEARLY'
>;
};

type IBigQueryModelTraining = {
/**
* [Output-only, Beta] Index of current ML training iteration. Updated during create model query job to show job progress.
Expand Down Expand Up @@ -910,6 +1007,7 @@ declare namespace bigquery {
* Information about a single iteration of the training run.
*/
type IIterationResult = {
arimaResult?: IArimaResult;
/**
* Information about top clusters for clustering models.
*/
Expand Down
2 changes: 1 addition & 1 deletion synth.metadata
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"updateTime": "2019-10-01T11:09:53.670779Z",
"updateTime": "2019-10-08T11:09:26.452867Z",
"sources": [
{
"template": {
Expand Down

0 comments on commit 4cd3a71

Please sign in to comment.