GithubHelp home page GithubHelp logo

joe5saia / double_debias Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 29 KB

Python implementation of Double/Debiased machine learning algorithm from Chernozhukov et. al ontop of sklearn. Builds and deploys to pip using github actions.

License: MIT License

Python 95.29% Shell 4.71%
predict-methods sklearn estimators

double_debias's Introduction

double_debias

Basic Build codecov

This package implements the double debiased estimator from "Double/Debiased Machine Learning for Treatment and Structural Parameters" by Chernozhukov et. al.

installation

pip install double_debias

Usage

This package estimates models of the form y = theta D + g(z) + e where z is a high dimensional object.

from sklearn.ensemble import GradientBoostingRegressor
from sklearn.linear_model import LinearRegression
from double_debias import DoubleDebias
dd = DoubleDebias(y=np.array([i for i in range(0,10)]),
                   D= np.array([i//2 for i in range(0,10)]),
                   p.array([[i**2 for i in range(0,10)], [i**3 for i in range(0,10)]]).transpose(),
                   y_method= GradientBoostingRegressor(n_estimators=1000),
                   D_method= LinearRegression(),
                   n_folds=3)
dd.est_theta()

The user initializes the estimator object with the data for y, D, and z along with the method for estimating y ~ g(z) + e and D ~ f(z) + e. The y_method and D_method can be any model from the sklearn library that implements the fit and predict methods. The user may also supply their own class that implements these methods. This class does no parameter tuning or cross validation. Parameter tuning is left up to the user.

Custom Estimator Methods

The user may supply their own estimators if these are not available in sklearn. This module assumes that the class passed has the fit and predict methods, i.e. the following code must work

z = np.array([[i**2 for i in range(0,10)], [i**3 for i in range(0,10)]]).transpose()
y = np.array([i for i in range(0,10)])
m = my_estimator()
m.fit(z, y)
m.predict(z)

double_debias's People

Contributors

joe5saia avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sahana-sivaraj

double_debias's Issues

Separate model from data

Ideally the double debias class would not store the data directly within it but instead act like the sklearn estimator classes which only store the estimates.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.