Add a global independent variable to this model, such as time.

        :param variable: an IndependentVariable instance
        :return: none
164153
def add_independent_variable(self, variable):
        

        assert isinstance(variable, IndependentVariable), "Variable must be an instance of IndependentVariable"

        if self._has_child(variable.name):

            self._remove_child(variable.name)

        self._add_child(variable)

        # Add also to the list of independent variables
        self._independent_variables[variable.name] = variable
972424
def register_feature(self, var):
        
        if var in self._features or var in self.STATIC_FEATURES:
            raise ValueError("feature already claimed: {!r}".format(var))
        self._features.add(var)
        self.on_info_changed()
888006
def _create_variables(self, n_features, W_=None, bh_=None, bv_=None):
        
        if W_:
            self.W_ = tf.Variable(W_, name='enc-w')
        else:
            self.W_ = tf.Variable(
                tf.truncated_normal(
                    shape=[n_features, self.n_components], stddev=0.1),
                name='enc-w')

        if bh_:
            self.bh_ = tf.Variable(bh_, name='hidden-bias')
        else:
            self.bh_ = tf.Variable(tf.constant(
                0.1, shape=[self.n_components]), name='hidden-bias')

        if bv_:
            self.bv_ = tf.Variable(bv_, name='visible-bias')
        else:
            self.bv_ = tf.Variable(tf.constant(
                0.1, shape=[n_features]), name='visible-bias')
765936
def AddEnvironmentVariable(self, environment_variable):
    
    name = environment_variable.name.upper()
    if name in self._environment_variables:
      raise KeyError('Environment variable: {0:s} already exists.'.format(
          environment_variable.name))

    self._environment_variables[name] = environment_variable
663955
def _create_latent_variables(self):
        

        # TODO: There must be a cleaner way to do this below

        # Create VAR latent variables
        for variable in range(self.ylen):
            self.latent_variables.add_z(self.data_name[variable] + ' Constant', fam.Normal(0,3,transform=None), fam.Normal(0,3))
            other_variables = np.delete(range(self.ylen), [variable])
            for lag_no in range(self.lags):
                self.latent_variables.add_z(str(self.data_name[variable]) + ' AR(' + str(lag_no+1) + ')', fam.Normal(0,0.5,transform=None), fam.Normal(0,3))
                for other in other_variables:
                    self.latent_variables.add_z(str(self.data_name[other]) + ' to ' + str(self.data_name[variable]) + ' AR(' + str(lag_no+1) + ')', fam.Normal(0,0.5,transform=None), fam.Normal(0,3))

        starting_params_temp = self._create_B_direct().flatten()

        # Variance latent variables
        for i in range(self.ylen):
            for k in range(self.ylen):
                if i == k:
                    self.latent_variables.add_z('Cholesky Diagonal ' + str(i), fam.Flat(transform='exp'), fam.Normal(0,3))
                elif i > k:
                    self.latent_variables.add_z('Cholesky Off-Diagonal (' + str(i) + ',' + str(k) + ')', fam.Flat(transform=None), fam.Normal(0,3))

        for i in range(0,self.ylen):
            for k in range(0,self.ylen):
                if i == k:
                    starting_params_temp = np.append(starting_params_temp,np.array([0.5]))
                elif i > k:
                    starting_params_temp = np.append(starting_params_temp,np.array([0.0]))

        self.latent_variables.set_z_starting_values(starting_params_temp)
547471
def addi(self, begin, end, data=None):
        
        return self.add(Interval(begin, end, data))
487229
def add(self, directory, path=None) -> None:
        """"""
        objecttools.valid_variable_identifier(directory)
        if path is None:
            path = directory
        setattr(self, directory, path)
40550
def __add_variables(self, *args, **kwargs):
        

        for variable in args:
            self.__variables[variable] = None
        self.__variables.update(kwargs)
994567
def set(self, variables: Dict[str, str]):
        
        current_variables = self.get()
        difference = DictDiffer(variables, current_variables)

        removed_keys = difference.removed()
        self.remove(removed_keys)

        changed_keys = difference.added() | difference.changed()
        changed = {key: variables[key] for key in changed_keys}
        self.add(changed, overwrite=True)
572804
def p_global_var(p):
    ''''''
    if len(p) == 2:
        p[0] = ast.Variable(p[1], lineno=p.lineno(1))
    elif len(p) == 3:
        p[0] = ast.Variable(p[2], lineno=p.lineno(1))
    else:
        p[0] = ast.Variable(p[3], lineno=p.lineno(1))
1347054
def create_variable_is_list(self):
        
        variable_name = '{}_is_list'.format(self._variable)
        if variable_name in self._variables:
            return
        self._variables.add(variable_name)
        self.l('{variable}_is_list = isinstance({variable}, list)')
8982
def link(self, var):
        
        assert self._dtype is not None or hasattr(var, 'dtype')
        self._link = var
        self.changed()
907149
def add_constraint(self, func, variables, default_values=None):
        
        self._constraints.append((func, variables, default_values or ()))
148044
def replace_variable(self, variable):
        """"""
        if variable == 'x':
            return self.value
        if variable == 't':
            return self.timedelta
        raise ValueError("Invalid variable %s", variable)
998385
def addToTimeInv(self,*params):
        '''
        
        '''
        for param in params:
            if param not in self.time_inv:
                self.time_inv.append(param)
618135
def add_input_variable(self, var):
        """"""
        assert(isinstance(var, Variable))
        self.input_variable_list.append(var)
192736
def delete_variable(self, key):
        
        key = str(key)
        if self.is_locked(key):
            raise RuntimeError("Global variable is locked")

        with self.__global_lock:
            if key in self.__global_variable_dictionary:
                access_key = self.lock_variable(key, block=True)
                del self.__global_variable_dictionary[key]
                self.unlock_variable(key, access_key)
                del self.__variable_locks[key]
                del self.__variable_references[key]
            else:
                raise AttributeError("Global variable %s does not exist!" % str(key))

        logger.debug("Global variable %s was deleted!" % str(key))