{"id":8989,"date":"2024-07-01T13:43:23","date_gmt":"2024-07-01T13:43:23","guid":{"rendered":"https:\/\/educationhopeacademy.org\/posit-ai-blog-tensorflow-and-keras-2-9\/"},"modified":"2024-07-04T13:51:17","modified_gmt":"2024-07-04T13:51:17","slug":"posit-ai-weblog-tensorflow-and-keras-2-9","status":"publish","type":"post","link":"https:\/\/educationhopeacademy.org\/posit-ai-weblog-tensorflow-and-keras-2-9\/","title":{"rendered":"Posit AI Weblog: TensorFlow and Keras 2.9"},"content":{"rendered":"\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t

[ad_1]<\/p>

The discharge of Deep Studying with R, 2nd
Version<\/em><\/a> coincides with new releases of
TensorFlow and Keras. These releases convey many refinements that permit
for extra idiomatic and concise R code.<\/p>

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 in depth:<\/p>

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

Which means that usually you possibly can write the identical code for TensorFlow Tensors
as you’ll for R arrays. For instance, contemplate this small operate
from Chapter 11 of the e book:<\/p>

reweight_distribution<\/span> <-<\/span>\n  operate<\/span>(<\/span>original_distribution<\/span>, temperature<\/span> =<\/span> 0.5<\/span>)<\/span> {<\/span>\n    original_distribution<\/span> %>%<\/span>\n      {<\/span> exp<\/a><\/span>(<\/span>log<\/a><\/span>(<\/span>.<\/span>)<\/span> \/<\/span> temperature<\/span>)<\/span> }<\/span> %>%<\/span>\n      {<\/span> .<\/span> \/<\/span> sum<\/a><\/span>(<\/span>.<\/span>)<\/span> }<\/span>\n  }<\/span><\/code><\/pre><\/div><\/div>

Be aware that capabilities like reweight_distribution()<\/code> work with each 1D R
vectors and 1D TensorFlow Tensors, since exp()<\/code>, log()<\/code>, \/<\/code>, and
sum()<\/code> are all R generics with strategies for TensorFlow Tensors.<\/p>

In the identical vein, this Keras launch brings with it a refinement to the
method customized class extensions to Keras are outlined. Partially impressed by
the brand new
R7<\/code><\/a> syntax, there’s a
new household of capabilities: new_layer_class()<\/code>, new_model_class()<\/code>,
new_metric_class()<\/code>, and so forth. This new interface considerably
simplifies the quantity of boilerplate code required to outline customized
Keras extensions\u2014a pleasing R interface that serves as a facade over
the mechanics of sub-classing Python courses. This new interface is the
yang to the yin of %py_class%<\/code>\u2013a strategy to mime the Python class
definition syntax in R. In fact, the \u201cuncooked\u201d API of changing an
R6Class()<\/code> to Python by way of r_to_py()<\/code> remains to be accessible for customers that
require full management.<\/p>

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

You’ll find the total launch notes for the R packages right here:<\/p>

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 (by way of the
reticulate<\/code><\/a> bundle). One in all
the foremost advantages of this design is that R customers have full entry to
every thing in each R and<\/em> Python. In different phrases, the R interface
all the time has function parity with the Python interface\u2014something you possibly can
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:<\/p>

Thanks for studying!<\/p>

Photograph by Raphael
Wild<\/a>
on
Unsplash<\/a><\/p>

<\/p>

Get pleasure from this weblog? Get notified of latest posts by e-mail:<\/p>

Posts additionally accessible at r-bloggers<\/a><\/p><\/div><\/div>

<\/p><\/div>

Reuse<\/h3>

Textual content and figures are licensed below Inventive Commons Attribution CC BY 4.0<\/a>. The figures which were reused from different sources do not fall below this license and may be acknowledged by a be aware of their caption: “Determine from …”.<\/p>

Quotation<\/h3>

For attribution, please cite this work as<\/p>

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

BibTeX quotation<\/p>

@misc{kalinowskitf29,\n  creator = {Kalinowski, Tomasz},\n  title = {Posit AI Weblog: TensorFlow and Keras 2.9},\n  url = {https:\/\/blogs.rstudio.com\/tensorflow\/posts\/2022-06-09-tf-2-9\/},\n  yr = {2022}\n}<\/pre><\/div>


[ad_2]<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"

[ad_1] The discharge of Deep Studying with R, 2ndVersion coincides with new releases ofTensorFlow and Keras. These releases convey many refinements that permitfor extra idiomatic and concise R code. First, the set of Tensor strategies for base R generics has drasticallyexpanded. The set of R generics that work with TensorFlow Tensors is nowfairly in depth: […]<\/p>\n","protected":false},"author":1,"featured_media":8991,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[8],"tags":[27,2639,26,3395],"class_list":{"0":"post-8989","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-ai","8":"tag-blog","9":"tag-keras","10":"tag-posit","11":"tag-tensorflow"},"_links":{"self":[{"href":"https:\/\/educationhopeacademy.org\/wp-json\/wp\/v2\/posts\/8989","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/educationhopeacademy.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/educationhopeacademy.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/educationhopeacademy.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/educationhopeacademy.org\/wp-json\/wp\/v2\/comments?post=8989"}],"version-history":[{"count":4,"href":"https:\/\/educationhopeacademy.org\/wp-json\/wp\/v2\/posts\/8989\/revisions"}],"predecessor-version":[{"id":9573,"href":"https:\/\/educationhopeacademy.org\/wp-json\/wp\/v2\/posts\/8989\/revisions\/9573"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/educationhopeacademy.org\/wp-json\/wp\/v2\/media\/8991"}],"wp:attachment":[{"href":"https:\/\/educationhopeacademy.org\/wp-json\/wp\/v2\/media?parent=8989"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/educationhopeacademy.org\/wp-json\/wp\/v2\/categories?post=8989"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/educationhopeacademy.org\/wp-json\/wp\/v2\/tags?post=8989"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}