Exemple #1
0
    def __init__(self, input_nodes, hidden_layers_nodes, config={}):
        """
        Deep Auto Encoder Cox Class Constructor.
        Parameters
        ----------
        input_nodes: int
            The number of input nodes. It's also equal to the number of features.
        hidden_layers_nodes: list
            Number of nodes in hidden layers of neural network.
        config: dict
            Some configurations or hyper-parameters of neural network.
        """
        #super(DAECox, self).__init__()

        # neural nodes
        self.input_nodes = input_nodes
        self.hidden_layers_nodes = hidden_layers_nodes

        # network hyper-parameters
        _check_config(config)
        self.config = config

        # reset computational graph
        tf.compat.v1.reset_default_graph()
        # graph level random seed
        tf.compat.v1.set_random_seed(config["seed"])

        # some gobal settings
        self.global_step = tf.compat.v1.get_variable('global_step', initializer=tf.constant(0), trainable=False)
        self.keep_prob = tf.compat.v1.placeholder(tf.float32)

        # It's the best way to use `tf.placeholder` instead of `tf.data.Dataset`.
        # Since style of `batch` is not appropriate in survival analysis.
        self.X = tf.compat.v1.placeholder(tf.float32, [None, input_nodes], name='X-Input')
        self.Y = tf.compat.v1.placeholder(tf.float32, [None, 1], name='Y-Input')
Exemple #2
0
def disable_nfs3():
    prot = '4'
    if (config.nfs_srv != 'native'):
        prot = '3,4'

    #print (config.nfs_srv, prot)
    _check_config("/etc/ganesha/ganesha.conf", "NFS_Core_Param", " ",
                  '{NFS_Protocols = %s;}' % (prot), 1)
Exemple #3
0
    def __init_redisconf(self, path, hostname):
        src = os.path.join(self.config.home, "etc/redis.conf.tpl")
        dist = os.path.join(path, "redis.conf")
        cmd = "cp " + src + " " + dist
        os.system(cmd)

        cmd = "mkdir -p " + self.workdir + "/data"
        os.system(cmd)
        #cmd = "chmod a+w " + self.workdir + "/data"
        #os.system(cmd)
        _check_config(dist, "port", " ", self.port, True)
        _check_config(dist, "dir", " ", self.workdir + "/data", True)
        _check_config(dist, "pidfile", " ", self.workdir + "/run/redis-server.pid", True)
        _check_config(dist, "logfile", " ", self.workdir + "/redis.log", True)
        _check_config(dist, "bind", " ", hostname, True)
        return True
Exemple #4
0
    def __init__(self, hidden_layers_nodes, input_samples, input_nodes, config={}):
        """
        Deep Global Balancing Cox regression (DGBCox) Class Constructor.

        Parameters
        ----------
        hidden_layers_nodes: list
            Number of nodes in hidden layers of deep auto-encoder neural network.
        input_samples: int
            The number of input samples.
        input_nodes: int
            The number of input nodes (i.e. features/genes).
        config: dict
            Some configurations or hyper-parameters of DGBCox.
        """
        # super(DGBCox, self).__init__()

        # nodes
        self.input_nodes = input_nodes

        # samples
        self.input_samples = input_samples

        # neural nodes
        self.hidden_layers_nodes = hidden_layers_nodes

        # hyper-parameters
        _check_config(config)
        self.config = config

        # reset default computational graph before tf.Session()
        tf.compat.v1.reset_default_graph()
        # graph level random seed
        tf.compat.v1.set_random_seed(config["seed"])

        # some gobal settings
        self.global_step = tf.compat.v1.get_variable('global_step', initializer=tf.constant(0), trainable=False)
        self.keep_prob = self.config['dropout_keep_prob']

        # It's the best way to use `tf.placeholder` instead of `tf.data.Dataset`.
        # Since style of `batch` is not appropriate in survival analysis.
        self.X = tf.compat.v1.placeholder(tf.float32, [None, input_nodes], name='X-Input')
        self.Y = tf.compat.v1.placeholder(tf.float32, [None, 1], name='Y-Input')
Exemple #5
0
    def etcd_set_config(cls, init_cluster, state, proxy):
        config = Config()
        ip = socket.gethostbyname(config.hostname)

        os.system("echo  > /etc/etcd/etcd.conf")
        _check_config("/etc/etcd/etcd.conf", "ETCD_NAME", "=", '"' + "%s" % (config.hostname) + '"', True)
        _check_config("/etc/etcd/etcd.conf", "ETCD_DATA_DIR", "=", '"' + config.etcd_data_path + '"', True)
        _check_config("/etc/etcd/etcd.conf", "ETCD_ADVERTISE_CLIENT_URLS", "=", '"' + "http://%s:2379" % (config.hostname) + '"', True)
        _check_config("/etc/etcd/etcd.conf", "ETCD_LISTEN_CLIENT_URLS", "=", '"' + "http://%s:2379,http://127.0.0.1:2379" % (ip) + '"', True)
        _check_config("/etc/etcd/etcd.conf", "ETCD_INITIAL_CLUSTER", "=", '"' + "%s" % (init_cluster) + '"', True)
        if proxy:
            # set etcd conf as proxy mode
            _check_config("/etc/etcd/etcd.conf", "ETCD_PROXY", "=", '"' + "on" + '"', True)
        else:
            _check_config("/etc/etcd/etcd.conf", "ETCD_LISTEN_PEER_URLS", "=", '"' + "http://0.0.0.0:2380" + '"', True)
            _check_config("/etc/etcd/etcd.conf", "ETCD_INITIAL_CLUSTER_STATE", "=", '"' + "%s" % (state) + '"', True)
            _check_config("/etc/etcd/etcd.conf", "ETCD_INITIAL_ADVERTISE_PEER_URLS", "=", '"' + "http://%s:2380" % (config.hostname) + '"', True)
Exemple #6
0
    def add_raw_redis(self, idx, _uuid):
        workdir = os.path.join(self.workdir, "redis", _uuid)
        cmd = "mkdir -p " + workdir
        os.system(cmd)

        src = os.path.join(self.config.home, "etc/redis.conf.tpl")
        dist = os.path.join(workdir, "redis.conf")
        cmd = "cp " + src + " " + dist
        os.system(cmd)

        port = 16384 + idx
        _check_config(dist, "port", " ", port, True)
        _check_config(dist, "dir", " ", workdir, True)
        _check_config(dist, "pidfile", " ", workdir + "/redis-server.pid",
                      True)
        _check_config(dist, "logfile", " ", workdir + "/redis.log", True)
        _check_config(dist, "bind", " ", socket.gethostname(), True)
        _check_config(dist, "unixsocket", " ", workdir + "/redis.socket", True)
        _check_config(dist, "unixsocketperm", " ", "770", True)