Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Apache Spark 2: Data Processing and Real-Time Analytics

You're reading from   Apache Spark 2: Data Processing and Real-Time Analytics Master complex big data processing, stream analytics, and machine learning with Apache Spark

Arrow left icon
Product type Course
Published in Dec 2018
Publisher Packt
ISBN-13 9781789959208
Length 616 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Authors (7):
Arrow left icon
Sridhar Alla Sridhar Alla
Author Profile Icon Sridhar Alla
Sridhar Alla
Romeo Kienzler Romeo Kienzler
Author Profile Icon Romeo Kienzler
Romeo Kienzler
Siamak Amirghodsi Siamak Amirghodsi
Author Profile Icon Siamak Amirghodsi
Siamak Amirghodsi
Broderick Hall Broderick Hall
Author Profile Icon Broderick Hall
Broderick Hall
Md. Rezaul Karim Md. Rezaul Karim
Author Profile Icon Md. Rezaul Karim
Md. Rezaul Karim
Meenakshi Rajendran Meenakshi Rajendran
Author Profile Icon Meenakshi Rajendran
Meenakshi Rajendran
Shuen Mei Shuen Mei
Author Profile Icon Shuen Mei
Shuen Mei
+3 more Show less
Arrow right icon
View More author details
Toc

Table of Contents (23) Chapters Close

Title Page
Copyright
About Packt
Contributors
Preface
1. A First Taste and What's New in Apache Spark V2 FREE CHAPTER 2. Apache Spark Streaming 3. Structured Streaming 4. Apache Spark MLlib 5. Apache SparkML 6. Apache SystemML 7. Apache Spark GraphX 8. Spark Tuning 9. Testing and Debugging Spark 10. Practical Machine Learning with Spark Using Scala 11. Spark's Three Data Musketeers for Machine Learning - Perfect Together 12. Common Recipes for Implementing a Robust Machine Learning System 13. Recommendation Engine that Scales with Spark 14. Unsupervised Clustering with Apache Spark 2.0 15. Implementing Text Analytics with Spark 2.0 ML Library 16. Spark Streaming and Machine Learning Library 1. Other Books You May Enjoy Index

Streaming Datasets for real-time machine learning


In this recipe, we create a streaming Dataset to demonstrate the use of Datasets with a Spark 2.0 structured programming paradigm. We stream stock prices from a file using a Dataset and apply a filter to select the day's stock that closed above $100.

The recipe demonstrates how streams can be used to filter and to act on the incoming data using a simple structured streaming programming model. While it is similar to a DataFrame, there are some differences in the syntax. The recipe is written in a generalized manner so the user can customize it for their own Spark ML programming projects.

How to do it...

  1. Start a new project in IntelliJ or in an IDE of your choice. Make sure that the necessary JAR files are included.
  1. Set up the package location where the program will reside:
package spark.ml.cookbook.chapter13
  1. Import the necessary packages:
import java.util.concurrent.TimeUnit
import org.apache.log4j.{Level, Logger}
import org.apache.spark.sql.SparkSession...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime