It sounds like you are asking about logistic regression, not linear
regression. If so, yes that's just what it does. The default would be
0.5 in logistic regression. If you 'clear' the threshold you get the
raw margin out of this and other linear classifiers.

On Fri, Oct 31, 2014 at 7:18 PM, Sameer Tilak <ssti...@live.com> wrote:
> Hi All,
>
> I am using LinearRegression and have a question about the details on
> model.predict method. Basically it is predicting variable y given an input
> vector x. However, can someone point me to the documentation about what is
> the threshold used in the predict method? Can that be changed ? I am
> assuming that i/p vector essentially gets mapped to a number and is compared
> against a threshold value and then y is either set to 0 or 1 based on those
> two numbers.
>
> Another question I have is if I want to save the model to hdfs for later
> reuse is there a recommended way for doing that?
>
> // Building the model
> val numIterations = 100
> val model = LinearRegressionWithSGD.train(parsedData, numIterations)
>
> // Evaluate model on training examples and compute training error
> val valuesAndPreds = parsedData.map { point =>
>   val prediction = model.predict(point.features)
>   (point.label, prediction)
> }

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org

Reply via email to