コード例 #1
0
 def __init__(self, seed=0,
              which_engine_binary=hs.default_engine_binary,
              hdfs_dir=hs.default_hdfs_dir,
              jobtracker_uri=hs.default_jobtracker_uri,
              hdfs_uri=hs.default_hdfs_uri,
              which_hadoop_jar=hs.default_hadoop_jar,
              which_hadoop_binary=hs.default_hadoop_binary,
              output_path=hs.default_output_path,
              input_filename=hs.default_input_filename,
              table_data_filename=hs.default_table_data_filename,
              command_dict_filename=hs.default_command_dict_filename,
              one_map_task_per_line=True,
              ):
     xu.assert_vpn_is_connected()
     #
     self.which_hadoop_binary = which_hadoop_binary
     #
     self.seed_generator = gu.int_generator(seed)
     self.which_engine_binary = which_engine_binary
     self.hdfs_dir = hdfs_dir
     self.jobtracker_uri = jobtracker_uri
     self.hdfs_uri = hdfs_uri
     self.which_hadoop_jar = which_hadoop_jar
     self.output_path = output_path
     self.input_filename = input_filename
     self.table_data_filename = table_data_filename
     self.one_map_task_per_line = one_map_task_per_line
     self.command_dict_filename = command_dict_filename
     return
コード例 #2
0
ファイル: server_jsonrpc.py プロジェクト: shafiahmed/crosscat
class ExampleServer(ServerEvents):

    get_next_seed = gu.int_generator(start=0)
    methods = set(gu.get_method_names(LE.LocalEngine))

    # inherited hooks
    def log(self, responses, txrequest, error):
        print(txrequest.code, end=' ')
        if isinstance(responses, list):
            for response in responses:
                msg = self._get_msg(response)
                print(txrequest, msg)
        else:
            msg = self._get_msg(responses)
            print(txrequest, msg)

    def findmethod(self, method, args=None, kwargs=None):
        if method in self.methods:
            next_seed = self.get_next_seed.next()
            engine = LE.LocalEngine(next_seed)
            return getattr(engine, method)
        else:
            return None

    # helper methods
    def _get_msg(self, response):
        ret_str = str(response)
        if hasattr(response, 'id'):
            ret_str = str(response.id)
            if response.result:
                ret_str += '; result: %s' % str(response.result)
            else:
                ret_str += '; error: %s' % str(response.error)
        return ret_str
コード例 #3
0
def create_test_set(M_c, T, X_L, X_D, n_test, seed_seed=0):
    sample_row_idx = len(T) + 1
    n_cols = len(T[0])
    Y = []
    Q = [(sample_row_idx, col_idx) for col_idx in range(n_cols)]
    int_generator = gu.int_generator(seed_seed)
    get_next_seed = lambda: int_generator.next()
    samples = su.simple_predictive_sample(M_c, X_L, X_D, Y, Q, get_next_seed, n=n_test)
    return samples
コード例 #4
0
def create_test_set(M_c, T, X_L, X_D, n_test, seed_seed=0):
    sample_row_idx = len(T) + 1
    n_cols = len(T[0])
    Y = []
    Q = [(sample_row_idx, col_idx) for col_idx in range(n_cols)]
    int_generator = gu.int_generator(seed_seed)
    get_next_seed = lambda: int_generator.next()
    samples = su.simple_predictive_sample(M_c, X_L, X_D, Y, Q, get_next_seed, n=n_test)
    return samples
コード例 #5
0
ファイル: EngineTemplate.py プロジェクト: manderle01/crosscat
 def __init__(self, seed=None):
     self.seed_generator = gu.int_generator(seed)
コード例 #6
0
ファイル: LocalEngine.py プロジェクト: joshnr13/crosscat
def make_get_next_seed(seed):
    generator = gu.int_generator(seed)
    return lambda: generator.next()