Commit 4a75f140 authored by Tsukasa OMOTO's avatar Tsukasa OMOTO Committed by Guolin Ke
Browse files

Add alias for l1 and l2 metric like objective functions (#181)

parent 7f4610a8
......@@ -188,8 +188,8 @@ The parameter format is ```key1=value1 key2=value2 ... ``` . And parameters can
## Metric parameters
* ```metric```, default={```l2``` for regression}, {```binary_logloss``` for binary classification},{```ndcg``` for lambdarank}, type=multi-enum, options=```l1```,```l2```,```ndcg```,```auc```,```binary_logloss```,```binary_error```
* ```l1```, absolute loss
* ```l2```, square loss
* ```l1```, absolute loss, alias=```mean_absolute_error```, ```mae```
* ```l2```, square loss, alias=```mean_squared_error```, ```mse```
* ```huber```, [Huber loss](https://en.wikipedia.org/wiki/Huber_loss "Huber loss - Wikipedia")
* ```fair```, [Fair loss](http://research.microsoft.com/en-us/um/people/zhang/INRIA/Publis/Tutorial-Estim/node24.html)
* ```ndcg```, [NDCG](https://en.wikipedia.org/wiki/Discounted_cumulative_gain#Normalized_DCG)
......
......@@ -7,9 +7,9 @@
namespace LightGBM {
Metric* Metric::CreateMetric(const std::string& type, const MetricConfig& config) {
if (type == std::string("l2")) {
if (type == std::string("l2") || type == std::string("mean_squared_error") || type == std::string("mse")) {
return new L2Metric(config);
} else if (type == std::string("l1")) {
} else if (type == std::string("l1") || type == std::string("mean_absolute_error") || type == std::string("mae")) {
return new L1Metric(config);
} else if (type == std::string("huber")) {
return new HuberLossMetric(config);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment