One way to save a model to HDFS is as following:
// persist model to HDFS
sc.parallelize(Seq(model), 1).saveAsObjectFile("hdfs:///user/root/linReg.model")
Saved model can then be loaded as:
val linRegModel = sc.objectFile[LinearRegressionModel]("linReg.model").first()
For more details see (ref)
More Related Contents:
- Matrix Multiplication in Apache Spark [closed]
- Resolving dependency problems in Apache Spark
- Add JAR files to a Spark job – spark-submit
- Spark: How to map Python with Scala or Java User Defined Functions?
- Spark read file from S3 using sc.textFile (“s3n://…)
- Spark Strutured Streaming automatically converts timestamp to local time
- How can I update a broadcast variable in spark streaming?
- MatchError while accessing vector column in Spark 2.0
- Apache Spark – foreach Vs foreachPartition When to use What?
- What are the Spark transformations that causes a Shuffle?
- Spark spark-submit –jars arguments wants comma list, how to declare a directory of jars?
- Is gzip format supported in Spark?
- Change output filename prefix for DataFrame.write()
- How can I force Spark to execute code?
- Difference between SparkContext, JavaSparkContext, SQLContext, and SparkSession?
- How to vectorize DataFrame columns for ML algorithms?
- Spark ML VectorAssembler returns strange output
- Scala Iterable[(String, Long)] to SortedMap[String,Long] or TreeMap[String, Long] sorted in decreasing order of value [closed]
- How to flatten a struct in a Spark dataframe?
- How to handle categorical features with spark-ml?
- java.lang.ClassCastException using lambda expressions in spark job on remote server
- Is there an equivalent of Scala’s Either in Java 8?
- Logging while testing through Gradle
- Java 8 Stream, getting head and tail
- How do I resolve “WILL_NOT_PERFORM” MS AD reply when trying to change password in scala w/ the unboundid LDAP SDK?
- Using a Java library with Scala reserved words
- Addition of two RDD[mllib.linalg.Vector]’s
- Converting mysql table to spark dataset is very slow compared to same from csv file
- Which programming languages can be used to develop in Android? [duplicate]
- Why does SparkSession execute twice for one action?