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
590035e1
Commit
590035e1
authored
6 years ago
by
Simon Belak
Browse files
Options
Downloads
Patches
Plain Diff
Add tests
parent
54907619
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/sync/analyze/fingerprint/insights.clj
+13
-7
13 additions, 7 deletions
src/metabase/sync/analyze/fingerprint/insights.clj
test/metabase/sync/analyze/fingerprint/insights_test.clj
+23
-0
23 additions, 0 deletions
test/metabase/sync/analyze/fingerprint/insights_test.clj
with
36 additions
and
7 deletions
src/metabase/sync/analyze/fingerprint/insights.clj
+
13
−
7
View file @
590035e1
...
...
@@ -118,14 +118,20 @@
{
:model
(
model
offset
slope
)
:formula
(
formula
offset
slope
)}))))
(
apply
redux/juxt
))
:validation-set
((
map
(
juxt
fx
fy
))
(
reservoir-sample
validation-set-size
))})
:validation-set
((
keep
(
fn
[
row
]
(
let
[
x
(
fx
row
)
y
(
fy
row
)]
(
when
(
and
x
y
)
[
x
y
]))))
(
reservoir-sample
validation-set-size
))})
(
fn
[{
:keys
[
validation-set
fits
]}]
(
->>
fits
(
remove
nil?
)
(
apply
min-key
#
(
transduce
identity
(
rmse
(
comp
(
:model
%
)
first
)
second
)
validation-set
))
:formula
))))
(
some->>
fits
(
remove
nil?
)
not-empty
(
apply
min-key
#
(
transduce
identity
(
rmse
(
comp
(
:model
%
)
first
)
second
)
validation-set
))
:formula
))))
(
defn-
timeseries?
[{
:keys
[
numbers
datetimes
others
]}]
...
...
This diff is collapsed.
Click to expand it.
test/metabase/sync/analyze/fingerprint/insights_test.clj
0 → 100644
+
23
−
0
View file @
590035e1
(
ns
metabase.sync.analyze.fingerprint.insights-test
(
:require
[
expectations
:refer
:all
]
[
metabase.sync.analyze.fingerprint.insights
:refer
:all
]))
(
def
^
:private
cols
[{
:base_type
:type/DateTime
}
{
:base_type
:type/Number
}])
(
expect
700
(
->
(
transduce
identity
(
insights
cols
)
[[
"2014"
100
]
[
"2015"
200
]
[
"2016"
nil
]
[
nil
300
]
[
nil
nil
]
[
"2017"
700
]])
first
:last-value
))
;; Here we just make sure we don't blow up on empty input
(
expect
nil
(
->
(
transduce
identity
(
insights
cols
)
[])
first
:last-value
))
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