/Train data Secret
Last active
August 22, 2020 02:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lr = LinearRegression(labelCol='Yearly_Amount_Spent') | |
lr_model = lr.fit(train_data) | |
print("Coefficients: " + str(lr_model.coefficients)) | |
print("Intercept: " + str(lr_model.intercept)) | |
lr_model.write().overwrite().save("models/Ecommerce_Customer_001") | |
trainingSummary = lr_model.summary | |
print("numIterations: %d" % trainingSummary.totalIterations) | |
print("objectiveHistory: %s" % str(trainingSummary.objectiveHistory)) | |
trainingSummary.residuals.show() | |
print("RMSE: %f" % trainingSummary.rootMeanSquaredError) | |
print("r2: %f" % trainingSummary.r2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment