This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# Modelled after Python's functools.partial #} | |
{% macro make_partial(func) %} | |
{% set partial = dict(func=func, args=varargs, keywords=kwargs) %} | |
{% do return(partial) %} | |
{% endmacro %} | |
{% macro is_partial(partial) %} | |
{% do return(partial is mapping | |
and partial.func | |
and partial.args |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# Save these macros in your dbt project /macros folder: #} | |
{% macro enclose(fn, env) %} | |
{% set closure = namespace(fn=fn, env=env) %} | |
{% do return(closure) %} | |
{% endmacro %} | |
{% macro call1(closure, x1) %} | |
{% do return(closure.fn(x1, closure.env)) %} | |
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with t1 as ( | |
select | |
column1 as x, | |
column2 as y | |
from your_table | |
), | |
t as ( | |
select x, y | |
from t1 | |
where x is not null and y is not null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# PREDICTING LONG TERM CUSTOMER VALUE WITH BTYD PACKAGE | |
# Pareto/NBD (negative binomial distribution) modeling of | |
# repeat-buying behavior in a noncontractual setting | |
# | |
# Matthew Baggott, [email protected] | |
# | |
# Accompanying slides at: | |
# http://www.slideshare.net/mattbagg/baggott-predict-customerinrpart1# | |
# |