Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
3ca9faa3
Commit
3ca9faa3
authored
11 years ago
by
Shivaram Venkataraman
Browse files
Options
Downloads
Patches
Plain Diff
Clarify how regVal is computed in Updater docs
parent
07da72b4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mllib/src/main/scala/spark/mllib/optimization/Updater.scala
+9
-8
9 additions, 8 deletions
mllib/src/main/scala/spark/mllib/optimization/Updater.scala
with
9 additions
and
8 deletions
mllib/src/main/scala/spark/mllib/optimization/Updater.scala
+
9
−
8
View file @
3ca9faa3
...
...
@@ -23,6 +23,7 @@ import org.jblas.DoubleMatrix
abstract
class
Updater
extends
Serializable
{
/**
* Compute an updated value for weights given the gradient, stepSize and iteration number.
* Also returns the regularization value computed using the *updated* weights.
*
* @param weightsOlds - Column matrix of size nx1 where n is the number of features.
* @param gradient - Column matrix of size nx1 where n is the number of features.
...
...
@@ -31,7 +32,7 @@ abstract class Updater extends Serializable {
* @param regParam - Regularization parameter
*
* @return A tuple of 2 elements. The first element is a column matrix containing updated weights,
* and the second element is the regularization value.
* and the second element is the regularization value
computed using updated weights
.
*/
def
compute
(
weightsOld
:
DoubleMatrix
,
gradient
:
DoubleMatrix
,
stepSize
:
Double
,
iter
:
Int
,
regParam
:
Double
)
:
(
DoubleMatrix
,
Double
)
...
...
@@ -46,13 +47,13 @@ class SimpleUpdater extends Updater {
}
/**
* L1 regularization -- corresponding proximal operator is the soft-thresholding function
* That is, each weight component is shrunk towards 0 by shrinkageVal
* If w > shrinkageVal, set weight component to w-shrinkageVal.
* If w < -shrinkageVal, set weight component to w+shrinkageVal.
* If -shrinkageVal < w < shrinkageVal, set weight component to 0.
* Equivalently, set weight component to signum(w) * max(0.0, abs(w) - shrinkageVal)
*
*/
* L1 regularization -- corresponding proximal operator is the soft-thresholding function
* That is, each weight component is shrunk towards 0 by shrinkageVal
* If w > shrinkageVal, set weight component to w-shrinkageVal.
* If w < -shrinkageVal, set weight component to w+shrinkageVal.
* If -shrinkageVal < w < shrinkageVal, set weight component to 0.
* Equivalently, set weight component to signum(w) * max(0.0, abs(w) - shrinkageVal)
*/
class
L1Updater
extends
Updater
{
override
def
compute
(
weightsOld
:
DoubleMatrix
,
gradient
:
DoubleMatrix
,
stepSize
:
Double
,
iter
:
Int
,
regParam
:
Double
)
:
(
DoubleMatrix
,
Double
)
=
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment