Skip to content

Commit 364b879

Browse files
committed
Stylistic enhancements to ARX
1 parent 983484a commit 364b879

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

src/main/scala/com/cloudera/sparkts/Lag.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private[sparkts] object Lag {
124124
* matrix of the form [a_-1 a_-2 b_-1 b_-2 c_-1 c_-2]
125125
* The original time series is not included in the matrix.
126126
*/
127-
def lagMatTrimBoth(x: Array[Array[Double]], maxLag: Int) : Array[Array[Double]] = {
127+
def lagMatTrimBoth(x: Array[Array[Double]], maxLag: Int): Array[Array[Double]] = {
128128
lagMatTrimBoth(x, maxLag, false)
129129
}
130130
}

src/main/scala/com/cloudera/sparkts/models/AutoregressionX.scala

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ object AutoregressionX {
4646
* @return an ARXModel, which is an autoregressive model with exogenous variables
4747
*/
4848
def fitModel(
49-
y: Vector[Double],
50-
x: Matrix[Double],
51-
yMaxLag: Int,
52-
xMaxLag: Int,
53-
includeOriginalX: Boolean = true,
54-
noIntercept: Boolean = false): ARXModel = {
49+
y: Vector[Double],
50+
x: Matrix[Double],
51+
yMaxLag: Int,
52+
xMaxLag: Int,
53+
includeOriginalX: Boolean = true,
54+
noIntercept: Boolean = false): ARXModel = {
5555
val maxLag = max(yMaxLag, xMaxLag)
5656
val arrY = y.toArray
5757
// Make left hand side, note that we must drop the first maxLag terms
@@ -69,11 +69,11 @@ object AutoregressionX {
6969

7070

7171
private[sparkts] def assemblePredictors(
72-
y: Array[Double],
73-
x: Array[Array[Double]],
74-
yMaxLag: Int,
75-
xMaxLag: Int,
76-
includeOriginalX: Boolean = true): Array[Array[Double]] = {
72+
y: Array[Double],
73+
x: Array[Array[Double]],
74+
yMaxLag: Int,
75+
xMaxLag: Int,
76+
includeOriginalX: Boolean = true): Array[Array[Double]] = {
7777
val maxLag = max(yMaxLag, xMaxLag)
7878
// AR terms from dependent variable (autoregressive portion)
7979
val arY = Lag.lagMatTrimBoth(y, yMaxLag)
@@ -92,22 +92,20 @@ object AutoregressionX {
9292
}
9393
}
9494

95-
// Jose note: not extending timeseries model, since seems to me to be a different type of model
96-
// addingTimeDpendent...etc wouldn't apply here with the original signature, since we need
97-
// exogenous variables provided
9895
/**
99-
* An autoregressive model with exogenous variables
100-
* @param c an intercept term, zero if none desired
101-
* @param coefficients the coefficients for the various terms. The order of coefficients is as
96+
* An autoregressive model with exogenous variables.
97+
*
98+
* @param c An intercept term, zero if none desired.
99+
* @param coefficients The coefficients for the various terms. The order of coefficients is as
102100
* follows:
103101
* - Autoregressive terms for the dependent variable, in increasing order of lag
104102
* - For each column in the exogenous matrix (in their original order), the
105103
* lagged terms in increasing order of lag (excluding the non-lagged versions).
106104
* - The coefficients associated with the non-lagged exogenous matrix
107-
* @param yMaxLag the maximum lag order for the dependent variable
108-
* @param xMaxLag the maximum lag order for exogenous variables
109-
* @param includesOriginalX a boolean flag indicating if the non-lagged exogenous variables should
110-
* be included
105+
* @param yMaxLag The maximum lag order for the dependent variable.
106+
* @param xMaxLag The maximum lag order for exogenous variables.
107+
* @param includesOriginalX A boolean flag indicating if the non-lagged exogenous variables should
108+
* be included.
111109
*/
112110
class ARXModel(
113111
val c: Double,

0 commit comments

Comments
 (0)