-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-18710][ML] Add offset in GLM #16699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 24 commits
3bf2718
0e240eb
9c41453
7823f8a
a1f5695
d071b95
d2afcb0
9eca1a6
d44974c
9c320ee
e183c08
58f93af
da4174a
52bc32b
59e10f7
1d41bdd
fb372ad
2bc3ae7
afb4643
fc64d32
90d68a6
e95c25b
4b336be
1e47a11
db0ac93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,3 +27,29 @@ import org.apache.spark.ml.linalg.Vector | |
| * @param features The vector of features for this data point. | ||
| */ | ||
| private[ml] case class Instance(label: Double, weight: Double, features: Vector) | ||
|
|
||
| /** | ||
| * Case class that represents an instance of data point with | ||
| * label, weight, offset and features. | ||
| * This is mainly used in GeneralizedLinearRegression currently. | ||
| * | ||
| * @param label Label for this data point. | ||
| * @param weight The weight of this instance. | ||
| * @param offset The offset used for this data point. | ||
| * @param features The vector of features for this data point. | ||
| */ | ||
| private[ml] case class OffsetInstance( | ||
| label: Double, | ||
| weight: Double, | ||
| offset: Double, | ||
| features: Vector) { | ||
|
|
||
| /** Constructs from an [[Instance]] object and offset */ | ||
| def this(instance: Instance, offset: Double = 0.0) = { | ||
|
||
| this(instance.label, instance.weight, offset, instance.features) | ||
| } | ||
|
|
||
| /** Converts to an [[Instance]] object by leaving out the offset. */ | ||
| private[ml] def toInstance: Instance = Instance(label, weight, features) | ||
|
||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add doc
This is mainly used in GeneralizedLinearRegression currently.