Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions python/pyspark/mllib/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ def load(cls, sc, path):
model = LinearRegressionModel(weights, intercept)
return model

@since("2.3.0")
def setIntercept(self, intercept):
self._intercept = intercept

# train_func should take two parameters, namely data and initial_weights, and
# return the result of a call to the appropriate JVM stub.
Expand Down Expand Up @@ -795,6 +798,11 @@ def __init__(self, stepSize=0.1, numIterations=50, miniBatchFraction=1.0, conver
super(StreamingLinearRegressionWithSGD, self).__init__(
model=self._model)

@since("2.3.0")
def setIntercept(self, intercept):
"""Set if the algorithm should add an intercept"""
self._model.setIntercept(intercept)

@since("1.5.0")
def setInitialWeights(self, initialWeights):
"""
Expand Down