当前位置: 首页>>代码示例>>Python>>正文


Python MRJob.__init__方法代码示例

本文整理汇总了Python中mrjob.job.MRJob.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python MRJob.__init__方法的具体用法?Python MRJob.__init__怎么用?Python MRJob.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mrjob.job.MRJob的用法示例。


在下文中一共展示了MRJob.__init__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import __init__ [as 别名]
    def __init__(self, *args, **kwargs):
        MRJob.__init__(self, *args, **kwargs)

        ## load entities from json file
        log("loading entity list")
        entities = json.load(urllib.urlopen("https://s3.amazonaws.com/trec-kba-2012/entity-urlnames.json"))
        self.entity_representations = toy_kba_algorithm.prepare_entities(entities)
开发者ID:SHENbeyond,项目名称:kba-tools,代码行数:9,代码来源:toy_kba_mrjob.py

示例2: __init__

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import __init__ [as 别名]
    def __init__(self, args):
	 lines = [line1.strip() for line1 in sys.stdin]
	 temp_list=list()
	 for i in range(0,len(lines)-1):
	  temp_list.append(lines[i].replace('"', '\\"').strip('\n'))
	  temp_list.append(lines[i+1].replace('"', '\\"').strip('\n'))
	 args=temp_list
	 MRJob.__init__(self, args)
         yield self,args
开发者ID:srikarv,项目名称:Wikipedia,代码行数:11,代码来源:calculate_user_FD_MR.py

示例3: __init__

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import __init__ [as 别名]
    def __init__(self, *args, **kwargs):
        MRJob.__init__(self, *args, **kwargs)
        self.initial_counts = np.zeros(num_states)

        self.emission_probabilities = np.random.random((num_observations, num_states))
        self.emission_probabilities /= self.emission_probabilities.sum(1)[:,None]

        self.initial_probabilities = np.random.random(num_states)
        self.initial_probabilities /= self.initial_probabilities.sum()

        self.final_probabilities = np.random.random(num_states)
        self.final_probabilities /= self.final_probabilities.sum()

        self.transition_probabilities = np.random.random((num_states, num_states))
        self.transition_probabilities /= self.transition_probabilities.sum(1)[:,None]
开发者ID:capcarr,项目名称:lxmls-toolkit,代码行数:17,代码来源:parallel_em.py

示例4: __init__

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import __init__ [as 别名]
    def __init__(self, *args, **kwargs):
        MRJob.__init__(self, *args, **kwargs)

        from os import path
        filename = 'hmm.pkl'
        if path.exists(filename):
            self.hmm = pickle.loads(open(filename).read().decode('string-escape'))
        else:
            # Initialize the HMM parameters randomly.
            self.hmm = HMM(word_dict, tag_dict)
            self.hmm.initialize_random()

        self.log_likelihood = 0
        self.initial_counts = 0
        self.emission_counts = 0
        self.transition_counts = 0
        self.final_counts = 0
开发者ID:LxMLS,项目名称:lxmls-toolkit,代码行数:19,代码来源:emstep.py

示例5: __init__

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import __init__ [as 别名]
    def __init__(self, *args, **kwargs):
        MRJob.__init__(self, *args, **kwargs)

        # Create HMM object.
        self.hmm = HMM(word_dict, tag_dict)

        from os import path
        filename = 'hmm.txt'
        if path.exists(filename):
            # Load the HMM parameters from a text file.
            load_parameters(filename, self.hmm, smoothing=0.1)
        else:
            # Initialize the HMM parameters randomly.
            self.hmm.initialize_random()

        self.log_likelihood = 0
        self.initial_counts = 0
        self.emission_counts = 0
        self.transition_counts = 0
        self.final_counts = 0
开发者ID:Joao-M-Almeida,项目名称:lxmls-toolkit,代码行数:22,代码来源:emstep_split.py

示例6: __init__

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import __init__ [as 别名]
 def __init__(self, args):
    MRJob.__init__(self, args)  
开发者ID:mhb642,项目名称:Project-3,代码行数:4,代码来源:costDerivative.py

示例7: __init__

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     MRJob.__init__(self, *args, **kwargs)
     self.hmm = hmm
开发者ID:luispedro,项目名称:lxmls-toolkit,代码行数:5,代码来源:parallel_em.py


注:本文中的mrjob.job.MRJob.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。