Fits an Isotonic Regression model against a SparkDataFrame, similarly to R's isoreg(). Users can print, make predictions on the produced model and save the model to the input path.
Usagespark.isoreg(data, formula, ...)
# S4 method for class 'SparkDataFrame,formula'
spark.isoreg(
data,
formula,
isotonic = TRUE,
featureIndex = 0,
weightCol = NULL
)
# S4 method for class 'IsotonicRegressionModel'
summary(object)
# S4 method for class 'IsotonicRegressionModel'
predict(object, newData)
# S4 method for class 'IsotonicRegressionModel,character'
write.ml(object, path, overwrite = FALSE)
Arguments
SparkDataFrame for training.
A symbolic description of the model to be fitted. Currently only a few formula operators are supported, including '~', '.', ':', '+', and '-'.
additional arguments passed to the method.
Whether the output sequence should be isotonic/increasing (TRUE) or antitonic/decreasing (FALSE).
The index of the feature if featuresCol
is a vector column (default: 0), no effect otherwise.
The weight column name.
a fitted IsotonicRegressionModel.
SparkDataFrame for testing.
The directory where the model is saved.
Overwrites or not if the output path already exists. Default is FALSE which means throw exception if the output path exists.
spark.isoreg
returns a fitted Isotonic Regression model.
summary
returns summary information of the fitted model, which is a list. The list includes model's boundaries
(boundaries in increasing order) and predictions
(predictions associated with the boundaries at the same index).
predict
returns a SparkDataFrame containing predicted values.
spark.isoreg since 2.1.0
summary(IsotonicRegressionModel) since 2.1.0
predict(IsotonicRegressionModel) since 2.1.0
write.ml(IsotonicRegression, character) since 2.1.0
Examplesif (FALSE) { # \dontrun{
sparkR.session()
data <- list(list(7.0, 0.0), list(5.0, 1.0), list(3.0, 2.0),
list(5.0, 3.0), list(1.0, 4.0))
df <- createDataFrame(data, c("label", "feature"))
model <- spark.isoreg(df, label ~ feature, isotonic = FALSE)
# return model boundaries and prediction as lists
result <- summary(model, df)
# prediction based on fitted model
predict_data <- list(list(-2.0), list(-1.0), list(0.5),
list(0.75), list(1.0), list(2.0), list(9.0))
predict_df <- createDataFrame(predict_data, c("feature"))
# get prediction column
predict_result <- collect(select(predict(model, predict_df), "prediction"))
# save fitted model to input path
path <- "path/to/model"
write.ml(model, path)
# can also read back the saved model and print
savedModel <- read.ml(path)
summary(savedModel)
} # }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4