Skip to content

Commit

Permalink
Added notes on session table, changed BQML logic to optional
Browse files Browse the repository at this point in the history
  • Loading branch information
agregori97 committed Jul 11, 2024
1 parent a4ea34f commit 0b73fa9
Show file tree
Hide file tree
Showing 20 changed files with 102 additions and 43 deletions.
6 changes: 3 additions & 3 deletions dashboards/arima.dashboard.lookml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
svg-icon\" viewBox=\"0 0 20 20\">\n<path d=\"M15.94,10.179l-2.437-0.325l1.62-7.379c0.047-0.235-0.132-0.458-0.372-0.458H5.25c-0.241,0-0.42,0.223-0.373,0.458l1.634,7.376L4.06,10.179c-0.312,0.041-0.446,0.425-0.214,0.649l2.864,2.759l-0.724,3.947c-0.058,0.315,0.277,0.554,0.559,0.401l3.457-1.916l3.456,1.916c-0.419-0.238,0.56,0.439,0.56-0.401l-0.725-3.947l2.863-2.759C16.388,10.604,16.254,10.22,15.94,10.179M10.381,2.778h3.902l-1.536,6.977L12.036,9.66l-1.655-3.546V2.778z\
\ M5.717,2.778h3.903v3.335L7.965,9.66L7.268,9.753L5.717,2.778zM12.618,13.182c-0.092,0.088-0.134,0.217-0.11,0.343l0.615,3.356l-2.938-1.629c-0.057-0.03-0.122-0.048-0.184-0.048c-0.063,0-0.128,0.018-0.185,0.048l-2.938,1.629l0.616-3.356c0.022-0.126-0.019-0.255-0.11-0.343l-2.441-2.354l3.329-0.441c0.128-0.017,0.24-0.099,0.295-0.215l1.435-3.073l1.435,3.073c0.055,0.116,0.167,0.198,0.294,0.215l3.329,0.441L12.618,13.182z\"\
></path>\n</svg>\nPropensity Performance</a>\n<a style=\"padding: 5px; line-height: 40px;\"\
\ href=\"/dashboards-next/ga4::ga4::arima\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
\ href=\"/dashboards-next/ga4::arima\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
svg-icon\" viewBox=\"0 0 20 20\">\n<path d=\"M15.94,10.179l-2.437-0.325l1.62-7.379c0.047-0.235-0.132-0.458-0.372-0.458H5.25c-0.241,0-0.42,0.223-0.373,0.458l1.634,7.376L4.06,10.179c-0.312,0.041-0.446,0.425-0.214,0.649l2.864,2.759l-0.724,3.947c-0.058,0.315,0.277,0.554,0.559,0.401l3.457-1.916l3.456,1.916c-0.419-0.238,0.56,0.439,0.56-0.401l-0.725-3.947l2.863-2.759C16.388,10.604,16.254,10.22,15.94,10.179M10.381,2.778h3.902l-1.536,6.977L12.036,9.66l-1.655-3.546V2.778z\
\ M5.717,2.778h3.903v3.335L7.965,9.66L7.268,9.753L5.717,2.778zM12.618,13.182c-0.092,0.088-0.134,0.217-0.11,0.343l0.615,3.356l-2.938-1.629c-0.057-0.03-0.122-0.048-0.184-0.048c-0.063,0-0.128,0.018-0.185,0.048l-2.938,1.629l0.616-3.356c0.022-0.126-0.019-0.255-0.11-0.343l-2.441-2.354l3.329-0.441c0.128-0.017,0.24-0.099,0.295-0.215l1.435-3.073l1.435,3.073c0.055,0.116,0.167,0.198,0.294,0.215l3.329,0.441L12.618,13.182z\"\
></path>\n</svg>\nARIMA Event Model</a>\n<a style=\"padding: 5px; line-height: 40px;\"\
\ href=\"/dashboards-next/ga4::ga4::avbb\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
\ href=\"/dashboards-next/ga4::avbb\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
svg-icon\" viewBox=\"0 0 20 20\">\n<path d=\"M15.94,10.179l-2.437-0.325l1.62-7.379c0.047-0.235-0.132-0.458-0.372-0.458H5.25c-0.241,0-0.42,0.223-0.373,0.458l1.634,7.376L4.06,10.179c-0.312,0.041-0.446,0.425-0.214,0.649l2.864,2.759l-0.724,3.947c-0.058,0.315,0.277,0.554,0.559,0.401l3.457-1.916l3.456,1.916c-0.419-0.238,0.56,0.439,0.56-0.401l-0.725-3.947l2.863-2.759C16.388,10.604,16.254,10.22,15.94,10.179M10.381,2.778h3.902l-1.536,6.977L12.036,9.66l-1.655-3.546V2.778z\
\ M5.717,2.778h3.903v3.335L7.965,9.66L7.268,9.753L5.717,2.778zM12.618,13.182c-0.092,0.088-0.134,0.217-0.11,0.343l0.615,3.356l-2.938-1.629c-0.057-0.03-0.122-0.048-0.184-0.048c-0.063,0-0.128,0.018-0.185,0.048l-2.938,1.629l0.616-3.356c0.022-0.126-0.019-0.255-0.11-0.343l-2.441-2.354l3.329-0.441c0.128-0.017,0.24-0.099,0.295-0.215l1.435-3.073l1.435,3.073c0.055,0.116,0.167,0.198,0.294,0.215l3.329,0.441L12.618,13.182z\"\
></path>\n</svg>\nAggregated Value Based Bidding</a>\n</nav>\n</div>"
Expand Down Expand Up @@ -560,4 +560,4 @@
model: ga4
explore: sessions
listens_to_filters: []
field: events.event_name
field: events.event_name
6 changes: 3 additions & 3 deletions dashboards/avbb.dashboard.lookml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@
svg-icon\" viewBox=\"0 0 20 20\">\n<path d=\"M15.94,10.179l-2.437-0.325l1.62-7.379c0.047-0.235-0.132-0.458-0.372-0.458H5.25c-0.241,0-0.42,0.223-0.373,0.458l1.634,7.376L4.06,10.179c-0.312,0.041-0.446,0.425-0.214,0.649l2.864,2.759l-0.724,3.947c-0.058,0.315,0.277,0.554,0.559,0.401l3.457-1.916l3.456,1.916c-0.419-0.238,0.56,0.439,0.56-0.401l-0.725-3.947l2.863-2.759C16.388,10.604,16.254,10.22,15.94,10.179M10.381,2.778h3.902l-1.536,6.977L12.036,9.66l-1.655-3.546V2.778z\
\ M5.717,2.778h3.903v3.335L7.965,9.66L7.268,9.753L5.717,2.778zM12.618,13.182c-0.092,0.088-0.134,0.217-0.11,0.343l0.615,3.356l-2.938-1.629c-0.057-0.03-0.122-0.048-0.184-0.048c-0.063,0-0.128,0.018-0.185,0.048l-2.938,1.629l0.616-3.356c0.022-0.126-0.019-0.255-0.11-0.343l-2.441-2.354l3.329-0.441c0.128-0.017,0.24-0.099,0.295-0.215l1.435-3.073l1.435,3.073c0.055,0.116,0.167,0.198,0.294,0.215l3.329,0.441L12.618,13.182z\"\
></path>\n</svg>\nPropensity Performance</a>\n<a style=\"padding: 5px; line-height: 40px;\"\
\ href=\"/dashboards-next/ga4::ga4::arima\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
\ href=\"/dashboards-next/ga4::arima\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
svg-icon\" viewBox=\"0 0 20 20\">\n<path d=\"M15.94,10.179l-2.437-0.325l1.62-7.379c0.047-0.235-0.132-0.458-0.372-0.458H5.25c-0.241,0-0.42,0.223-0.373,0.458l1.634,7.376L4.06,10.179c-0.312,0.041-0.446,0.425-0.214,0.649l2.864,2.759l-0.724,3.947c-0.058,0.315,0.277,0.554,0.559,0.401l3.457-1.916l3.456,1.916c-0.419-0.238,0.56,0.439,0.56-0.401l-0.725-3.947l2.863-2.759C16.388,10.604,16.254,10.22,15.94,10.179M10.381,2.778h3.902l-1.536,6.977L12.036,9.66l-1.655-3.546V2.778z\
\ M5.717,2.778h3.903v3.335L7.965,9.66L7.268,9.753L5.717,2.778zM12.618,13.182c-0.092,0.088-0.134,0.217-0.11,0.343l0.615,3.356l-2.938-1.629c-0.057-0.03-0.122-0.048-0.184-0.048c-0.063,0-0.128,0.018-0.185,0.048l-2.938,1.629l0.616-3.356c0.022-0.126-0.019-0.255-0.11-0.343l-2.441-2.354l3.329-0.441c0.128-0.017,0.24-0.099,0.295-0.215l1.435-3.073l1.435,3.073c0.055,0.116,0.167,0.198,0.294,0.215l3.329,0.441L12.618,13.182z\"\
></path>\n</svg>\nARIMA Event Model</a>\n<a style=\"padding: 5px; line-height: 40px;\"\
\ href=\"/dashboards-next/ga4::ga4::avbb\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
\ href=\"/dashboards-next/ga4::avbb\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
svg-icon\" viewBox=\"0 0 20 20\">\n<path d=\"M15.94,10.179l-2.437-0.325l1.62-7.379c0.047-0.235-0.132-0.458-0.372-0.458H5.25c-0.241,0-0.42,0.223-0.373,0.458l1.634,7.376L4.06,10.179c-0.312,0.041-0.446,0.425-0.214,0.649l2.864,2.759l-0.724,3.947c-0.058,0.315,0.277,0.554,0.559,0.401l3.457-1.916l3.456,1.916c-0.419-0.238,0.56,0.439,0.56-0.401l-0.725-3.947l2.863-2.759C16.388,10.604,16.254,10.22,15.94,10.179M10.381,2.778h3.902l-1.536,6.977L12.036,9.66l-1.655-3.546V2.778z\
\ M5.717,2.778h3.903v3.335L7.965,9.66L7.268,9.753L5.717,2.778zM12.618,13.182c-0.092,0.088-0.134,0.217-0.11,0.343l0.615,3.356l-2.938-1.629c-0.057-0.03-0.122-0.048-0.184-0.048c-0.063,0-0.128,0.018-0.185,0.048l-2.938,1.629l0.616-3.356c0.022-0.126-0.019-0.255-0.11-0.343l-2.441-2.354l3.329-0.441c0.128-0.017,0.24-0.099,0.295-0.215l1.435-3.073l1.435,3.073c0.055,0.116,0.167,0.198,0.294,0.215l3.329,0.441L12.618,13.182z\"\
></path>\n</svg>\nAggregated Value Based Bidding</a>\n</nav>\n</div>"
Expand Down Expand Up @@ -454,4 +454,4 @@
model: ga4
explore: category_attribution
listens_to_filters: []
field: category_attribution.processed_input
field: category_attribution.processed_input
6 changes: 3 additions & 3 deletions dashboards/performance_metrics_model.dashboard.lookml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@
svg-icon\" viewBox=\"0 0 20 20\">\n<path d=\"M15.94,10.179l-2.437-0.325l1.62-7.379c0.047-0.235-0.132-0.458-0.372-0.458H5.25c-0.241,0-0.42,0.223-0.373,0.458l1.634,7.376L4.06,10.179c-0.312,0.041-0.446,0.425-0.214,0.649l2.864,2.759l-0.724,3.947c-0.058,0.315,0.277,0.554,0.559,0.401l3.457-1.916l3.456,1.916c-0.419-0.238,0.56,0.439,0.56-0.401l-0.725-3.947l2.863-2.759C16.388,10.604,16.254,10.22,15.94,10.179M10.381,2.778h3.902l-1.536,6.977L12.036,9.66l-1.655-3.546V2.778z\
\ M5.717,2.778h3.903v3.335L7.965,9.66L7.268,9.753L5.717,2.778zM12.618,13.182c-0.092,0.088-0.134,0.217-0.11,0.343l0.615,3.356l-2.938-1.629c-0.057-0.03-0.122-0.048-0.184-0.048c-0.063,0-0.128,0.018-0.185,0.048l-2.938,1.629l0.616-3.356c0.022-0.126-0.019-0.255-0.11-0.343l-2.441-2.354l3.329-0.441c0.128-0.017,0.24-0.099,0.295-0.215l1.435-3.073l1.435,3.073c0.055,0.116,0.167,0.198,0.294,0.215l3.329,0.441L12.618,13.182z\"\
></path>\n</svg>\nPropensity Performance</a>\n<a style=\"padding: 5px; line-height: 40px;\"\
\ href=\"/dashboards-next/ga4::ga4::arima\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
\ href=\"/dashboards-next/ga4::arima\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
svg-icon\" viewBox=\"0 0 20 20\">\n<path d=\"M15.94,10.179l-2.437-0.325l1.62-7.379c0.047-0.235-0.132-0.458-0.372-0.458H5.25c-0.241,0-0.42,0.223-0.373,0.458l1.634,7.376L4.06,10.179c-0.312,0.041-0.446,0.425-0.214,0.649l2.864,2.759l-0.724,3.947c-0.058,0.315,0.277,0.554,0.559,0.401l3.457-1.916l3.456,1.916c-0.419-0.238,0.56,0.439,0.56-0.401l-0.725-3.947l2.863-2.759C16.388,10.604,16.254,10.22,15.94,10.179M10.381,2.778h3.902l-1.536,6.977L12.036,9.66l-1.655-3.546V2.778z\
\ M5.717,2.778h3.903v3.335L7.965,9.66L7.268,9.753L5.717,2.778zM12.618,13.182c-0.092,0.088-0.134,0.217-0.11,0.343l0.615,3.356l-2.938-1.629c-0.057-0.03-0.122-0.048-0.184-0.048c-0.063,0-0.128,0.018-0.185,0.048l-2.938,1.629l0.616-3.356c0.022-0.126-0.019-0.255-0.11-0.343l-2.441-2.354l3.329-0.441c0.128-0.017,0.24-0.099,0.295-0.215l1.435-3.073l1.435,3.073c0.055,0.116,0.167,0.198,0.294,0.215l3.329,0.441L12.618,13.182z\"\
></path>\n</svg>\nARIMA Event Model</a>\n<a style=\"padding: 5px; line-height: 40px;\"\
\ href=\"/dashboards-next/ga4::ga4::avbb\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
\ href=\"/dashboards-next/ga4::avbb\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
svg-icon\" viewBox=\"0 0 20 20\">\n<path d=\"M15.94,10.179l-2.437-0.325l1.62-7.379c0.047-0.235-0.132-0.458-0.372-0.458H5.25c-0.241,0-0.42,0.223-0.373,0.458l1.634,7.376L4.06,10.179c-0.312,0.041-0.446,0.425-0.214,0.649l2.864,2.759l-0.724,3.947c-0.058,0.315,0.277,0.554,0.559,0.401l3.457-1.916l3.456,1.916c-0.419-0.238,0.56,0.439,0.56-0.401l-0.725-3.947l2.863-2.759C16.388,10.604,16.254,10.22,15.94,10.179M10.381,2.778h3.902l-1.536,6.977L12.036,9.66l-1.655-3.546V2.778z\
\ M5.717,2.778h3.903v3.335L7.965,9.66L7.268,9.753L5.717,2.778zM12.618,13.182c-0.092,0.088-0.134,0.217-0.11,0.343l0.615,3.356l-2.938-1.629c-0.057-0.03-0.122-0.048-0.184-0.048c-0.063,0-0.128,0.018-0.185,0.048l-2.938,1.629l0.616-3.356c0.022-0.126-0.019-0.255-0.11-0.343l-2.441-2.354l3.329-0.441c0.128-0.017,0.24-0.099,0.295-0.215l1.435-3.073l1.435,3.073c0.055,0.116,0.167,0.198,0.294,0.215l3.329,0.441L12.618,13.182z\"\
></path>\n</svg>\nAggregated Value Based Bidding</a>\n</nav>\n</div>"
Expand Down Expand Up @@ -385,4 +385,4 @@
model: ga4
explore: sessions
listens_to_filters: []
field: sessions.session_date
field: sessions.session_date
6 changes: 3 additions & 3 deletions dashboards/propensity_model.dashboard.lookml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@
svg-icon\" viewBox=\"0 0 20 20\">\n<path d=\"M15.94,10.179l-2.437-0.325l1.62-7.379c0.047-0.235-0.132-0.458-0.372-0.458H5.25c-0.241,0-0.42,0.223-0.373,0.458l1.634,7.376L4.06,10.179c-0.312,0.041-0.446,0.425-0.214,0.649l2.864,2.759l-0.724,3.947c-0.058,0.315,0.277,0.554,0.559,0.401l3.457-1.916l3.456,1.916c-0.419-0.238,0.56,0.439,0.56-0.401l-0.725-3.947l2.863-2.759C16.388,10.604,16.254,10.22,15.94,10.179M10.381,2.778h3.902l-1.536,6.977L12.036,9.66l-1.655-3.546V2.778z\
\ M5.717,2.778h3.903v3.335L7.965,9.66L7.268,9.753L5.717,2.778zM12.618,13.182c-0.092,0.088-0.134,0.217-0.11,0.343l0.615,3.356l-2.938-1.629c-0.057-0.03-0.122-0.048-0.184-0.048c-0.063,0-0.128,0.018-0.185,0.048l-2.938,1.629l0.616-3.356c0.022-0.126-0.019-0.255-0.11-0.343l-2.441-2.354l3.329-0.441c0.128-0.017,0.24-0.099,0.295-0.215l1.435-3.073l1.435,3.073c0.055,0.116,0.167,0.198,0.294,0.215l3.329,0.441L12.618,13.182z\"\
></path>\n</svg>\nPropensity Performance</a>\n<a style=\"padding: 5px; line-height: 40px;\"\
\ href=\"/dashboards-next/ga4::ga4::arima\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
\ href=\"/dashboards-next/ga4::arima\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
svg-icon\" viewBox=\"0 0 20 20\">\n<path d=\"M15.94,10.179l-2.437-0.325l1.62-7.379c0.047-0.235-0.132-0.458-0.372-0.458H5.25c-0.241,0-0.42,0.223-0.373,0.458l1.634,7.376L4.06,10.179c-0.312,0.041-0.446,0.425-0.214,0.649l2.864,2.759l-0.724,3.947c-0.058,0.315,0.277,0.554,0.559,0.401l3.457-1.916l3.456,1.916c-0.419-0.238,0.56,0.439,0.56-0.401l-0.725-3.947l2.863-2.759C16.388,10.604,16.254,10.22,15.94,10.179M10.381,2.778h3.902l-1.536,6.977L12.036,9.66l-1.655-3.546V2.778z\
\ M5.717,2.778h3.903v3.335L7.965,9.66L7.268,9.753L5.717,2.778zM12.618,13.182c-0.092,0.088-0.134,0.217-0.11,0.343l0.615,3.356l-2.938-1.629c-0.057-0.03-0.122-0.048-0.184-0.048c-0.063,0-0.128,0.018-0.185,0.048l-2.938,1.629l0.616-3.356c0.022-0.126-0.019-0.255-0.11-0.343l-2.441-2.354l3.329-0.441c0.128-0.017,0.24-0.099,0.295-0.215l1.435-3.073l1.435,3.073c0.055,0.116,0.167,0.198,0.294,0.215l3.329,0.441L12.618,13.182z\"\
></path>\n</svg>\nARIMA Event Model</a>\n<a style=\"padding: 5px; line-height: 40px;\"\
\ href=\"/dashboards-next/ga4::ga4::avbb\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
\ href=\"/dashboards-next/ga4::avbb\">\n<svg style=\"height: 16px; fill: #4285F4;\" class=\"\
svg-icon\" viewBox=\"0 0 20 20\">\n<path d=\"M15.94,10.179l-2.437-0.325l1.62-7.379c0.047-0.235-0.132-0.458-0.372-0.458H5.25c-0.241,0-0.42,0.223-0.373,0.458l1.634,7.376L4.06,10.179c-0.312,0.041-0.446,0.425-0.214,0.649l2.864,2.759l-0.724,3.947c-0.058,0.315,0.277,0.554,0.559,0.401l3.457-1.916l3.456,1.916c-0.419-0.238,0.56,0.439,0.56-0.401l-0.725-3.947l2.863-2.759C16.388,10.604,16.254,10.22,15.94,10.179M10.381,2.778h3.902l-1.536,6.977L12.036,9.66l-1.655-3.546V2.778z\
\ M5.717,2.778h3.903v3.335L7.965,9.66L7.268,9.753L5.717,2.778zM12.618,13.182c-0.092,0.088-0.134,0.217-0.11,0.343l0.615,3.356l-2.938-1.629c-0.057-0.03-0.122-0.048-0.184-0.048c-0.063,0-0.128,0.018-0.185,0.048l-2.938,1.629l0.616-3.356c0.022-0.126-0.019-0.255-0.11-0.343l-2.441-2.354l3.329-0.441c0.128-0.017,0.24-0.099,0.295-0.215l1.435-3.073l1.435,3.073c0.055,0.116,0.167,0.198,0.294,0.215l3.329,0.441L12.618,13.182z\"\
></path>\n</svg>\nAggregated Value Based Bidding</a>\n</nav>\n</div>"
Expand Down Expand Up @@ -441,4 +441,4 @@
model: ga4
explore: sessions
listens_to_filters: []
field: sessions.session_date
field: sessions.session_date
6 changes: 5 additions & 1 deletion manifest.lkml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ project_name: "ga_four"

## Connection Constants:
constant: GA4_CONNECTION {
value: ""
value: "bq-looker-marketplace"
export: override_required
}

Expand All @@ -23,6 +23,10 @@ constant: model_step_prediction {
value: "60"
#export: override_optional
}
constant: BQML_PARAMETER {
value: "Yes"
export: override_optional
}

constant: GA4_BQML_train_months {
value: "12"
Expand Down
4 changes: 4 additions & 0 deletions marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"EVENT_COUNT": {
"label": "Event Count Limit"
}
},
"BQML_PARAMETER": {
"label": "BQML Models Included"
}
},
"models": [
{
Expand Down
1 change: 1 addition & 0 deletions models/ga4.model.lkml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ datagroup: ga4_attribution_channel {
sql_trigger: SELECT 1 ;;
}


persist_with: ga4_main_datagroup
5 changes: 3 additions & 2 deletions views/bqml/arima_event_model/forecasting.view.lkml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ include: "/views/bqml/*/*.view.lkml"
view: forecasting {
derived_table: {
sql_trigger_value: ${model_arima.SQL_TABLE_NAME} ;;
sql: SELECT * FROM ML.EXPLAIN_FORECAST(MODEL ${model_arima.SQL_TABLE_NAME},
STRUCT(60 AS horizon, 0.8 AS confidence_level)) ;;
sql:
SELECT * FROM ML.EXPLAIN_FORECAST(MODEL ${model_arima.SQL_TABLE_NAME},
STRUCT(60 AS horizon, 0.8 AS confidence_level));;
}
dimension: forecast_timestamp
{
Expand Down
14 changes: 10 additions & 4 deletions views/bqml/arima_event_model/model_arima.view.lkml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ view: model_arima {
#extension: required
derived_table: {
sql_trigger_value: ${training_input_arima.SQL_TABLE_NAME};;
sql_create: CREATE OR REPLACE MODEL ${SQL_TABLE_NAME}
sql_create:
CREATE OR REPLACE MODEL ${SQL_TABLE_NAME}
OPTIONS(
MODEL_TYPE='ARIMA_PLUS',
time_series_timestamp_col='sessions_session_date',
time_series_data_col='sum_of_session_event_count',
time_series_id_col='events_event_name',
auto_arima=true) AS
SELECT *
FROM ${training_input_arima.SQL_TABLE_NAME};;
FROM ${training_input_arima.SQL_TABLE_NAME}
;;
}
dimension: ts {
type: string
Expand All @@ -35,15 +37,19 @@ view: model_arima {
#explore: forecasting {}
view: optimal_model_coeff{
derived_table: {
sql: SELECT * FROM ML.ARIMA_COEFFICIENTS(MODEL ${model_arima.SQL_TABLE_NAME});;
sql:
SELECT * FROM ML.ARIMA_COEFFICIENTS(MODEL ${model_arima.SQL_TABLE_NAME})
;;
}
dimension: ar_coefficients {type:number sql:${TABLE}.ar_coefficients;;}
dimension: ma_coefficients {type:number sql:${TABLE}.ma_coefficients;;}
dimension: intercept_or_drift {type:number sql:${TABLE}.intercept_or_drift;;}
}
view: model_evaluation {
derived_table: {
sql: SELECT * FROM ML.ARIMA_EVALUATE(MODEL ${model_arima.SQL_TABLE_NAME});;
sql:
SELECT * FROM ML.ARIMA_EVALUATE(MODEL ${model_arima.SQL_TABLE_NAME})
;;
}
dimension: events_event_name {type:string sql:${TABLE}.events_event_name ;;}
dimension: has_drift {type:string sql:${TABLE}.has_drift ;;}
Expand Down
3 changes: 2 additions & 1 deletion views/bqml/arima_event_model/training_input_arima.view.lkml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
view: training_input_arima {
derived_table: {
sql_trigger_value: ${incremental_prediction.SQL_TABLE_NAME} ;;
sql:SELECT
sql:
SELECT
(DATE(TIMESTAMP_MICROS(events.event_timestamp) )) AS sessions_session_date,
events.event_name AS events_event_name,
COUNT(DISTINCT sessions.sl_key ) AS sum_of_session_event_count
Expand Down
5 changes: 3 additions & 2 deletions views/bqml/avbb/training_data_avbb.view.lkml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ include: "/views/*/*.view.lkml"
view: training_data_avbb {
derived_table: {
sql_trigger_value: ${forecasting.SQL_TABLE_NAME} ;;
sql:SELECT sessions.sl_key,
sql:
SELECT sessions.sl_key,
session_attribution.source,
session_attribution.medium,
session_attribution.campaign,
Expand All @@ -14,7 +15,7 @@ view: training_data_avbb {
SUM(session_data.session_page_view_count) as session_count,
COALESCE(SUM(event_data[SAFE_OFFSET(0)].user_ltv.revenue),0.0) as label
FROM ${sessions.SQL_TABLE_NAME} as sessions
LEFT JOIN UNNEST(sessions.event_data) as events with offset as event_row GROUP BY 1,2,3,4,5,6,7 ;;
LEFT JOIN UNNEST(sessions.event_data) as events with offset as event_row GROUP BY 1,2,3,4,5,6,7;;
}
dimension: sl_key {
hidden: yes
Expand Down
2 changes: 1 addition & 1 deletion views/bqml/purchase_propensity/future_input.view.lkml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,6 @@ view: future_input {
SELECT
* EXCEPT(will_purchase_in_future)
FROM
user_model);;
CASE WHEN @{BQML_PARAMETER}='Yes' THEN user_model ELSE (SELECT 1,"1" as will_purchase_in_future) END;;
}
}
10 changes: 7 additions & 3 deletions views/bqml/purchase_propensity/incremental_prediction.view.lkml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include: "/views/*.view.lkml"
explore: pred_history {}
view: pred_history {
derived_table: {
sql_trigger_value:CASE WHEN @{BQML_PARAMETER}='Yes' AND ${future_purchase_model.SQL_TABLE_NAME} THEN TRUE ELSE FALSE END;;
explore_source: sessions {
column: pred_probability_bucket { field: future_purchase_prediction.pred_probability_bucket }
column: total_purchase_revenue_usd { field: events.total_purchase_revenue_usd }
Expand Down Expand Up @@ -56,21 +57,24 @@ explore: incremental_prediction {hidden:yes}
view: incremental_prediction {
derived_table: {
#datagroup_trigger: bqml_datagroup
sql_trigger_value: ${future_purchase_model.SQL_TABLE_NAME} ;;
sql_trigger_value:CASE WHEN @{BQML_PARAMETER}='Yes' AND ${pred_history.SQL_TABLE_NAME} THEN TRUE ELSE FALSE END;;
create_process: {
sql_step:
CREATE TABLE IF NOT EXISTS ${SQL_TABLE_NAME} (
pred_probability_bucket STRING,
total_purchase_revenue_usd FLOAT64,
count INT64,
week DATE
);;
)
;;
sql_step:

Insert into ${SQL_TABLE_NAME}
SELECT
pred_probability_bucket,total_purchase_revenue_usd,count, week
FROM ${pred_history.SQL_TABLE_NAME}
where week not in (select distinct week from ${SQL_TABLE_NAME});;
where week not in (select distinct week from ${SQL_TABLE_NAME})
;;
}
}
dimension: week {
Expand Down
Loading

0 comments on commit 0b73fa9

Please sign in to comment.