Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
6d21ecef
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6d21ecef
编写于
10月 17, 2016
作者:
Z
Zrachel
提交者:
luotao1
10月 17, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add cost_type constraint to weighted_cost interface (#206)
上级
c13bdb15
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
5 addition
and
11 deletion
+5
-11
python/paddle/trainer/config_parser.py
python/paddle/trainer/config_parser.py
+0
-1
python/paddle/trainer_config_helpers/layers.py
python/paddle/trainer_config_helpers/layers.py
+5
-10
未找到文件。
python/paddle/trainer/config_parser.py
浏览文件 @
6d21ecef
...
...
@@ -1715,7 +1715,6 @@ def define_cost(class_name, cost_type):
g_cost_map
[
cost_type
]
=
cls
define_cost
(
'MultiClassCrossEntropy'
,
'multi-class-cross-entropy'
)
define_cost
(
'ClassificationErrorLayer'
,
'classification_error'
)
define_cost
(
'RankingCost'
,
'rank-cost'
)
define_cost
(
'AucValidation'
,
'auc-validation'
)
define_cost
(
'PnpairValidation'
,
'pnpair-validation'
)
...
...
python/paddle/trainer_config_helpers/layers.py
浏览文件 @
6d21ecef
...
...
@@ -2799,7 +2799,7 @@ def __cost_input__(input, label, weight=None):
@
wrap_name_default
()
def
regression_cost
(
input
,
label
,
weight
=
None
,
cost
=
'square_error'
,
name
=
None
):
def
regression_cost
(
input
,
label
,
weight
=
None
,
name
=
None
):
"""
Regression Layer.
...
...
@@ -2814,21 +2814,18 @@ def regression_cost(input, label, weight=None, cost='square_error', name=None):
:param weight: The weight affects the cost, namely the scale of cost.
It is an optional argument.
:type weight: LayerOutput
:param cost: Cost method.
:type cost: basestring
:return: LayerOutput object.
:rtype: LayerOutput
"""
ipts
,
parents
=
__cost_input__
(
input
,
label
,
weight
)
Layer
(
inputs
=
ipts
,
type
=
cost
,
name
=
name
)
Layer
(
inputs
=
ipts
,
type
=
"square_error"
,
name
=
name
)
return
LayerOutput
(
name
,
LayerType
.
COST
,
parents
=
parents
)
@
wrap_name_default
(
"cost"
)
@
layer_support
()
def
classification_cost
(
input
,
label
,
weight
=
None
,
name
=
None
,
cost
=
"multi-class-cross-entropy"
,
evaluator
=
classification_error_evaluator
,
layer_attr
=
None
):
"""
...
...
@@ -2843,8 +2840,6 @@ def classification_cost(input, label, weight=None, name=None,
:param weight: The weight affects the cost, namely the scale of cost.
It is an optional argument.
:type weight: LayerOutput
:param cost: cost method.
:type cost: basestring
:param evaluator: Evaluator method.
:param layer_attr: layer's extra attribute.
:type layer_attr: ExtraLayerAttribute
...
...
@@ -2857,7 +2852,7 @@ def classification_cost(input, label, weight=None, name=None,
ipts
,
parents
=
__cost_input__
(
input
,
label
,
weight
)
Layer
(
name
=
name
,
type
=
cost
,
inputs
=
ipts
,
Layer
(
name
=
name
,
type
=
"multi-class-cross-entropy"
,
inputs
=
ipts
,
**
ExtraLayerAttribute
.
to_kwargs
(
layer_attr
))
def
__add_evaluator__
(
e
):
...
...
@@ -3819,8 +3814,8 @@ def multi_binary_label_cross_entropy(input, label, name=None, coeff=1.0):
if
input
.
activation
is
None
or
\
not
isinstance
(
input
.
activation
,
SigmoidActivation
):
logger
.
log
(
logging
.
WARN
,
"%s is not recommend for
batch normalization
's activation, "
"maybe the
relu
is better"
%
repr
(
input
.
activation
))
"%s is not recommend for
multi_binary_label_cross_entropy
's activation, "
"maybe the
sigmoid
is better"
%
repr
(
input
.
activation
))
Layer
(
name
=
name
,
type
=
LayerType
.
MULTI_BIN_LABEL_CROSS_ENTROPY
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录