本文整理汇总了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)
示例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
示例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]
示例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
示例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
示例6: __init__
# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import __init__ [as 别名]
def __init__(self, args):
MRJob.__init__(self, args)
示例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