Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
0120e0be
Commit
0120e0be
authored
7 years ago
by
Simon Belak
Browse files
Options
Downloads
Patches
Plain Diff
Fix growth when current period is 0
parent
c98e9404
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/feature_extraction/feature_extractors.clj
+1
-2
1 addition, 2 deletions
src/metabase/feature_extraction/feature_extractors.clj
test/metabase/feature_extraction/feature_extractors_test.clj
+10
-2
10 additions, 2 deletions
test/metabase/feature_extraction/feature_extractors_test.clj
with
11 additions
and
4 deletions
src/metabase/feature_extraction/feature_extractors.clj
+
1
−
2
View file @
0120e0be
...
...
@@ -49,13 +49,12 @@
(
defn
growth
"Relative difference between `x1` an `x2`."
[
x2
x1
]
(
when
(
and
x1
x2
)
(
when
(
and
x1
x2
(
not
(
zero?
x1
))
)
(
let
[
x2
(
double
x2
)
x1
(
double
x1
)]
(
cond
(
every?
neg?
[
x1
x2
])
(
growth
(
-
x1
)
(
-
x2
))
(
and
(
neg?
x1
)
(
pos?
x2
))
(
-
(
growth
x1
x2
))
(
nil?
x1
)
nil
:else
(
/
(
*
(
if
(
neg?
x1
)
-1
1
)
(
-
x2
x1
))
x1
)))))
(
defn-
merge-juxt
...
...
This diff is collapsed.
Click to expand it.
test/metabase/feature_extraction/feature_extractors_test.clj
+
10
−
2
View file @
0120e0be
...
...
@@ -20,12 +20,20 @@
1.0
-0.5
-5.0
5.0
]
5.0
2.0
nil
nil
nil
]
[(
growth
123
100
)
(
growth
-0.1
-0.2
)
(
growth
-0.4
-0.2
)
(
growth
-0.4
0.1
)
(
growth
0.1
-0.4
)])
(
growth
0.1
-0.4
)
(
growth
Long/MAX_VALUE
Long/MIN_VALUE
)
(
growth
0.1
nil
)
(
growth
nil
0.5
)
(
growth
0.5
0.0
)])
(
expect
[{
:foo
2
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment