本文整理汇总了Python中scipy.subtract函数的典型用法代码示例。如果您正苦于以下问题:Python subtract函数的具体用法?Python subtract怎么用?Python subtract使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了subtract函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: logloss
def logloss(self, y, pred):
epsilon = 1e-15
pred = sp.maximum(epsilon, pred)
pred = sp.minimum(1-epsilon, pred)
ll = sum(y*sp.log(pred) + sp.subtract(1,y)*sp.log(sp.subtract(1,pred)))
ll = ll * -1.0/len(y)
return ll
开发者ID:joshnewnham,项目名称:udacity_machine_learning_engineer_nanodegree_capstone,代码行数:7,代码来源:evaluator.py
示例2: llfun
def llfun(act, pred):
epsilon = 1e-15
pred = sp.maximum(epsilon, pred)
pred = sp.minimum(1 - epsilon, pred)
ll = sum(act * sp.log(pred) + sp.subtract(1, act) * sp.log(sp.subtract(1, pred)))
ll = ll * -1.0 / len(act)
return ll
开发者ID:trein,项目名称:criteo-challenge,代码行数:7,代码来源:training.py
示例3: logloss
def logloss(act, pred):
epsilon = 1e-4
pred = sp.maximum(epsilon, pred)
pred = sp.minimum(1-epsilon, pred)
ll = -1.0/len(act) * sum(act*sp.log(pred) +
sp.subtract(1,act)*sp.log(sp.subtract(1,pred)))
return ll
开发者ID:JakeMick,项目名称:kaggle,代码行数:7,代码来源:derp.py
示例4: logloss
def logloss(Y_true, Y_pred):
epsilon = 1e-15
pred = sp.maximum(epsilon, Y_pred)
pred = sp.minimum(1-epsilon, Y_pred)
ll = sum(Y_true*sp.log(pred) + sp.subtract(1,Y_true)*sp.log(sp.subtract(1,Y_pred)))
ll = ll * -1.0/len(Y_true)
return ll
开发者ID:amovschin,项目名称:NervousBreakDown,代码行数:7,代码来源:train_exist_mask.py
示例5: evaluate_ll
def evaluate_ll(y, yhat):
epsilon = 1e-15
yhat = sp.maximum(epsilon, yhat)
yhat = sp.minimum(1-epsilon, yhat)
ll = sum(y*sp.log(yhat) + sp.subtract(1,y)*sp.log(sp.subtract(1,yhat)))
ll = ll * -1.0/len(y)
return ll
开发者ID:fengqi0423,项目名称:hahaha,代码行数:7,代码来源:evaluate.py
示例6: entropyloss
def entropyloss(act, pred):
epsilon = 1e-15
pred = sp.maximum(epsilon, pred)
pred = sp.minimum(1-epsilon, pred)
el = sum(act*sp.log10(pred) + sp.subtract(1,act)*sp.log10(sp.subtract(1,pred)))
el = el * -1.0/len(act)
return el
开发者ID:DucQuang1,项目名称:dextra-mindef-2015,代码行数:7,代码来源:classify-xgb-native.py
示例7: binary_logloss
def binary_logloss(p, y):
epsilon = 1e-15
p = sp.maximum(epsilon, p)
p = sp.minimum(1-epsilon, p)
res = sum(y * sp.log(p) + sp.subtract(1, y) * sp.log(sp.subtract(1, p)))
res *= -1.0/len(y)
return res
开发者ID:Iflier,项目名称:keras,代码行数:7,代码来源:np_utils.py
示例8: logloss
def logloss(actual, predict):
epsilon = 1e-15
predict = sp.maximum(epsilon, predict)
predict = sp.minum(1 - epsilon, predict)
loss = sum(actual * sp.log(predict) + sp.subtract(1, actual) * sp.log(sp.subtract(1, predict)))
loss = loss * -1.0 / len(actual)
return loss
开发者ID:rain1024,项目名称:avito,代码行数:7,代码来源:evaluate.py
示例9: logloss
def logloss(p, y):
epsilon = 1e-15
p = sp.maximum(epsilon, p)
p = sp.minimum(1-epsilon, p)
ll = sum(y*sp.log(p) + sp.subtract(1,y)*sp.log(sp.subtract(1,p)))
ll = ll * -1.0/len(y)
return ll
开发者ID:AnthonySA,项目名称:Predict-click-through-rates-on-display-ads,代码行数:7,代码来源:py_lh_20Sep2014.py
示例10: llfun
def llfun(act, pred):
p_true = pred[:, 1]
epsilon = 1e-15
p_true = sp.maximum(epsilon, p_true)
p_true = sp.minimum(1 - epsilon, p_true)
ll = sum(act * sp.log(p_true) + sp.subtract(1, act) * sp.log(sp.subtract(1, p_true)))
ll = ll * -1.0 / len(act)
return ll
开发者ID:mkneierV,项目名称:kaggle_avazu_benchmark,代码行数:8,代码来源:ml.py
示例11: logloss
def logloss(self, act, pred):
epsilon = 1e-15
pred = sp.maximum(epsilon, pred)
pred = sp.minimum(1-epsilon, pred)
pred[pred >= 1] = 0.9999999
ll = sum(act*sp.log(pred) + sp.subtract(1,act)*sp.log(sp.subtract(1,pred)))
ll = ll * -1.0/len(act)
return ll
开发者ID:Kaisuke5,项目名称:kaggle_kobe_shoot,代码行数:8,代码来源:model2.py
示例12: logloss
def logloss(act, pred):
epsilon = 1e-6
pred = sp.maximum(epsilon, pred)
pred = sp.minimum(1-epsilon, pred)
#print np.mean(pred)
ll = sum(act*sp.log(pred) + sp.subtract(1,act)*sp.log(sp.subtract(1,pred)))
ll = ll * -1.0/len(act)
return ll
开发者ID:daxiongshu,项目名称:bnp,代码行数:8,代码来源:tensor1.py
示例13: log_loss
def log_loss(act, pred):
epsilon = 1e-15
pred = sp.maximum(epsilon, pred)
pred = sp.minimum(1 - epsilon, pred)
ll = sum(act * sp.log(pred.astype(float)) + sp.subtract(1, act.astype(float)) * sp.log(
sp.subtract(1, pred.astype(float))))
ll = ll * -1.0 / len(act)
return ll
开发者ID:kazarinov,项目名称:hccf,代码行数:8,代码来源:mathematics.py
示例14: logloss_1
def logloss_1(act, pred):
act = act.flatten()
pred = pred.flatten()
epsilon = 1e-15
pred = sp.maximum(epsilon, pred)
pred = sp.minimum(1-epsilon, pred)
ll = sum(act*sp.log(pred) + sp.subtract(1,act)*sp.log(sp.subtract(1,pred)))
ll = ll * -1.0/len(act)
return ll
开发者ID:henrywang1,项目名称:HappyCat,代码行数:9,代码来源:learning_kernel.py
示例15: logloss
def logloss(act,pred):
epsilon = 1e-15
pred = sp.maximum(epsilon,pred)
pred = sp.minimum(1-epsilon,pred)
#实际上我觉得这个式子就是机器学习课程中的cost Function
#sum(act*log(pred) + (1-a)*log(1-p))
ll = sum(act*sp.log(pred) + sp.subtract(1,act)*sp.log(sp.subtract(1,pred)))
ll = ll * -1.0/len(act)
return ll
开发者ID:yyn19951228,项目名称:MachineLearning,代码行数:9,代码来源:kobe.py
示例16: logloss
def logloss(obs, pred):
"""LogLoss function
https://www.kaggle.com/wiki/LogarithmicLoss
"""
epsilon = 1e-15
pred = sp.maximum(epsilon, pred)
pred = sp.minimum(1-epsilon, pred)
ll = sum(obs*sp.log(pred) + sp.subtract(1,obs)*sp.log(sp.subtract(1,pred)))
ll = ll * -1.0/len(obs)
return ll
开发者ID:KiprasKancys,项目名称:DMWMAnalytics,代码行数:10,代码来源:logloss.py
示例17: logloss
def logloss(self):
probs = self.predict_proba(self.x)
# Calculating the loss
epsilon = 1e-15
probs = sp.maximum(epsilon, probs)
probs = sp.minimum(1 - epsilon, probs)
ll = sum(self.y * sp.log(probs) + sp.subtract(1, self.y) * sp.log(sp.subtract(1, probs)))
ll = ll * -1.0 / len(self.y)
return ll[0]
开发者ID:yuvisu,项目名称:hugo-neuron,代码行数:10,代码来源:NeuralNetwork.py
示例18: log_loss_fun
def log_loss_fun(act, pred):
"""
:rtype : float
"""
epsilon = 1e-15
pred = sp.maximum(epsilon, pred)
pred = sp.minimum(1-epsilon, pred)
ll = sum(act*sp.log(pred) + sp.subtract(1,act)*sp.log(sp.subtract(1,pred)))
ll = ll * -1.0/len(act)
return ll
开发者ID:hyb148,项目名称:python_code,代码行数:11,代码来源:ML_Algs.py
示例19: llfun
def llfun(act, pred):
# import pdb;pdb.set_trace()
epsilon = 1e-15
pred = sp.maximum(epsilon, pred)
pred = sp.minimum(1-epsilon, pred)
ll = sum(act*sp.log(pred) + sp.subtract(1,act)*sp.log(sp.subtract(1,pred)))
# ll = sum(ll)
ll = ll * -1.0/len(act)
print ll
return ll
开发者ID:feng1008,项目名称:spark,代码行数:11,代码来源:lr_test.py
示例20: logloss
def logloss(act, pred):
"""
logloss function
imported from kaggle evalutation
"""
epsilon = 1e-15
pred = sp.maximum(epsilon, pred)
pred = sp.minimum(1-epsilon, pred)
ll = sum(act*sp.log(pred) + sp.subtract(1,act)*sp.log(sp.subtract(1,pred)))
ll = ll * -1.0/len(act)
return ll
开发者ID:joaopcoelho,项目名称:kobe-shots,代码行数:11,代码来源:functions.py
注:本文中的scipy.subtract函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论