Skip to content

[ML] Add loss_function to regression#56118

Merged
dimitris-athanasiou merged 4 commits intoelastic:masterfrom
dimitris-athanasiou:add-loss-function-to-regression
May 5, 2020
Merged

[ML] Add loss_function to regression#56118
dimitris-athanasiou merged 4 commits intoelastic:masterfrom
dimitris-athanasiou:add-loss-function-to-regression

Conversation

@dimitris-athanasiou
Copy link
Copy Markdown
Contributor

Adds parameters loss_function and loss_function_parameter
to regression.

Adds parameters `loss_function` and `loss_function_parameter`
to regression.
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/ml-core (:ml)

@benwtrent benwtrent self-requested a review May 4, 2020 17:55
Copy link
Copy Markdown
Member

@benwtrent benwtrent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an overall design question.

To my knowledge, only the huber function will actually use the lossFunctionParameter. It almost seems to me that this could be a named object.

If we don't want the complexity a named object requires, what do you think of adding validations? We shouldn't allow the lossFunctionParameter unless it is being used.

@dimitris-athanasiou
Copy link
Copy Markdown
Contributor Author

msle also uses the parameter. I also had the same concern and I discussed it with @valeriy42. Valeriy is confident we won't be introducing new loss functions in which case it probably makes sense to keep this simple and simply ignore the parameter for mse.

@valeriy42
Copy link
Copy Markdown
Contributor

@benwtrent you are right, in a canonical form MSLE does not require a parameter, however, @tveasey had a useful insight that log(a+1) in the MSLE formulation actually defines the "area of interest" for the loss function. We are going to change it to log(a+t) to be able to "focus" the loss function where we need it.


`loss_function`::::
(Optional, string)
The loss function used during regression. Available options are `mse` (Mean Squared Error),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this requires capitalization

Suggested change
The loss function used during regression. Available options are `mse` (Mean Squared Error),
The loss function used during regression. Available options are `mse` (mean squared error),

`loss_function`::::
(Optional, string)
The loss function used during regression. Available options are `mse` (Mean Squared Error),
`msle` (Mean Squared Logarithmic Error), `huber` (Pseudo-Huber loss). Defaults to `mse`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto re mean squared logarithmic, whereas huber seems to be a person's name and can be capitalized

Suggested change
`msle` (Mean Squared Logarithmic Error), `huber` (Pseudo-Huber loss). Defaults to `mse`.
`msle` (mean squared logarithmic error), `huber` (Pseudo-Huber loss). Defaults to `mse`.


`loss_function_parameter`::::
(Optional, double)
A strictly positive number that is used as a parameter to the `loss_function`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A strictly positive number ...

Why is "strictly" required here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point! I'll remove it.

@dimitris-athanasiou
Copy link
Copy Markdown
Contributor Author

@elasticmachine update branch

@dimitris-athanasiou dimitris-athanasiou merged commit 6bf3834 into elastic:master May 5, 2020
@dimitris-athanasiou dimitris-athanasiou deleted the add-loss-function-to-regression branch May 5, 2020 09:36
dimitris-athanasiou added a commit to dimitris-athanasiou/elasticsearch that referenced this pull request May 5, 2020
dimitris-athanasiou added a commit that referenced this pull request May 5, 2020
dimitris-athanasiou added a commit to dimitris-athanasiou/elasticsearch that referenced this pull request May 5, 2020
Adds parameters `loss_function` and `loss_function_parameter`
to regression.

Backport of elastic#56118
dimitris-athanasiou added a commit that referenced this pull request May 5, 2020
Adds parameters `loss_function` and `loss_function_parameter`
to regression.

Backport of #56118
dimitris-athanasiou added a commit to dimitris-athanasiou/elasticsearch that referenced this pull request May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants