O'Reilly logo

Practical Predictive Analytics by Ralph Winters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Another OneR example

This example uses the much larger diabetes dataset. Since most of the variables in this dataset are numeric, OneR can bin all of them:

  1. First, read the Spark diabetes table using SQL, which has already been registered in a previous chapter.
  2. Collect a 15% random sample of the data and assign it to an R (not Spark!) dataframe named "local".
  3. Bin all of the available variables based upon their ability to predict the outcome and assign it to an R dataframe named "data":
        library(OneR)         df = sql("SELECT outcome, age, mass, triceps, pregnant,        glucose, pressure, insulin, pedigree         FROM global_temp.df_view")         local = collect(sample(df, F,.15))         data <- optbin(local,outcome~.)         summary(data) 
  1. Run the OneR model using all of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required