diff --git a/docs/changelog.rst b/docs/changelog.rst index 56ab18d..6374987 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,6 +5,11 @@ Change Log ========== +Version 0.5.1 +------------- +- Removed working test file + + Version 0.5.0 ------------- - Added new `predict`, `predict_interval`, and `predict_log_odds` methods to GPS tool diff --git a/docs/conf.py b/docs/conf.py index 63d5088..67166b3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,7 +22,7 @@ author = 'Roni Kobrosly' # The full version, including alpha/beta/rc tags -release = '0.5.0' +release = '0.5.1' # -- General configuration --------------------------------------------------- diff --git a/setup.py b/setup.py index 695f5e6..9dc9837 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="causal-curve", - version="0.5.0", + version="0.5.1", author="Roni Kobrosly", author_email="roni.kobrosly@gmail.com", description="A python library with tools to perform causal inference using \ diff --git a/working_test.py b/working_test.py deleted file mode 100644 index c57e0dd..0000000 --- a/working_test.py +++ /dev/null @@ -1,99 +0,0 @@ -from causal_curve.gps import GPS -import numpy as np -import pandas as pd -from scipy.stats import expon -from scipy.special import logit - - -np.random.seed(333) -n = 5000 -x_1 = expon.rvs(size=n, scale = 1) -x_2 = expon.rvs(size=n, scale = 1) -treatment = expon.rvs(size=n, scale = (1/(x_1 + x_2))) - -gps = ((x_1 + x_2) * np.exp(-(x_1 + x_2) * treatment)) -outcome = treatment + gps + np.random.normal(size = n, scale = 1) - -truth_func = lambda treatment: (treatment + (2/(1 + treatment)**3)) -vfunc = np.vectorize(truth_func) -true_outcome = vfunc(treatment) - -df = pd.DataFrame( - { - 'X_1': x_1, - 'X_2': x_2, - 'Treatment': treatment, - 'GPS': gps, - 'Outcome': outcome, - 'True_outcome': true_outcome - } -).sort_values('Treatment', ascending = True) - - -gps = GPS() -gps.fit(T = df['Treatment'], X = df[['X_1', 'X_2']], y = df['Outcome']) -gps_results = gps.calculate_CDRC(0.95) - - - -gps.predict(np.array([4.1, 4.3, 4.7])) -gps.predict_interval(np.array([4.1, 4.3, 4.7])) - -gps.predict(np.array([5])) -gps.predict_interval(np.array([5])) - - - - - - - - -####### EXPERIMENTING WITH PREDICTING GIVEN NEW COVARIATE AND TREATMENT DATA - -### Using the `predict` method will work like this -temp_treatment_value = 4 -temp_gps_value = gps.gps_function(temp_treatment_value).mean() -gps.gam_results.predict(np.array([temp_treatment_value, temp_gps_value]).reshape(1,-1)) - - - - - -# Using the `predict_interval` method will work like this - -gps.gam_results.prediction_intervals(np.array([temp_treatment_value, temp_gps_value]).reshape(1,-1), width = 0.95) - - - - - -########################################################## -########################################################## - - -from causal_curve.gps import GPS -import numpy as np -import pandas as pd -from scipy.stats import expon - - -df = pd.read_csv("~/Desktop/advertising.csv") - - -gps = GPS() -gps.fit(T = df['treatment'], X = df[['age', 'income']], y = df['outcome']) -gps_results = gps.calculate_CDRC(0.95) - - - -gps.predict_log_odds(np.array([65])) - - - -# Using the `predict_log_odds` method - -temp_treatment_value = 65 -temp_gps_value = gps.gps_function(temp_treatment_value).mean() - -logit(gps.gam_results.predict_proba(np.array([temp_treatment_value, temp_gps_value]).reshape(1,-1)))