{"action":"created","comment":{"url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/pulls/comments/77377469","id":77377469,"diff_hunk":"@@ -0,0 +1,583 @@\n+/**\n+ * Copyright (c) 2016, Cloudera, Inc. All Rights Reserved.\n+ *\n+ * Cloudera, Inc. licenses this file to you under the Apache License,\n+ * Version 2.0 (the \"License\"). You may not use this file except in\n+ * compliance with the License. You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * This software is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n+ * CONDITIONS OF ANY KIND, either express or implied. See the License for\n+ * the specific language governing permissions and limitations under the\n+ * License.\n+ */\n+\n+package com.cloudera.sparkts.models\n+\n+import breeze.linalg.{DenseMatrix => BreezeDenseMatrix, DenseVector => BreezeDenseVector, Matrix, diag, sum}\n+import com.cloudera.sparkts.MatrixUtil.{dvBreezeToSpark, mBreezeToSpark, toBreeze}\n+import com.cloudera.sparkts.UnivariateTimeSeries.{differencesOfOrderD, inverseDifferencesOfOrderD}\n+import org.apache.commons.math3.analysis.{MultivariateFunction, MultivariateVectorFunction}\n+import org.apache.commons.math3.optim.{InitialGuess, MaxEval, MaxIter, SimpleValueChecker}\n+import org.apache.commons.math3.optim.nonlinear.scalar.{GoalType, ObjectiveFunction, ObjectiveFunctionGradient}\n+import org.apache.commons.math3.optim.nonlinear.scalar.gradient.NonLinearConjugateGradientOptimizer\n+import org.apache.spark.mllib.linalg.{DenseVector, Vector}\n+\n+/**\n+  * The autoregressive integrated moving average with explanatory variables (ARIMAX)\n+  * Y_{t} = Beta*X_{t} + ARIMA_MODEL\n+  * Link [[http://support.sas.com/resources/papers/proceedings16/11823-2016.pdf]]\n+  */\n+\n+object ARIMAX {\n+\n+  /**\n+    * Given a time series, fit a non-seasonal ARIMAX model of order (p, d, q), where p represents\n+    * the autoregression terms, d represents the order of differencing, q moving average error\n+    * terms, xMaxLag the maximum lag order for exogenous variables. If includeOriginalXreg is true, the\n+    * model is fitted with the non-lagged exogenous variables. If includeIntercept is true, the model is\n+    * fitted with an intercept. In order to select the appropriate order of the model, users are advised\n+    * to inspect ACF and PACF plots, or compare the values of the objective function.\n+    *\n+    * @param p Autoregressive order\n+    * @param d Differencing order\n+    * @param q Aoving average order","path":"src/main/scala/com/cloudera/sparkts/models/ARIMAX.scala","position":45,"original_position":45,"commit_id":"ed36af3cbc8e9b281ac4cef09202e62edb0d1d48","original_commit_id":"ed36af3cbc8e9b281ac4cef09202e62edb0d1d48","user":{"login":"blbarker","id":11275078,"avatar_url":"https://avatars.githubusercontent.com/u/11275078?v=3","gravatar_id":"","url":"https://api.github.com/users/blbarker","html_url":"https://github.com/blbarker","followers_url":"https://api.github.com/users/blbarker/followers","following_url":"https://api.github.com/users/blbarker/following{/other_user}","gists_url":"https://api.github.com/users/blbarker/gists{/gist_id}","starred_url":"https://api.github.com/users/blbarker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blbarker/subscriptions","organizations_url":"https://api.github.com/users/blbarker/orgs","repos_url":"https://api.github.com/users/blbarker/repos","events_url":"https://api.github.com/users/blbarker/events{/privacy}","received_events_url":"https://api.github.com/users/blbarker/received_events","type":"User","site_admin":false},"body":"\"Moving\"?","created_at":"2016-09-02T16:51:09Z","updated_at":"2016-09-02T16:51:09Z","html_url":"https://github.com/trustedanalytics/spark-timeseries/pull/1#discussion_r77377469","pull_request_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/trustedanalytics/spark-timeseries/pulls/comments/77377469"},"html":{"href":"https://github.com/trustedanalytics/spark-timeseries/pull/1#discussion_r77377469"},"pull_request":{"href":"https://api.github.com/repos/trustedanalytics/spark-timeseries/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/pulls/1","id":83722936,"html_url":"https://github.com/trustedanalytics/spark-timeseries/pull/1","diff_url":"https://github.com/trustedanalytics/spark-timeseries/pull/1.diff","patch_url":"https://github.com/trustedanalytics/spark-timeseries/pull/1.patch","issue_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/issues/1","number":1,"state":"open","locked":false,"title":"ARIMAX: fitting model, prediction and tests","user":{"login":"ekote","id":6086762,"avatar_url":"https://avatars.githubusercontent.com/u/6086762?v=3","gravatar_id":"","url":"https://api.github.com/users/ekote","html_url":"https://github.com/ekote","followers_url":"https://api.github.com/users/ekote/followers","following_url":"https://api.github.com/users/ekote/following{/other_user}","gists_url":"https://api.github.com/users/ekote/gists{/gist_id}","starred_url":"https://api.github.com/users/ekote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekote/subscriptions","organizations_url":"https://api.github.com/users/ekote/orgs","repos_url":"https://api.github.com/users/ekote/repos","events_url":"https://api.github.com/users/ekote/events{/privacy}","received_events_url":"https://api.github.com/users/ekote/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-01T23:18:48Z","updated_at":"2016-09-02T16:51:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4b7184b4cbbf0074478655d85733be00956cc381","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/pulls/1/commits","review_comments_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/pulls/1/comments","review_comment_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/pulls/comments{/number}","comments_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/issues/1/comments","statuses_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/statuses/ed36af3cbc8e9b281ac4cef09202e62edb0d1d48","head":{"label":"ekote:arimax-dev","ref":"arimax-dev","sha":"ed36af3cbc8e9b281ac4cef09202e62edb0d1d48","user":{"login":"ekote","id":6086762,"avatar_url":"https://avatars.githubusercontent.com/u/6086762?v=3","gravatar_id":"","url":"https://api.github.com/users/ekote","html_url":"https://github.com/ekote","followers_url":"https://api.github.com/users/ekote/followers","following_url":"https://api.github.com/users/ekote/following{/other_user}","gists_url":"https://api.github.com/users/ekote/gists{/gist_id}","starred_url":"https://api.github.com/users/ekote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekote/subscriptions","organizations_url":"https://api.github.com/users/ekote/orgs","repos_url":"https://api.github.com/users/ekote/repos","events_url":"https://api.github.com/users/ekote/events{/privacy}","received_events_url":"https://api.github.com/users/ekote/received_events","type":"User","site_admin":false},"repo":{"id":63627475,"name":"spark-timeseries","full_name":"ekote/spark-timeseries","owner":{"login":"ekote","id":6086762,"avatar_url":"https://avatars.githubusercontent.com/u/6086762?v=3","gravatar_id":"","url":"https://api.github.com/users/ekote","html_url":"https://github.com/ekote","followers_url":"https://api.github.com/users/ekote/followers","following_url":"https://api.github.com/users/ekote/following{/other_user}","gists_url":"https://api.github.com/users/ekote/gists{/gist_id}","starred_url":"https://api.github.com/users/ekote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekote/subscriptions","organizations_url":"https://api.github.com/users/ekote/orgs","repos_url":"https://api.github.com/users/ekote/repos","events_url":"https://api.github.com/users/ekote/events{/privacy}","received_events_url":"https://api.github.com/users/ekote/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ekote/spark-timeseries","description":"A library for time series analysis on Apache Spark","fork":true,"url":"https://api.github.com/repos/ekote/spark-timeseries","forks_url":"https://api.github.com/repos/ekote/spark-timeseries/forks","keys_url":"https://api.github.com/repos/ekote/spark-timeseries/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ekote/spark-timeseries/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ekote/spark-timeseries/teams","hooks_url":"https://api.github.com/repos/ekote/spark-timeseries/hooks","issue_events_url":"https://api.github.com/repos/ekote/spark-timeseries/issues/events{/number}","events_url":"https://api.github.com/repos/ekote/spark-timeseries/events","assignees_url":"https://api.github.com/repos/ekote/spark-timeseries/assignees{/user}","branches_url":"https://api.github.com/repos/ekote/spark-timeseries/branches{/branch}","tags_url":"https://api.github.com/repos/ekote/spark-timeseries/tags","blobs_url":"https://api.github.com/repos/ekote/spark-timeseries/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ekote/spark-timeseries/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ekote/spark-timeseries/git/refs{/sha}","trees_url":"https://api.github.com/repos/ekote/spark-timeseries/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ekote/spark-timeseries/statuses/{sha}","languages_url":"https://api.github.com/repos/ekote/spark-timeseries/languages","stargazers_url":"https://api.github.com/repos/ekote/spark-timeseries/stargazers","contributors_url":"https://api.github.com/repos/ekote/spark-timeseries/contributors","subscribers_url":"https://api.github.com/repos/ekote/spark-timeseries/subscribers","subscription_url":"https://api.github.com/repos/ekote/spark-timeseries/subscription","commits_url":"https://api.github.com/repos/ekote/spark-timeseries/commits{/sha}","git_commits_url":"https://api.github.com/repos/ekote/spark-timeseries/git/commits{/sha}","comments_url":"https://api.github.com/repos/ekote/spark-timeseries/comments{/number}","issue_comment_url":"https://api.github.com/repos/ekote/spark-timeseries/issues/comments{/number}","contents_url":"https://api.github.com/repos/ekote/spark-timeseries/contents/{+path}","compare_url":"https://api.github.com/repos/ekote/spark-timeseries/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ekote/spark-timeseries/merges","archive_url":"https://api.github.com/repos/ekote/spark-timeseries/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ekote/spark-timeseries/downloads","issues_url":"https://api.github.com/repos/ekote/spark-timeseries/issues{/number}","pulls_url":"https://api.github.com/repos/ekote/spark-timeseries/pulls{/number}","milestones_url":"https://api.github.com/repos/ekote/spark-timeseries/milestones{/number}","notifications_url":"https://api.github.com/repos/ekote/spark-timeseries/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ekote/spark-timeseries/labels{/name}","releases_url":"https://api.github.com/repos/ekote/spark-timeseries/releases{/id}","deployments_url":"https://api.github.com/repos/ekote/spark-timeseries/deployments","created_at":"2016-07-18T18:34:22Z","updated_at":"2016-08-31T22:20:20Z","pushed_at":"2016-09-01T23:18:26Z","git_url":"git://github.com/ekote/spark-timeseries.git","ssh_url":"git@github.com:ekote/spark-timeseries.git","clone_url":"https://github.com/ekote/spark-timeseries.git","svn_url":"https://github.com/ekote/spark-timeseries","homepage":"","size":2007,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"trustedanalytics:master","ref":"master","sha":"44b030cc6875c471ad4eaa49a58f48b946092f68","user":{"login":"trustedanalytics","id":13385739,"avatar_url":"https://avatars.githubusercontent.com/u/13385739?v=3","gravatar_id":"","url":"https://api.github.com/users/trustedanalytics","html_url":"https://github.com/trustedanalytics","followers_url":"https://api.github.com/users/trustedanalytics/followers","following_url":"https://api.github.com/users/trustedanalytics/following{/other_user}","gists_url":"https://api.github.com/users/trustedanalytics/gists{/gist_id}","starred_url":"https://api.github.com/users/trustedanalytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trustedanalytics/subscriptions","organizations_url":"https://api.github.com/users/trustedanalytics/orgs","repos_url":"https://api.github.com/users/trustedanalytics/repos","events_url":"https://api.github.com/users/trustedanalytics/events{/privacy}","received_events_url":"https://api.github.com/users/trustedanalytics/received_events","type":"Organization","site_admin":false},"repo":{"id":52898086,"name":"spark-timeseries","full_name":"trustedanalytics/spark-timeseries","owner":{"login":"trustedanalytics","id":13385739,"avatar_url":"https://avatars.githubusercontent.com/u/13385739?v=3","gravatar_id":"","url":"https://api.github.com/users/trustedanalytics","html_url":"https://github.com/trustedanalytics","followers_url":"https://api.github.com/users/trustedanalytics/followers","following_url":"https://api.github.com/users/trustedanalytics/following{/other_user}","gists_url":"https://api.github.com/users/trustedanalytics/gists{/gist_id}","starred_url":"https://api.github.com/users/trustedanalytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trustedanalytics/subscriptions","organizations_url":"https://api.github.com/users/trustedanalytics/orgs","repos_url":"https://api.github.com/users/trustedanalytics/repos","events_url":"https://api.github.com/users/trustedanalytics/events{/privacy}","received_events_url":"https://api.github.com/users/trustedanalytics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/trustedanalytics/spark-timeseries","description":"A library for time series analysis on Apache Spark","fork":true,"url":"https://api.github.com/repos/trustedanalytics/spark-timeseries","forks_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/forks","keys_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/keys{/key_id}","collaborators_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/teams","hooks_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/hooks","issue_events_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/issues/events{/number}","events_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/events","assignees_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/assignees{/user}","branches_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/branches{/branch}","tags_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/tags","blobs_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/git/refs{/sha}","trees_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/git/trees{/sha}","statuses_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/statuses/{sha}","languages_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/languages","stargazers_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/stargazers","contributors_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/contributors","subscribers_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/subscribers","subscription_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/subscription","commits_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/commits{/sha}","git_commits_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/git/commits{/sha}","comments_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/comments{/number}","issue_comment_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/issues/comments{/number}","contents_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/contents/{+path}","compare_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/compare/{base}...{head}","merges_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/merges","archive_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/downloads","issues_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/issues{/number}","pulls_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/pulls{/number}","milestones_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/milestones{/number}","notifications_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/labels{/name}","releases_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/releases{/id}","deployments_url":"https://api.github.com/repos/trustedanalytics/spark-timeseries/deployments","created_at":"2016-03-01T18:02:20Z","updated_at":"2016-08-31T04:26:10Z","pushed_at":"2016-09-01T23:18:49Z","git_url":"git://github.com/trustedanalytics/spark-timeseries.git","ssh_url":"git@github.com:trustedanalytics/spark-timeseries.git","clone_url":"https://github.com/trustedanalytics/spark-timeseries.git","svn_url":"https://github.com/trustedanalytics/spark-timeseries","homepage":"","size":1946,"stargazers_count":1,"watchers_count":1,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/trustedanalytics/spark-timeseries/pulls/1"},"html":{"href":"https://github.com/trustedanalytics/spark-timeseries/pull/1"},"issue":{"href":"https://api.github.com/repos/trustedanalytics/spark-timeseries/issues/1"},"comments":{"href":"https://api.github.com/repos/trustedanalytics/spark-timeseries/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/trustedanalytics/spark-timeseries/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/trustedanalytics/spark-timeseries/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/trustedanalytics/spark-timeseries/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/trustedanalytics/spark-timeseries/statuses/ed36af3cbc8e9b281ac4cef09202e62edb0d1d48"}}}}
{"actor":{"display_login":"blbarker"}}