econml/selective_regularization.py
def tf_graph_init(self, num_outcomes, num_reg_features, num_ureg_features):
        """
        Create the graph that corresponds to the squared loss with an L1/L2 penalties.

        The penalties apply only on the subset of features specified by the self._subset variable.
        Also creates the optimizer that minimizes this loss and a persistent tensorflow
        session for the class.
        """
        self.Y = tf.placeholder("float", [None, num_outcomes], name="outcome")
        self.X_reg = tf.placeholder("float", [None, num_reg_features], name="reg_features")
        self.X_ureg = tf.placeholder("float", [None, num_ureg_features], name="ureg_features")

        self.weights_reg = tf.Variable(tf.random_normal(
            [num_reg_features, num_outcomes], 0, 0.1), name="weights_reg")
        self.weights_ureg = tf.Variable(tf.random_normal(
            [num_ureg_features, num_outcomes], 0, 0.1), name="weights_ureg")
        self.bias = tf.Variable(tf.random_normal(
            [num_outcomes], 0, 0.1), name="biases")
        self.Y_pred = tf.add(tf.add(tf.matmul(self.X_reg, self.weights_reg),
                                    tf.matmul(self.X_ureg, self.weights_ureg)), self.bias)

        regularization = tf.contrib.layers.apply_regularization(
            tf.contrib.layers.l1_l2_regularizer(
                scale_l1=self._alpha_l1, scale_l2=self._alpha_l2), [self.weights_reg])
        self.cost = tf.reduce_mean(tf.pow(self.Y - self.Y_pred, 2)) + regularization

        self.optimizer = tf.train.AdagradOptimizer(learning_rate=self._learning_rate)
        self.train = self.optimizer.minimize(self.cost)

        self.session = tf.Session()

        Create the graph that corresponds to the squared loss with an L1/L2 penalties.

        The penalties apply only on the subset of features specified by the self._subset variable.
        Also creates the optimizer that minimizes this loss and a persistent tensorflow
        session for the class.
        
Create the graph that corresponds to the squared loss with an L1/L2 penalties.
The penalties apply only on the subset of features specified by the self._subset variable.
Also creates the optimizer that minimizes this loss and a persistent tensorflow
session for the class.
Create the graph that corresponds to the squared loss with an L1 / L2 penalties . The penalties apply only on the subset of features specified by the self . _subset variable . Also creates the optimizer that minimizes this loss and a persistent tensorflow session for the class .
def tf_graph_init(self, num_outcomes, num_reg_features, num_ureg_features):
        self.Y = tf.placeholder("float", [None, num_outcomes], name="outcome")
        self.X_reg = tf.placeholder("float", [None, num_reg_features], name="reg_features")
        self.X_ureg = tf.placeholder("float", [None, num_ureg_features], name="ureg_features")
        self.weights_reg = tf.Variable(tf.random_normal(
            [num_reg_features, num_outcomes], 0, 0.1), name="weights_reg")
        self.weights_ureg = tf.Variable(tf.random_normal(
            [num_ureg_features, num_outcomes], 0, 0.1), name="weights_ureg")
        self.bias = tf.Variable(tf.random_normal(
            [num_outcomes], 0, 0.1), name="biases")
        self.Y_pred = tf.add(tf.add(tf.matmul(self.X_reg, self.weights_reg),
                                    tf.matmul(self.X_ureg, self.weights_ureg)), self.bias)
        regularization = tf.contrib.layers.apply_regularization(
            tf.contrib.layers.l1_l2_regularizer(
                scale_l1=self._alpha_l1, scale_l2=self._alpha_l2), [self.weights_reg])
        self.cost = tf.reduce_mean(tf.pow(self.Y - self.Y_pred, 2)) + regularization
        self.optimizer = tf.train.AdagradOptimizer(learning_rate=self._learning_rate)
        self.train = self.optimizer.minimize(self.cost)
        self.session = tf.Session()
def tf_graph_init ( self , num_outcomes , num_reg_features , num_ureg_features ) : self . Y = tf . placeholder ( "float" , [ None , num_outcomes ] , name = "outcome" ) self . X_reg = tf . placeholder ( "float" , [ None , num_reg_features ] , name = "reg_features" ) self . X_ureg = tf . placeholder ( "float" , [ None , num_ureg_features ] , name = "ureg_features" ) self . weights_reg = tf . Variable ( tf . random_normal ( [ num_reg_features , num_outcomes ] , 0 , 0.1 ) , name = "weights_reg" ) self . weights_ureg = tf . Variable ( tf . random_normal ( [ num_ureg_features , num_outcomes ] , 0 , 0.1 ) , name = "weights_ureg" ) self . bias = tf . Variable ( tf . random_normal ( [ num_outcomes ] , 0 , 0.1 ) , name = "biases" ) self . Y_pred = tf . add ( tf . add ( tf . matmul ( self . X_reg , self . weights_reg ) , tf . matmul ( self . X_ureg , self . weights_ureg ) ) , self . bias ) regularization = tf . contrib . layers . apply_regularization ( tf . contrib . layers . l1_l2_regularizer ( scale_l1 = self . _alpha_l1 , scale_l2 = self . _alpha_l2 ) , [ self . weights_reg ] ) self . cost = tf . reduce_mean ( tf . pow ( self . Y - self . Y_pred , 2 ) ) + regularization self . optimizer = tf . train . AdagradOptimizer ( learning_rate = self . _learning_rate ) self . train = self . optimizer . minimize ( self . cost ) self . session = tf . Session ( )
Create the graph that corresponds to the squared loss with an L1/L2 penalties.
Create the graph that corresponds to the squared loss with an L1 / L2 penalties .
"""
        Create the graph that corresponds to the squared loss with an L1/L2 penalties.

        The penalties apply only on the subset of features specified by the self._subset variable.
        Also creates the optimizer that minimizes this loss and a persistent tensorflow
        session for the class.
        """
self
num_outcomes
num_reg_features
num_ureg_features