I am creating a linear regression model in pyspark. but each time it give different intercept and weights . How to make constant ? I have used random.seed() but it is not working ? Anyone have any idea how to make constant intercept and weights in pyspark? Please give syntax or way how to handle this ? I am using spark 1.4.2 and python 2.7 version.
from pyspark.ml.regression import LinearRegression
from pyspark.sql.types import *
seed = 42
train_df, test_df = miles_new_df.randomSplit( [0.7, 0.3], seed = seed )
linreg = LinearRegression(maxIter=500,regParam=0.0) #modelparameters
lm = linreg.fit( train_df ) #fitting
lm.intercept
lm.weights