Wednesday, February 22, 2023
HomeArtificial IntelligenceRStudio AI Weblog: TensorFlow and Keras 2.9

RStudio AI Weblog: TensorFlow and Keras 2.9



The discharge of Deep Studying with R, 2nd Version coincides with new releases of TensorFlow and Keras. These releases deliver many refinements that permit for extra idiomatic and concise R code.

First, the set of Tensor strategies for base R generics has drastically expanded. The set of R generics that work with TensorFlow Tensors is now fairly intensive:

strategies(class = "tensorflow.tensor")
 [1] -           !           !=          [           [<-        
 [6] *           /           &           %/%         %%         
[11] ^           +           <           <=          ==         
[16] >           >=          |           abs         acos       
[21] all         any         aperm       Arg         asin       
[26] atan        cbind       ceiling     Conj        cos        
[31] cospi       digamma     dim         exp         expm1      
[36] ground       Im          is.finite   is.infinite is.nan     
[41] size      lgamma      log         log10       log1p      
[46] log2        max         imply        min         Mod        
[51] print       prod        vary       rbind       Re         
[56] rep         spherical       signal        sin         sinpi      
[61] type        sqrt        str         sum         t          
[66] tan         tanpi      

Because of this usually you possibly can write the identical code for TensorFlow Tensors as you’ll for R arrays. For instance, contemplate this small perform from Chapter 11 of the ebook:

reweight_distribution <-
  perform(original_distribution, temperature = 0.5) {
    original_distribution %>%
      { exp(log(.) / temperature) } %>%
      { . / sum(.) }
  }

Observe that features like reweight_distribution() work with each 1D R vectors and 1D TensorFlow Tensors, since exp(), log(), /, and sum() are all R generics with strategies for TensorFlow Tensors.

In the identical vein, this Keras launch brings with it a refinement to the way in which customized class extensions to Keras are outlined. Partially impressed by the brand new R7 syntax, there’s a new household of features: new_layer_class(), new_model_class(), new_metric_class(), and so forth. This new interface considerably simplifies the quantity of boilerplate code required to outline customized Keras extensions—a pleasing R interface that serves as a facade over the mechanics of sub-classing Python lessons. This new interface is the yang to the yin of %py_class%–a solution to mime the Python class definition syntax in R. After all, the “uncooked” API of changing an R6Class() to Python through r_to_py() continues to be accessible for customers that require full management.

This launch additionally brings with it a cornucopia of small enhancements all through the Keras R interface: up to date print() and plot() strategies for fashions, enhancements to freeze_weights() and load_model_tf(), new exported utilities like zip_lists() and %<>%. And let’s not neglect to say a brand new household of R features for modifying the educational charge throughout coaching, with a set of built-in schedules like learning_rate_schedule_cosine_decay(), complemented by an interface for creating customized schedules with new_learning_rate_schedule_class().

You could find the complete launch notes for the R packages right here:

The discharge notes for the R packages inform solely half the story nonetheless. The R interfaces to Keras and TensorFlow work by embedding a full Python course of in R (through the reticulate bundle). One of many main advantages of this design is that R customers have full entry to every thing in each R and Python. In different phrases, the R interface at all times has function parity with the Python interface—something you are able to do with TensorFlow in Python, you are able to do in R simply as simply. This implies the discharge notes for the Python releases of TensorFlow are simply as related for R customers:

Thanks for studying!

Photograph by Raphael Wild on Unsplash

Reuse

Textual content and figures are licensed beneath Artistic Commons Attribution CC BY 4.0. The figures which have been reused from different sources do not fall beneath this license and will be acknowledged by a word of their caption: “Determine from …”.

Quotation

For attribution, please cite this work as

Kalinowski (2022, June 9). RStudio AI Weblog: TensorFlow and Keras 2.9. Retrieved from https://blogs.rstudio.com/tensorflow/posts/2022-06-09-tf-2-9/

BibTeX quotation

@misc{kalinowskitf29,
  creator = {Kalinowski, Tomasz},
  title = {RStudio AI Weblog: TensorFlow and Keras 2.9},
  url = {https://blogs.rstudio.com/tensorflow/posts/2022-06-09-tf-2-9/},
  yr = {2022}
}
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments

situs slot gacor provider terbaik agen toto slot terpercaya 2023 agen toto togel terpercaya 2023 situs toto togel pasaran resmi terbaik bandar toto macau pasaran resmi toto togel bandar toto slot gacor 4d 2023 bo togel online pasaran terlengkap sepanjang masa bo toto slot terlengkap sepanjang masa situs toto togel 2023 bet 100 perak daftar toto slot dan toto togel 2023 bermain toto togel dengan bet hanya 100 perak daftar toto slot bonus new member terpercaya bermain toto slot pelayanan 24 jam nonstop agen slot gacor 4d hadiah terbesar bandar toto slot provider terbaik toto slot gacor 4d hingga toto togel toto togel pasaran resmi terpercaya bo togel online terbaik 2023 agen togel online terbesar 2023 situs togel online terpercaya 2023 bo togel online paling resmi 2023 toto togel pasaran togel hongkong resmi situs slot online pasti gacor agen slot online anti rungkad bo slot online deposit tanpa potongan situs toto togel dan toto slot bonus new member situs toto slot gacor 4d bo toto slot gacor 4d bo toto slot gacor dari toto togel 4d bo toto slot 4d terpercaya bo toto slot terpercaya toto macau resmi dari toto togel 4d agen togel terbesar dan situs toto slot terpercaya bandar toto togel dan slot online 2023 bo slot gacor terbaik sepanjang masa winsortoto winsortoto bo toto togel situs toto situs toto togel terpercaya situs toto slot terpercaya situs slot gacor 4d terbaik sepanjang masa agen toto togel dan situs toto slot terpercaya situs toto togel dan agen toto slot terpercaya bandar toto togel tersedia pasaran toto macau resmi agen toto togel bet 100 perak deposit 10rb ltdtoto