Introduction to Apache Spark, SparkQL, and Spark MLib.
Tags: database, bigdata
Published: 2022-01-15 07:08:15

<!-- wp:paragraph -->
<p>In this blog, i focus on Apache Spark , features and limitations of Apache Spark , architecture of Apache Spark,  architecture of SparkQL, and architecture of Spark MLib .  Let's start by understanding what is Apache Spark,</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"textAlign":"center","level":3} -->
<h3 class="has-text-align-center" id="q-what-is-apache-spark"><strong>Q.What is Apache Spark?</strong></h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Apache Spark is a unified computing engine and a set of libraries for parallel data processing on computer clusters.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p id="why-spark"><strong>Why  Apache Spark?</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Fast Processing: Spark contains Resilient Distributed datasets (RDD) which saves time taken in reading and writing opertions and hence, hence it runs almost ten to hundred times faster than hadoop.</li><li>In-memory computing: In spark, data is stored in the RAM, so it can access the data quickly and accelerate the speed of analytics.</li><li>Flexible: Spark supports multiple languages and allows the developers to write applications in Java, Scala, R or Python.</li><li>Fault tolerance: Spark contains Resillent Distributed Datasets(RDD) that are designed to handle the failure of any worker node in the cluster. THus, it ensures that the loss of data reduces to zero.</li><li>Better analytics: Spark has a rich set of SQL queries, machine learning algorithms, complex analytics. With all these functionalities can be performed better.</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>Shortcoming of MapReduce:</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Forces your data processing into Map and Reduce<ul><li>Other workflows missing include join, filter, flatMap, groupByKey, union, intersection, …</li></ul></li><li>Based on “Acyclic Data Flow” from Disk to Disk (HDFS)</li><li>Read and write to Disk before and after Map and Reduce (stateless machine)<ul><li>Not efficient for iterative tasks, i.e. Machine Learning</li></ul></li><li>Only Java natively supported</li><li>Only for Batch processing<ul><li>Interactivity, streaming data</li></ul></li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>How to does Apache spark solve these shortcomings?</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Capable of leveraging the Hadoop ecosystem, e.g. HDFS, YARN, HBase, S3, …</li><li>Has many other workflows, i.e. join, filter, flatMapdistinct, groupByKey, reduceByKey, sortByKey, collect, count, first…</li><li>In-memory caching of data (for iterative, graph, and machine learning algorithms, etc.)</li><li>Native Scala, Java, Python, and R support</li><li>Supports interactive shells for exploratory data analysis</li><li>Spark API is extremely simple to use</li></ol>
<!-- /wp:list -->

<!-- wp:image {"align":"center","width":832,"height":550,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img src="https://cdn.ttgtmedia.com/rms/onlineimages/business_analytics-hadoop_vs_spark-f_mobile.png" alt="" width="832" height="550"/><figcaption>Credits: https://cdn.ttgtmedia.com/rms/onlineimages/business_analytics-hadoop_vs_spark-f_mobile.png</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:heading {"textAlign":"center","level":3} -->
<h3 class="has-text-align-center" id="architecture-of-spark">Architecture of Spark</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Spark is accessible, intense, powerful and proficient Big Data tool for handling different enormous information challenges. Apache Spark takes after an ace/slave engineering with two primary Daemons and a Cluster Manager</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Master Daemon – (Master/Driver Process)</li><li>Worker Daemon – (Slave Process)</li></ol>
<!-- /wp:list -->

<!-- wp:image {"align":"center","sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://spark.apache.org/docs/latest/img/cluster-overview.png" alt=""/><figcaption>Credits:https://spark.apache.org/docs/latest/img/cluster-overview.png</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>A spark cluster has a solitary Master and many numbers of Slaves/Workers. The driver and the agents run their individual Java procedures and users can execute them on individual machines. Below are the three methods of building Spark with Hadoop Components  -</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Standalone - The arrangement implies Spark possesses the place on the top of HDFS(Hadoop Distributed File System) and space is allotted for HDFS, unequivocally. Here, Spark and MapReduce will run one next to the other to covering all in the form of Cluster.</li><li>Hadoop Yarn - Hadoop Yarn arrangement implies, basically, Spark keeps running on Yarn with no pre-establishment or root get to required. It incorporates Spark into the Hadoop environment or the Hadoop stack. It enables different parts to keep running on the top of the stack having an explicit allocation for HDFS.</li><li>Spark in MapReduce - Spark in MapReduce is utilized to dispatch start work notwithstanding independent arrangement. With SIMR, the client can begin Spark and uses its shell with no regulatory access.</li></ol>
<!-- /wp:list -->

<!-- wp:image {"align":"center","width":618,"height":313,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img src="https://databricks.com/wp-content/uploads/2014/01/SparkHadoop.png" alt="" width="618" height="313"/><figcaption>Credits: https://databricks.com/wp-content/uploads/2014/01/SparkHadoop.png</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center"><strong>Abstractions in Spark Architecture</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>In this architecture, all the components and layers are loosely coupled. These components are integrated with several extensions as well as libraries. There are mainly two abstractions on which spark architecture is based. They are:</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Resilient Distributed Datasets (RDD): These are the collection of object which is logically partitioned. <ol><li>It supports in-memory computation over spark cluster. Spark RDDs are immutable in nature. </li><li>It supports Hadoop datasets and parallelized collections. </li><li>Hadoop Datasets are created from the files stored on HDFS. Parallelized collections are based on existing scala collections. </li><li>As RDDs are immutable, it offers two operations transformations and actions.</li></ol></li><li>Directed Acyclic Graph (DAG): Directed- Graph which is directly connected from one node to another. This creates a sequence.<ol><li>Acyclic – It defines that there is no cycle or loop available.</li><li>Graph – It is a combination of vertices and edges, with all the connections in a sequence</li><li>We can call it a sequence of computations, performed on data. In this graph, edge refers to transformation on top of data. while vertices refer to an RDD partition. This helps to eliminate the Hadoop mapreduce multistage execution model. It also provides efficient performance over Hadoop.</li></ol></li></ol>
<!-- /wp:list -->

<!-- wp:image {"align":"center","width":557,"height":295,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img src="https://hxquangnhat.files.wordpress.com/2015/03/scheduling.jpeg" alt="" width="557" height="295"/><figcaption>Credits:https://hxquangnhat.files.wordpress.com/2015/03/scheduling.jpeg</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center"><strong>Spark Execution Flow :</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Application Jar: User program and its dependencies except Hadoop &amp; Spark Jars bundled into a Jar file.</li><li>Driver Program: The process to start the execution (main() function)<ol><li>Main process co-ordinated by the SparkContext object.</li><li>Allows to configure any spark process wth specific parameters</li><li>Spark actions are executed in the Driver</li></ol></li><li>Cluster Manager: An external service to manage resources on the cluster ( YARN)<ol><li>External services for acquring resources on the cluster</li><li>Variety of cluster managers such as Local, Standalone, and Yarn</li></ol></li><li>Deploy Mode<ol><li>Cluster: Driver inside the cluster, framework launches the driver inside of the cluster.</li><li>Client: Driver outside of cluster</li></ol></li><li>Worker Node: any node that run the application program in cluster.</li><li>Executor: A process launched for an application on a worker node that run tasks and keeps data in memory or disk storage across them. Each application has its own executors.</li><li>Task: a unit of work that will be sent to executor</li><li>Job: a parallel computation consisting of multiple tasks that gets spawned in response to a spark action.</li><li>Stage: Each job is divided into smaller set of tasks called stages that is sequential and depend on each other</li><li>Spark Context: represents the connection to a spark cluster, and can be used to create RDDs accumulator and broadcast variables on that cluster.<ol><li>Main entry point for Spark functionality</li><li>Represents the connection to a spark cluster</li><li>Tells spark how &amp; where to access a cluster</li><li>Can be used to create RDDs, accumulators and broadcast variables on that cluster.</li></ol></li></ol>
<!-- /wp:list -->

<!-- wp:heading {"textAlign":"center","level":3} -->
<h3 class="has-text-align-center" id="resillient-distributed-dataset-rdd">Resillient Distributed dataset  (RDD)</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Resilient Distributed dataset  (RDD) is a basic abstraction in spark. Immutable, Partitioned collection of elements that can be operated in parallel.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center"><strong>Main characteristics of RDD</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>A list of partitions</li><li>A function for computing each split</li><li>A list of dependencies an other RDDs</li><li>Optionally,a partioner for key-value RDDs.</li><li>A list of preferred locations to compute each split on.</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>Custom RDD can be also implemented (by overriding functions)</p>
<!-- /wp:paragraph -->

<!-- wp:image {"width":926,"height":612,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large is-resized"><img src="https://cdn2.hubspot.net/hubfs/5041972/Imported_Blog_Media/fig-1-apache-spark-process-flow-4.png" alt="" width="926" height="612"/><figcaption>Credits: https://cdn2.hubspot.net/hubfs/5041972/Imported_Blog_Media/fig-1-apache-spark-process-flow-4.png</figcaption></figure>
<!-- /wp:image -->

<!-- wp:list {"ordered":true} -->
<ol><li>Transformations: These are functions that accept the existing RDDs as input and outputs one or more RDDs. However, the data in the existing RD in Spark does not change as it is immutable. <ol><li>These transformation are executed when they are invoked or called. Every time transformation are applied, a new RDD is created. </li></ol></li><li>Actions: These are functions that return the end result of RDD computations. It uses a lineage graph to load data onto the RDD in particular order. After all of the transformations are done, actions return the final result to the Spark driver. Actions are Operations that provide non-RDD values. </li></ol>
<!-- /wp:list -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center"><strong> Features of RDD</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>RDD in Apache Spark is an immutable collection of objects which computes on the different node of the cluster. </li><li>Resilient, i.e. fault-tolerant with the help of RDD lineage graph(DAG) and so able to recompute missing or damaged partitions due to node failures.</li><li>Distributed, since Data resides on multiple nodes.</li><li>Dataset represents records of the data you work with. The user can load the data set externally which can be either JSON file, CSV file, text file or database via JDBC with no specific data structure.</li><li>each and every dataset in RDD is logically partitioned across many servers so that they can be computed on different nodes of the cluster. RDDs are fault tolerant i.e. It posses self-recovery in the case of failure.</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center"><strong>Dependencies of RDD</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Narrow dependencies:  Each parition of the parent RDD is used by at most one parition of the child RDD. Task can be executed locally and we don't have to shuffle. <ol><li>Pipelined execution</li><li>Efficient recovery</li><li>No shuffling</li></ol></li><li>Wide dependencies: multiple child partitions may depend on one partition of the parent RDD. his means we have to shuffle data unless the parents are hash-partitioned.<ol><li>Requires shuffling unless parents are hash-partitioned </li><li>Expensive to recover</li></ol></li></ol>
<!-- /wp:list -->

<!-- wp:image {"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://lh4.googleusercontent.com/proxy/IOyxDouNY6J8KPLjRX11BF_422eWcgWdpu4gHkiZdhBnHAdFqIc8rMjVFoGqKpvJkIHouYanNHFSfuf5PAo4651XzwRvPL2GjObFjebEZXMTfTCOoi-SmwTweQ4=w1200-h630-p-k-no-nu" alt=""/><figcaption>Credits: https://lh4.googleusercontent.com/proxy/IOyxDouNY6J8KPLjRX11BF_422eWcgWdpu4gHkiZdhBnHAdFqIc8rMjVFoGqKpvJkIHouYanNHFSfuf5PAo4651XzwRvPL2GjObFjebEZXMTfTCOoi-SmwTweQ4=w1200-h630-p-k-no-nu</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><strong>How to create a RDD?</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>By loading an external dataset: You can load an external file onto an RDD. The types of you can load are csv, txt  , json, etc. Here is the example of loading a text file onto an RDD. </li><li>By paralleling the collection of objects: When spark's parallelize method is applied to a group of elements, a new distributed dataset is created. This dateset is an RDD. </li><li>By Performing Transformation on the existing RDDs: One or more RDDs can be created by performing transformations on the existing RDDs as mentioned earlier in this tutorial page. </li></ol>
<!-- /wp:list -->

<!-- wp:heading {"textAlign":"center"} -->
<h2 class="has-text-align-center" id="spark-sql">Spark SQL</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Spark SQL integrates relational processing with Spark’s functional programming. It provides support for various data sources and makes it possible to weave SQL queries with code transformations thus resulting in a very powerful tool.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Spark SQL originated as Apache Hive to run on top of Spark and is now integrated with the Spark stack. Apache Hive had certain limitations Spark SQL was built to overcome these drawbacks and replace Apache Hive.</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Spark SQL is faster than Hive when it comes to processing speed. Spark SQL is an Apache Spark module used for structured data processing, which:</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li><span style="color:initial;">Acts as a distributed SQL query engine</span></li><li>Provides DataFrames for programming abstraction</li><li>Allows to query structured data in Spark programs</li><li>Can be used with platforms such as Scala, Java, R, and Python.</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>Features of Spark SQL: </strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Integrated − Seamlessly mix SQL queries with Spark programs. Spark SQL lets you query structured data as a distributed dataset (RDD) in Spark, with integrated APIs in Python, Scala and Java. This tight integration makes it easy to run SQL queries alongside complex analytic algorithms.</li><li>Unified Data Access − Load and query data from a variety of sources. Schema-RDDs provide a single interface for efficiently working with structured data, including Apache Hive tables, parquet files and JSON files.</li><li>Hive Compatibility − Run unmodified Hive queries on existing warehouses. Spark SQL reuses the Hive frontend and MetaStore, giving you full compatibility with existing Hive data, queries, and UDFs. Simply install it alongside Hive.</li><li>Standard Connectivity − Connect through JDBC or ODBC. Spark SQL includes a server mode with industry standard JDBC and ODBC connectivity.</li><li>Scalability − Use the same engine for both interactive and long queries. Spark SQL takes advantage of the RDD model to support mid-query fault tolerance, letting it scale to large jobs too. Do not worry about using a different engine for historical data.</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>Limitations of a Apache Hive:</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Hive uses MapReduce which lags in performance with medium and small sized datasets.</li><li>No resume capability</li><li>Hive cannot drop encrypted database</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong>Spark SQL was built to overcome the limitations of Apache Hive running on top of Spark. Spark SQL uses the metastore services of Hive to query the data stored and manged by Hive.</strong></p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","width":684,"height":572,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img src="http://programmerprodigycode.files.wordpress.com/2022/01/9309e-18gptmzkg5riiktdb2zimyg.png" alt="" width="684" height="572"/><figcaption>Credits: http://programmerprodigycode.files.wordpress.com/2022/01/9309e-18gptmzkg5riiktdb2zimyg.png</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:heading {"textAlign":"center","level":3} -->
<h3 class="has-text-align-center" id="spark-sql-architecture">Spark SQL Architecture</h3>
<!-- /wp:heading -->

<!-- wp:list {"ordered":true} -->
<ol><li>Language API: Spark is very compatible as it supports languages like Python, Scala and Java.</li><li>Schema RDD: As Spark SQL works on schema, tables and records you can use Schema RDD or dataframe as a temporary table.</li><li>Data Sources: Spark SQL supports multiple data sources like JSON, Cassandra database, Hive tables. </li><li>Data Source API is used to read and store structure and semi structured data into Spark SQL:<ol><li>Structured/Semi-structure data</li><li>Multiple formats</li><li>3 rd party integrations</li></ol></li><li>DataFrame APi converts the data that is read through Data source API into tabular colmns to help perform SQL operations.<ol><li>Distributed collection of data organized into named columns</li><li>Equivalent to a relational table in SQL</li><li>Lazily evaluated</li></ol></li><li>SQL Interpreter and Optimised handles the functional programming part of Spark SQL. it transforms the Data frames RDDs to get the required results in the required formats.<ol><li>Functional programming</li><li>transforming trees</li><li>Faster than rdds</li><li>Processes all size data</li></ol></li></ol>
<!-- /wp:list -->

<!-- wp:image {"align":"center","width":978,"height":423,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img src="https://www.edureka.co/blog/wp-content/uploads/2017/04/Spark-SQL-Spark-Tutorial-Edureka.png" alt="" width="978" height="423"/><figcaption>Credits: https://www.edureka.co/blog/wp-content/uploads/2017/04/Spark-SQL-Spark-Tutorial-Edureka.png</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p id="sql-service-is-the-entry-point-for-working-along-structured-data-in-spark"><strong>SQL service is the entry point for working along structured data in spark, and is used to fetch the result from the interpreted and optimised data.</strong></p>
<!-- /wp:paragraph -->

<!-- wp:heading {"textAlign":"center"} -->
<h2 class="has-text-align-center" id="spark-mlib">Spark MLib</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Mlib stands for Machine learnign library in Spark. The goal of this library is to make practical machine learning scalable and easy to implement.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>It contains fast and scalable implementations of standard machine learning algorithms. Through Spark MLlib, data engineers and data scientists have access to different types of statistical analysis, linear algebra and various optimization primitives. Spark Machine Learning library MLlib contains the following applications </p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Collaborative Filtering for Recommendations – Alternating Least Squares</li><li>Regression for Predictions – Logistic Regression, Lasso Regression, Ridge Regression, Linear Regression and Support Vector Machines (SVM).</li><li>Clustering – Linear Discriminant Analysis, K-Mean and Gaussian,</li><li>Classification Algorithms – Naïve Bayes, Ensemble Methods, and Decision Trees.</li><li>Dimensionality Reduction –PCA (Principal Component Analysis) and Singular Value Decomposition (SVD)</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center"><strong>Benefits of Spark MLib:</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>Spark MLlib is tightly integrated on top of Spark which eases the development of efficient large-scale machine learning algorithms as are usually iterative in nature.</li><li>MLlib is easy to deploy and does not require any pre-installation, if Hadoop 2 cluster is already installed and running.</li><li>Spark MLlib’s scalability, simplicity, and language compatibility helps data scientists solve iterative data problems faster. </li><li>MLlib provides ultimate performance gains (about 10 to 100 times faster than Hadoop and Apache Mahout). </li></ul>
<!-- /wp:list -->

<!-- wp:image {"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://spark.apache.org/docs/latest/img/ml-PipelineModel.png" alt=""/><figcaption>Credits: https://spark.apache.org/docs/latest/img/ml-PipelineModel.png</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center"><strong>Features of Spark MLlib Library</strong>:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>MLlib provides algorithmic optimisations for accurate predictions and efficient distributed learning. <ul><li>For instance, the alternating least squares machine learning algorithms for making recommendations effectively uses blocking to reduce JVM garbage collection overhead.</li></ul></li><li>MLlib benefits from its tight integration with various spark components. </li><li>MLlib provides a package called spark.ml to simplify the development and performance tuning of multi-stage machine learning pipelines. <ul><li>MLlib provides high-level API’s which help data scientists swap out a standard learning approach instead of using their own specialized machine learning algorithms.</li></ul></li><li>MLlib provides fast and distributed implementations of common machine learning algorithms along with a number of low-level primitives and various utilities for statistical analysis, feature extraction, convex optimizations, and distributed linear algebra.</li><li>Spark MLlib library has extensive documentation which describes all the supported utilities and methods with several spark machine learning example codes and the API docs for all the supported languages.</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center"><strong>Spark Mlib Tools:</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Ml Algorithms: classfication, regrssion, clustering and collaborative filtering</li><li>Featurization: feature extraction, transformation, dimensionality reduction, and selection</li><li>Pipelines: tools for constructing, evaluating and tunnignML pipelines</li><li>Persistence: saving and loading algorithms, models and pipelines</li><li>Utilities: linear algebra, statistics, data handling</li></ol>
<!-- /wp:list -->

<!-- wp:image {"align":"center","width":918,"height":257,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img src="https://docs.microsoft.com/en-us/sql/big-data-cluster/media/big-data-cluster-overview/ai-ml-spark.png?view=sql-server-ver15" alt="" width="918" height="257"/><figcaption>Credits: https://docs.microsoft.com/en-us/sql/big-data-cluster/media/big-data-cluster-overview/ai-ml-spark.png?view=sql-server-ver15</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center"><strong>Machine learning Pipelines componenets</strong>:</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Data frame: The ML API uses Dataframe from Spark SQL as a dataset, which can be used to hold a variety of datatypes</li><li>Transformer: This is used to transform one Dataframe to another Dataframe. Examples are  <ol><li>Hashing Term Frequency: This calculates how word<br>occurs</li><li>Logistic Regression Model: The model which results<br>from trying logistic regressions on a dataset</li><li>Binarizer: This changes a given threshold value to 1<br>or 0</li></ol></li><li>Estimator: It is an algorithm which can be used on a Dataframe to produce Transformer. Examples are:<ol><li>Logistic Regression: It is used to determine the weights for the resulting Logistic Regression Model by processing the dataframe</li><li>Standard Scaler: It is used to calculate the Standard deviation</li><li>Pipeline: Calling fit on a pipeline produces pipeline model, and the pipeline contains only transformers and not the estimators</li></ol></li><li>Pipeline: A pipeline chains multiple Transformers and Estimators together to specify the ML workflow</li><li>Parameters: To specify the parameters a common API is used by the Transformers and Estimators</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>For more information about Hadoop and HDFS,  Hive</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li><a href="https://programmerprodigy.code.blog/2021/06/28/introduction-to-hadoophdfs-and-hbase/">https://programmerprodigy.code.blog/2021/06/28/introduction-to-hadoophdfs-and-hbase/</a></li><li><a href="https://programmerprodigy.code.blog/2022/01/08/hive-sql-layer-above-hadoop/" target="_blank" rel="noreferrer noopener">https://programmerprodigy.code.blog/2022/01/08/hive-sql-layer-above-hadoop/</a></li></ol>
<!-- /wp:list -->