Categories
Misc

GTC 21: Top 5 Data Science Technical Sessions

Learn from the world’s most advanced data science teams, here are some highlighted data science sessions planned for GTC.

Join thousands of other practitioners, leaders, and innovators to learn data science from the world’s most advanced data teams.

The following are some highlighted data science sessions planned for GTC:

1. GPU-Accelerated Model Evaluation: How we took our offline evaluation process from hours to minutes with RAPIDS

In this session, we’ll describe how we utilized cuDF and Dask-CUDF to build an interactive model evaluation system that drastically reduced the time it took to evaluate our recommender systems in an offline setting. As a result, model evaluations that previously took hours to complete as CPU workloads now run in minutes, allowing us to increase our overall iteration speed and thus build better models.

Speakers:
Joseph Cauteruccio, Machine Learning Engineer, Spotify
Marc Romeyn – Machine Learning Engineer, Spotify

2. Accelerated ETL, Training and Inference of Recommender Systems on the GPU with Merlin, HugeCTR, NVTabular, and Triton

In this talk, we’ll share the Merlin framework, consisting of NVTabular for ETL, HugeCTR for training, and Triton for inference serving. Merlin accelerates recommender systems on GPU, speeding up common ETL tasks, training of models, and inference serving by ~10x over commonly used methods. Beyond providing better performance, these libraries are also designed to be easy to use and integrate with existing recommendation pipelines.

Speaker: Even Oldridge, Senior Manager, Recommender Systems Framework Team, NVIDIA

3. How Walmart improves computationally intensive business processes with NVIDIA GPU Computing

Over the last several years, Walmart has been developing and implementing a wide range of applications that require GPU computing to be computationally feasible at Walmart scale. We will present CPU vs. GPU performance comparisons on a number of real-world problems from different areas of the business and we highlight, not just the performance gains from GPU computing, but also what capabilities GPU computing has enabled that would simply not be possible on CPU-only architectures.

Speakers:
Richard Ulrich, Senior Director, Walmart
John Bowman, Director, Data Science, Walmart

4. How Cloudera Data Platform uses a single pane of glass to deploy GPU accelerated applications s across hybrid and multi-clouds

Learn how Cloudera Data Platform uses a single pane of glass to deploy GPU-accelerated applications across hybrid and multi-clouds.

Speakers:
Karthikeyan Rajendran, Product Manager, NVIDIA
Scott McClellan, General Manager of Data Science, NVIDIA

5. GPU-Accelerated, High-Performance Machine Learning Pipeline

The Adobe team is currently working with NVIDIA to build an unprecedented GPU-based, high-performance machine learning pipeline.

Speaker: Lei Zhang, Senior Machine Learning Engineer, Adobe

Visit the GTC website to register for GTC (free) and to learn more about our Data Science track.

Categories
Misc

The Best Tools to Improve Gameplay Performance

Developers are using the latest NVIDIA RTX technology to deliver the best gaming experience to players, complete with high-quality graphics and fast performance. But improving gameplay takes more than GPU power alone.

There’s a new standard in gaming — and system optimizations have set the bar high.

Developers are using the latest NVIDIA RTX technology to deliver the best gaming experience to players, complete with high-quality graphics and fast performance. But improving gameplay takes more than GPU power alone.

From AI-accelerated techniques like Deep Learning Super Sampling (DLSS) to powerful SDKs like NVIDIA Reflex, game developers are using the most advanced tools to reduce input latency and increase frame rates for gamers. 

Learn how DLSS and NVIDIA Reflex are helping users deliver the ultimate gaming experience.

Superb Graphics with Super Sampling

DLSS is an advanced image upscaling technology that uses a deep learning neural network to  boost frame rates and produce beautiful, sharp images for games. NVIDIA set out to redefine real-time rendering through AI-based super resolution — rendering a fraction of the original pixels and then using AI to reconstruct sharp, higher resolution images.

Dedicated computational units called Tensor Cores accelerate the AI calculations, allowing NVIDIA’s RTX series of GPUs to run the algorithm in real time. With DLSS, users can maximize ray-tracing settings and increase output resolution. DLSS is now available in Unreal Engine 4 through our official DLSS UE 4.26 plugin.

Improving Latency with Reflex

The NVIDIA Reflex SDK allows game developers to implement a low latency mode, which aligns game engine work to complete just-in-time for rendering. This eliminates the GPU render queue and reduces CPU back pressure in GPU-bound scenarios.

As a developer, System Latency (click-to-display) can be one of the hardest metrics to optimize for. In addition to latency reduction functions, the SDK also features measurement markers to calculate both Game and Render Latency — this feature is great for debugging and visualizing in-game performance counters.

You’ll have the opportunity to learn more about DLSS and NVIDIA Reflex at the GPU Technology Conference next month, as well as have the chance to ask NVIDIA experts questions about the technology

Register for free to attend these sessions and learn about the experience of game developers who worked on popular titles, including Minecraft, Cyberpunk 2077, Overwatch and LEGO Builder’s Journey.

And don’t forget to explore through more than 20 game development sessions at GTC.

Categories
Misc

NVIDIA Releases Updates to CUDA-X AI Software

NVIDIA CUDA-X AI are deep learning libraries for researchers and software developers to build high performance GPU-accelerated applications for conversational AI, recommendation systems and computer vision.

NVIDIA CUDA-X AI are deep learning libraries for researchers and software developers to build high performance GPU-accelerated applications for conversational AI, recommendation systems and computer vision.

Learn what’s new in the latest releases of CUDA-X AI libraries.

Refer to each package’s release notes in documentation for additional information.

NVIDIA Jarvis Open Beta 

NVIDIA Jarvis is an application framework for multimodal conversational AI services that delivers real-time performance on GPUs. This version of Jarvis includes:

  • ASR, NLU, and TTS models trained on thousands of hours of speech data.
  • Transfer Learning Toolkit with zero coding approach to re-train on custom data.
  • Fully accelerated deep learning pipelines optimized to run as scalable services.
  • End-to-end workflow and tools to deploy services using one line of code.

Transfer Learning Toolkit 3.0 Developer Preview

NVIDIA released new pre-trained models for computer vision and conversational AI that can be easily fine-tuned with Transfer Learning Toolkit (TLT) 3.0 with a zero-coding approach. 

Key highlights: 

  • New vision AI pre-trained models: license plate detection and recognition, heart rate monitoring, gesture recognition, gaze estimation, emotion recognition, face detection, and facial landmark estimation 
  • Newly added support for automatic speech recognition (ASR) and natural language processing (NLP) 
  • Choice of training with popular network architectures such as EfficientNet, YoloV4, and UNET
  • Support for NVIDIA Ampere GPUs with third-generation tensor cores for performance boost 

Triton Inference Server 2.7 

Triton Inference Server is an open source multi-framework, cross platform inference serving software designed to simplify model production deployment. Version 2.7 includes:

  • Model Analyzer – automatically finds best model configuration to maximize performance based on user-specified requirements 
  • Model Repo Agent API  – enables custom operations to be performed to models being loaded (such as decrypting, checksumming, applying TF-TRT optimization, etc)
  • Added support for ONNX Runtime backend in Triton Windows build
  • Added an example Java and Scala client based on GRPC-generated API

Read full release notes here

TensorRT 7.2 is Now Available

NVIDIA TensorRT is a platform for high-performance deep learning inference. This version of TensorRT includes:

  • New Polygraphy toolkit, assists in prototyping and debugging deep learning models in various frameworks
  • Support for Python 3.8

Merlin Open Beta

Merlin is an application framework and ecosystem that enables end-to-end development of recommender systems, accelerated on NVIDIA GPUs. Merlin Open Beta highlights include:

  • NVTabular and HugeCTR inference support in Triton Inference Server
  • Cloud configurations and cloud support (AWS/GCP)
  • Dataset analysis and generation tools
  • New PythonAPI for HugeCTR similar to Keras with no JSON configuration anymore

DeepStream SDK 5.1

NVIDIA DeepStream SDK is a streaming analytics toolkit for AI-based multi-sensor processing. 

Key highlights for DeepStream SDK 5.1 (General Availability) 

  • New Python apps for using optical flow, segmentation networks, and analytics using ROI and line crossing
  • Support for audio analytics with a sample application highlighting audio classifier usage
  • Support for NVIDIA Ampere GPUs with third-generation tensor cores and various performance optimizations

nvJPEG2000 0.2 

nvJPEG2000 is a new library for GPU-accelerated JPEG2000 image decoding. This version of nvJPEG2000 includes:

NVIDIA NeMo 1.0.0b4

NVIDIA NeMo is a toolkit to build, train and fine-tune state-of-the-art speech and language models easily. Highlights of this version include:

  • Compatible with Jarvis 1.0.0b2 public beta and TLT 3.0 releases

Deep Learning Examples

Deep Learning Examples provide state-of-the-art reference examples that are easy to train and deploy, achieving the best reproducible accuracy and performance with NVIDIA CUDA-X AI software stack running on NVIDIA Volta, Turing, and Ampere GPUs.

New Model Scripts available from the NGC Catalog:

  • nnUNet/PyT: A Self-adapting Framework for U-Net for state-of-the-art Segmentation across distinct entities, image modalities, image geometries, and dataset sizes, with no manual adjustments between datasets. 
  • Wide and Deep/TF2: Wide & Deep refers to a class of networks that use the output of two parts working in parallel – wide model and deep model – to make a binary prediction of CTR. 
  • EfficientNet PyT & TF2: A model that scales the depth, width, and resolution to achieve better performance across different datasets. EfficientNet B4 achieves state-of-the-art 82.78% top-1 accuracy on ImageNet, while being 8.4x smaller and 6.1x faster on inference than the best existing ConvNet.
  • Electra: A novel pre-training method for language representations which outperforms existing techniques, given the same compute budget on a wide array of Natural Language Processing (NLP) tasks.
Categories
Misc

GTC 21: Top 5 Automotive Technical Sessions

Register for the free conference to hear talks from Audi Board Member Hildegard Wortmann, Zoox CTO Jesse Levinson, University of Toronto Professor Raquel Urtasun, and Cruise SVP of Engineering Mo ElShenawy.

NVIDIA GTC is returning with a special focus on autonomous vehicles, including talks from Audi Board Member Hildegard Wortmann, Zoox CTO Jesse Levinson, University of Toronto Professor Raquel Urtasun, and Cruise SVP of Engineering Mo ElShenawy. GTC is free to attend – you and your team can register here. 

This free five-day digital conference kicks off April 12 with NVIDIA CEO Jensen Huang’s keynote followed by 1,400+ talks ranging from technical deep dives to business-focused talks by C-level leaders. You won’t want to miss it.

Here are some session highlights for autonomous vehicle development:

  1. Deep-Sensor Fusion of Thermal and Visible Cameras for Autonomous Driving

    See the latest research on fusing visual and thermal sensors for state-of-the-art segmentation accuracy in autonomous driving.

    Vijay John, Assistant Professor, Toyota Technological Institute

  1. Understanding Safety and Security Standards for Autonomous Vehicles: An NVIDIA DRIVE Approach

    Learn how to more easily integrate the NVIDIA DRIVE platform into your safe and secure AV designs with NVIDIA’s safety approach.

    Karl Greb, Safety Engineering Director, NVIDIA
    Riccardo Mariani, VP of Industry Safety, NVIDIA

  1. Autonomous Valet Parking Powered by NVIDIA DRIVE

    This session will cover how Apex.AI developed a modular approach to production autonomous parking.

    Dejan Pangercic, CTO, Apex.AI

  1. Human-Guided Autonomous Convoys

    This presentation highlights the operations and challenges of deploying an autonomous convoy system for long-haul trucking.

    Cetin Mericli, CEO, Locomation

  1. Deflating Dataset Bias Using Synthetic Data Augmentation

    This session will show how targeted synthetic data augmentation can help fill gaps in static datasets for vision tasks.

    Nikita Jaipuria, Research Scientist, Ford Motor Company

Additionally, from April 20-22, be sure to check out NVIDIA DRIVE Developer Days, which will consist of deep dive sessions on safe and robust AV development. These are also FREE and will be available via the GTC session catalog.

Categories
Misc

Beginner’s Guide to GPU Accelerated Graph Analytics in Python

This tutorial is the sixth installment of introductions to the RAPIDS ecosystem.

Categories
Misc

Accelerating Analytics and AI with Alluxio and NVIDIA GPUs

In this tutorial, we take a look at using Alluxio Data Orchestration across multiple stages of a data processing pipeline, from ETL to analytics and AI/ML.

Categories
Misc

GTC 21: Top 5 Professional Visualization Sessions

Learn how you can take advantage of the latest NVIDIA technology to enable the creation of beautiful worlds quicker and easier than ever before.

This year at GTC we have several sessions for professional content creators looking to take advantage of the latest NVIDIA technology to enable the creation of beautiful worlds quicker and easier than ever before. Find out how to add life-like realism to your projects with new ray tracing features and faster real-time volumetric rendering and simulation. Also, learn how to collaborate with creators around the world seamlessly and effortlessly no matter what software you use. We have hundreds of sessions on graphics, simulation, and design to choose from. Registration is free.

These are the five graphics sessions you can’t miss: 

Image courtesy of Adobe Substance and Zhelongxu

What’s New in OptiX
Catch up with the latest additions to the OptiX SDK and learn tips and tricks on how best to implement them into your products.

NanoVDB: A GPU-Friendly and Portable VDB Data Structure for Real-Time Rendering and Simulation
Learn how NanoVDB accelerates real-time rendering and simulation of the most graphically intensive volumetric effects on NVIDIA GPUs.

An Overview of NVIDIA CloudXR
Learn all about NVIDIA CloudXR, a groundbreaking innovation for streaming VR and AR from any OpenVR application on a remote server to a client device. Get details on the architecture of the CloudXR software stack and explore the use cases.

Building Omniverse Kit Apps and Extensions
Learn how to leverage Omniverse Kit to build amazing applications and extensions.

Making a Connector for Omniverse
Learn how to connect with the Omniverse platform, send data to it, and establish a live sync session. There will also be a USD 101 overview to get you started.

Register for free and check out GTC sessions that dive into the latest technologies for graphics and simulation. A quick registration is required to view the GTC catalog with over 1,400 free sessions covering XR, graphics, simulation, design, and more.

Categories
Misc

Question about using tf.stop_gradient in separate Actor-Critic networks for A2C implementation for TF2

submitted by /u/AvisekEECS
[visit reddit] [comments]

Categories
Misc

AI wakeword dataset single word audiofile chess

Hi, I would like to make simple AI, which can detect hotword/wakeword and I need a lot of short audiofiles with names of chess figures. How to get the dataset like that or is there another opensource hotword/wakeword detection? (STT would be too weak and common wakeword mechanisms are deprecated or commercial ;( )

submitted by /u/Feeling_Wait_7132
[visit reddit] [comments]

Categories
Misc

sparklyr 1.6: weighted quantile summaries, power iteration clustering, spark_write_rds(), and more

Sparklyr 1.6 is now available on CRAN!

To install sparklyr 1.6 from CRAN, run

install.packages("sparklyr")

In this blog post, we shall highlight the following features and enhancements from sparklyr 1.6:

Weighted quantile summaries

Apache Spark is well-known for supporting approximate algorithms that trade off marginal amounts of accuracy for greater speed and parallelism. Such algorithms are particularly beneficial for performing preliminary data explorations at scale, as they enable users to quickly query certain estimated statistics within a predefined error margin, while avoiding the high cost of exact computations. One example is the Greenwald-Khanna algorithm for on-line computation of quantile summaries, as described in Greenwald and Khanna (2001). This algorithm was originally designed for efficient (epsilon)- approximation of quantiles within a large dataset without the notion of data points carrying different weights, and the unweighted version of it has been implemented as approxQuantile() since Spark 2.0. However, the same algorithm can be generalized to handle weighted inputs, and as sparklyr user @Zhuk66 mentioned in this issue, a weighted version of this algorithm makes for a useful sparklyr feature.

To properly explain what weighted-quantile means, we must clarify what the weight of each data point signifies. For example, if we have a sequence of observations ((1, 1, 1, 1, 0, 2, -1, -1)), and would like to approximate the median of all data points, then we have the following two options:

  • Either run the unweighted version of approxQuantile() in Spark to scan through all 8 data points

  • Or alternatively, “compress” the data into 4 tuples of (value, weight): ((1, 0.5), (0, 0.125), (2, 0.125), (-1, 0.25)), where the second component of each tuple represents how often a value occurs relative to the rest of the observed values, and then find the median by scanning through the 4 tuples using the weighted version of the Greenwald-Khanna algorithm

We can also run through a contrived example involving the standard normal distribution to illustrate the power of weighted quantile estimation in sparklyr 1.6. Suppose we cannot simply run qnorm() in R to evaluate the quantile function of the standard normal distribution at (p = 0.25) and (p = 0.75), how can we get some vague idea about the 1st and 3rd quantiles of this distribution? One way is to sample a large number of data points from this distribution, and then apply the Greenwald-Khanna algorithm to our unweighted samples, as shown below:

library(sparklyr)

sc <- spark_connect(master = "local")

num_samples <- 1e6
samples <- data.frame(x = rnorm(num_samples))

samples_sdf <- copy_to(sc, samples, name = random_string())

samples_sdf %>%
  sdf_quantile(
    column = "x",
    probabilities = c(0.25, 0.75),
    relative.error = 0.01
  ) %>%
  print()
##        25%        75%
## -0.6629242  0.6874939

Notice that because we are working with an approximate algorithm, and have specified relative.error = 0.01, the estimated value of (-0.6629242) from above could be anywhere between the 24th and the 26th percentile of all samples. In fact, it falls in the (25.36896)-th percentile:

pnorm(-0.6629242)
## [1] 0.2536896

Now how can we make use of weighted quantile estimation from sparklyr 1.6 to obtain similar results? Simple! We can sample a large number of (x) values uniformly randomly from ((-infty, infty)) (or alternatively, just select a large number of values evenly spaced between ((-M, M)) where (M) is approximately (infty)), and assign each (x) value a weight of (displaystyle frac{1}{sqrt{2 pi}}e^{-frac{x^2}{2}}), the standard normal distribution’s probability density at (x). Finally, we run the weighted version of sdf_quantile() from sparklyr 1.6, as shown below:

library(sparklyr)

sc <- spark_connect(master = "local")

num_samples <- 1e6
M <- 1000
samples <- tibble::tibble(
  x = M * seq(-num_samples / 2 + 1, num_samples / 2) / num_samples,
  weight = dnorm(x)
)

samples_sdf <- copy_to(sc, samples, name = random_string())

samples_sdf %>%
  sdf_quantile(
    column = "x",
    weight.column = "weight",
    probabilities = c(0.25, 0.75),
    relative.error = 0.01
  ) %>%
  print()
##    25%    75%
## -0.696  0.662

Voilà! The estimates are not too far off from the 25th and 75th percentiles (in relation to our abovementioned maximum permissible error of (0.01)):

pnorm(-0.696)
## [1] 0.2432144
pnorm(0.662)
## [1] 0.7460144

Power iteration clustering

Power iteration clustering (PIC), a simple and scalable graph clustering method presented in Lin and Cohen (2010), first finds a low-dimensional embedding of a dataset, using truncated power iteration on a normalized pairwise-similarity matrix of all data points, and then uses this embedding as the “cluster indicator”, an intermediate representation of the dataset that leads to fast convergence when used as input to k-means clustering. This process is very well illustrated in figure 1 of Lin and Cohen (2010) (reproduced below)

in which the leftmost image is the visualization of a dataset consisting of 3 circles, with points colored in red, green, and blue indicating clustering results, and the subsequent images show the power iteration process gradually transforming the original set of points into what appears to be three disjoint line segments, an intermediate representation that can be rapidly separated into 3 clusters using k-means clustering with (k = 3).

In sparklyr 1.6, ml_power_iteration() was implemented to make the PIC functionality in Spark accessible from R. It expects as input a 3-column Spark dataframe that represents a pairwise-similarity matrix of all data points. Two of the columns in this dataframe should contain 0-based row and column indices, and the third column should hold the corresponding similarity measure. In the example below, we will see a dataset consisting of two circles being easily separated into two clusters by ml_power_iteration(), with the Gaussian kernel being used as the similarity measure between any 2 points:

gen_similarity_matrix <- function() {
  # Guassian similarity measure
  guassian_similarity <- function(pt1, pt2) {
    exp(-sum((pt2 - pt1) ^ 2) / 2)
  }
  # generate evenly distributed points on a circle centered at the origin
  gen_circle <- function(radius, num_pts) {
    seq(0, num_pts - 1) %>%
      purrr::map_dfr(
        function(idx) {
          theta <- 2 * pi * idx / num_pts
          radius * c(x = cos(theta), y = sin(theta))
        })
  }
  # generate points on both circles
  pts <- rbind(
    gen_circle(radius = 1, num_pts = 80),
    gen_circle(radius = 4, num_pts = 80)
  )
  # populate the pairwise similarity matrix (stored as a 3-column dataframe)
  similarity_matrix <- data.frame()
  for (i in seq(2, nrow(pts)))
    similarity_matrix <- similarity_matrix %>%
      rbind(seq(i - 1L) %>%
        purrr::map_dfr(~ list(
          src = i - 1L, dst = .x - 1L,
          similarity = guassian_similarity(pts[i,], pts[.x,])
        ))
      )

  similarity_matrix
}

library(sparklyr)

sc <- spark_connect(master = "local")
sdf <- copy_to(sc, gen_similarity_matrix())
clusters <- ml_power_iteration(
  sdf, k = 2, max_iter = 10, init_mode = "degree",
  src_col = "src", dst_col = "dst", weight_col = "similarity"
)

clusters %>% print(n = 160)
## # A tibble: 160 x 2
##        id cluster
##     <dbl>   <int>
##   1     0       1
##   2     1       1
##   3     2       1
##   4     3       1
##   5     4       1
##   ...
##   157   156       0
##   158   157       0
##   159   158       0
##   160   159       0

The output shows points from the two circles being assigned to separate clusters, as expected, after only a small number of PIC iterations.

spark_write_rds() + collect_from_rds()

spark_write_rds() and collect_from_rds() are implemented as a less memory- consuming alternative to collect(). Unlike collect(), which retrieves all elements of a Spark dataframe through the Spark driver node, hence potentially causing slowness or out-of-memory failures when collecting large amounts of data, spark_write_rds(), when used in conjunction with collect_from_rds(), can retrieve all partitions of a Spark dataframe directly from Spark workers, rather than through the Spark driver node. First, spark_write_rds() will distribute the tasks of serializing Spark dataframe partitions in RDS version 2 format among Spark workers. Spark workers can then process multiple partitions in parallel, each handling one partition at a time and persisting the RDS output directly to disk, rather than sending dataframe partitions to the Spark driver node. Finally, the RDS outputs can be re-assembled to R dataframes using collect_from_rds().

Shown below is an example of spark_write_rds() + collect_from_rds() usage, where RDS outputs are first saved to HDFS, then downloaded to the local filesystem with hadoop fs -get, and finally, post-processed with collect_from_rds():

library(sparklyr)
library(nycflights13)

num_partitions <- 10L
sc <- spark_connect(master = "yarn", spark_home = "/usr/lib/spark")
flights_sdf <- copy_to(sc, flights, repartition = num_partitions)

# Spark workers serialize all partition in RDS format in parallel and write RDS
# outputs to HDFS
spark_write_rds(
  flights_sdf,
  dest_uri = "hdfs://<namenode>:8020/flights-part-{partitionId}.rds"
)

# Run `hadoop fs -get` to download RDS files from HDFS to local file system
for (partition in seq(num_partitions) - 1)
  system2(
    "hadoop",
    c("fs", "-get", sprintf("hdfs://<namenode>:8020/flights-part-%d.rds", partition))
  )

# Post-process RDS outputs
partitions <- seq(num_partitions) - 1 %>%
  lapply(function(partition) collect_from_rds(sprintf("flights-part-%d.rds", partition)))

# Optionally, call `rbind()` to combine data from all partitions into a single R dataframe
flights_df <- do.call(rbind, partitions)

Dplyr-related improvements

Similar to other recent sparklyr releases, sparklyr 1.6 comes with a number of dplyr-related improvements, such as

  • Support for where() predicate within select() and summarize(across(…)) operations on Spark dataframes
  • Addition of if_all() and if_any() functions
  • Full compatibility with dbplyr 2.0 backend API

select(where(…)) and summarize(across(where(…)))

The dplyr where(…) construct is useful for applying a selection or aggregation function to multiple columns that satisfy some boolean predicate. For example,

library(dplyr)

iris %>% select(where(is.numeric))

returns all numeric columns from the iris dataset, and

library(dplyr)

iris %>% summarize(across(where(is.numeric), mean))

computes the average of each numeric column.

In sparklyr 1.6, both types of operations can be applied to Spark dataframes, e.g.,

library(dplyr)
library(sparklyr)

sc <- spark_connect(master = "local")
iris_sdf <- copy_to(sc, iris, name = random_string())

iris_sdf %>% select(where(is.numeric))

iris %>% summarize(across(where(is.numeric), mean))

if_all() and if_any()

if_all() and if_any() are two convenience functions from dplyr 1.0.4 (see here for more details) that effectively1 combine the results of applying a boolean predicate to a tidy selection of columns using the logical and/or operators.

Starting from sparklyr 1.6, if_all() and if_any() can also be applied to Spark dataframes, .e.g.,

library(dplyr)
library(sparklyr)

sc <- spark_connect(master = "local")
iris_sdf <- copy_to(sc, iris, name = random_string())

# Select all records with Petal.Width > 2 and Petal.Length > 2
iris_sdf %>% filter(if_all(starts_with("Petal"), ~ .x > 2))

# Select all records with Petal.Width > 5 or Petal.Length > 5
iris_sdf %>% filter(if_any(starts_with("Petal"), ~ .x > 5))

Compatibility with dbplyr 2.0 backend API

Sparklyr 1.6 is fully compatible with the newer dbplyr 2.0 backend API (by implementing all interface changes recommended in here), while still maintaining backward compatibility with the previous edition of dbplyr API, so that sparklyr users will not be forced to switch to any particular version of dbplyr.

This should be a mostly non-user-visible change as of now. In fact, the only discernible behavior change will be the following code

library(dbplyr)
library(sparklyr)

sc <- spark_connect(master = "local")

print(dbplyr_edition(sc))

outputting

[1] 2

if sparklyr is working with dbplyr 2.0+, and

[1] 1

if otherwise.

Acknowledgements

In chronological order, we would like to thank the following contributors for making sparklyr 1.6 awesome:

We would also like to give a big shout-out to the wonderful open-source community behind sparklyr, without whom we would not have benefitted from numerous sparklyr-related bug reports and feature suggestions.

Finally, the author of this blog post also very much appreciates the highly valuable editorial suggestions from @skeydan.

If you wish to learn more about sparklyr, we recommend checking out sparklyr.ai, spark.rstudio.com, and also some previous sparklyr release posts such as sparklyr 1.5 and sparklyr 1.4.

That is all. Thanks for reading!

Greenwald, Michael, and Sanjeev Khanna. 2001. “Space-Efficient Online Computation of Quantile Summaries.” SIGMOD Rec. 30 (2): 58–66. https://doi.org/10.1145/376284.375670.

Lin, Frank, and William Cohen. 2010. “Power Iteration Clustering.” In, 655–62.

  1. modulo possible implementation-dependent short-circuit evaluations↩︎