本文整理汇总了Python中Utils.Utils.check_check_in_syntax方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.check_check_in_syntax方法的具体用法?Python Utils.check_check_in_syntax怎么用?Python Utils.check_check_in_syntax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils.Utils
的用法示例。
在下文中一共展示了Utils.check_check_in_syntax方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: aggregated_probability
# 需要导入模块: from Utils import Utils [as 别名]
# 或者: from Utils.Utils import check_check_in_syntax [as 别名]
def aggregated_probability(self, check_in):
"""
Calculates the probability for the check-in to belong to home or work cluster
considering all components of the model.
Returns a tuple of probabilities of belonging to cluster H or W.
check_in -- input check-in.
"""
Utils.check_check_in_syntax(check_in)
id = str(check_in["check_in_id"])
P_home_cumulative = self.P_temporal_H[id] * self.P_spatial_H[id]
P_work_cumulative = self.P_temporal_W[id] * self.P_spatial_W[id]
return P_home_cumulative, P_work_cumulative
示例2: calculate_covariation_matrix
# 需要导入模块: from Utils import Utils [as 别名]
# 或者: from Utils.Utils import check_check_in_syntax [as 别名]
def calculate_covariation_matrix(check_ins):
"""
Calculates covariation matrix for latitude and longitude.
Returns a covariation matrix.
check_ins -- list of check-ins, for which covariation is calculated.
"""
if not isinstance(check_ins, list):
raise ValueError("Error: a list should be supplied as an algorithm!")
for check_in in check_ins:
Utils.check_check_in_syntax(check_in)
Utils.check_userless_check_in_list(check_ins)
pairs = []
for check_in in check_ins:
pair = []
pair.append(check_in["latitude"])
pair.append(check_in["longitude"])
pairs.append(pair)
data_matrix = np.array(pairs).T
try:
result = np.cov(data_matrix)
except Exception as e:
print str(e)
print data_matrix
exit()
singular_values = np.linalg.svd(np.array(result))[1].tolist()
min_singular_value = singular_values[len(singular_values) - 1]
if min_singular_value < 10 ** (-7):
# print data_matrix
# print singular_values
raise TooSmallSingularValueError()
# print data_matrix
# print singular_values
# print result.tolist()
# print("--------")
return result.tolist()
示例3:
# 需要导入模块: from Utils import Utils [as 别名]
# 或者: from Utils.Utils import check_check_in_syntax [as 别名]
import datetime