Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
8048e36a
Commit
8048e36a
authored
Aug 24, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
for forecast_ets functions
parent
2427466a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
26 deletions
+31
-26
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+31
-26
No files found.
cell/model/FormulaObjects/statisticalFunctions.js
View file @
8048e36a
...
...
@@ -3825,21 +3825,22 @@
var aNullDate = ;
var mnMonthDay = 1;
mfStepSize = ::std::numeric_limits<double>::max();
if ( mnMonthDay )
}*/
var
mfStepSize
=
Number
.
MAX_VALUE
;
if
(
/*mnMonthDay*/
true
)
{
for ( SCSIZE
i = 0; i < mnCount; i++ )
for
(
var
i
=
0
;
i
<
mnCount
;
i
++
)
{
aDate = aNullDate + static_cast< long >( maRange[ i ].X );
maRange[ i ].X = aDate.GetYear() * 12 + aDate.GetMonth();
var
aDate
=
Date
.
prototype
.
getDateFromExcel
(
maRange
[
i
].
X
);
maRange
[
i
].
X
=
aDate
.
getUTCFullYear
()
*
12
+
aDate
.
getMonth
();
}
}
}*/
var
mfStepSize
=
Number
.
MAX_VALUE
;
for
(
var
i
=
1
;
i
<
mnCount
;
i
++
)
{
var
fStep
=
maRange
[
i
].
X
-
maRange
[
i
-
1
].
X
;
if
(
fStep
===
0.0
)
{
if
(
nAggregation
===
0
)
{
...
...
@@ -3932,7 +3933,7 @@
}
// step must be constant (or gap multiple of step)
/*
var bHasGap = false;
var
bHasGap
=
false
;
for
(
var
i
=
1
;
i
<
mnCount
&&
!
bHasGap
;
i
++
)
{
var
fStep
=
maRange
[
i
].
X
-
maRange
[
i
-
1
].
X
;
...
...
@@ -3942,49 +3943,53 @@
}
bHasGap
=
true
;
}
}
*/
}
/*
if ( bHasGap )
if
(
bHasGap
)
{
var
nMissingXCount
=
0
;
var
fOriginalCount
=
mnCount
;
if ( mnMonthDay )
aDate = aNullDate + static_cast< long >( maRange[ 0 ].X );
if
(
/*mnMonthDay*/
true
){
aDate
=
Date
.
prototype
.
getDateFromExcel
(
maRange
[
0
].
X
);
}
for
(
var
i
=
1
;
i
<
mnCount
;
i
++
)
{
double
fDist;
if (
mnMonthDay
)
var
fDist
;
if
(
/*mnMonthDay*/
true
)
{
Date aDate1 = aNullDate + static_cast< long >( maRange[ i ].X
);
fDist = 12 * ( aDate1.
GetYear() - aDate.Get
Year() ) +
( aDate1.
GetMonth() - aDate.G
etMonth() );
var
aDate1
=
Date
.
prototype
.
getDateFromExcel
(
maRange
[
i
].
X
);
fDist
=
12
*
(
aDate1
.
getUTCFullYear
()
-
aDate
.
getUTCFull
Year
()
)
+
(
aDate1
.
getMonth
()
-
aDate
.
g
etMonth
()
);
aDate
=
aDate1
;
}
else
else
{
fDist
=
maRange
[
i
].
X
-
maRange
[
i
-
1
].
X
;
}
if
(
fDist
>
mfStepSize
)
{
// gap, insert missing data points
var
fYGap
=
(
maRange
[
i
].
Y
+
maRange
[
i
-
1
].
Y
)
/
2.0
;
for
(
var
fXGap
=
maRange
[
i
-
1
].
X
+
mfStepSize
;
fXGap
<
maRange
[
i
].
X
;
fXGap
+=
mfStepSize
)
{
maRange.insert( maRange.begin() + i, DataPoint( fXGap, ( bDataCompletion ? fYGap : 0.0 ) ) );
var
newAddElem
=
{
X
:
fXGap
,
Y
:
(
bDataCompletion
?
fYGap
:
0.0
)};
maRange
.
splice
(
i
,
1
,
newAddElem
);
i
++
;
mnCount
++
;
nMissingXCount
++
;
if (
static_cast< double >( nMissingXCount )
/ fOriginalCount > 0.3 )
if
(
nMissingXCount
/
fOriginalCount
>
0.3
)
{
// maximum of 30% missing points exceeded
mnErrorValue = FormulaError::NoValue;
return false;
return
new
cError
(
cErrorType
.
wrong_value_type
);
}
}
}
}
}
if ( rSmplInPrd != 1 )
/*
if ( rSmplInPrd != 1 )
mnSmplInPrd = rSmplInPrd;
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment