Git Product home page Git Product logo

cntk-r's Introduction

R Interface to the Microsoft Cognitive Toolkit

Please take a look at the package website microsoft.github.io/CNTK-R for complete documentation.

CNTK-R is an R package for CNTK, which uses the reticulate package to bind to CNTK's Python API. Since it binds directly to Python, the R interface can perform any operation the Python bindings can, including running on the GPU. See the CIFAR-10 image classification vignette to see a basic example of training and evaluation of image classification on the CIFAR-10 dataset.

Installation

To use CNTK with R you'll need to have the appropriate Python wheel for your system already installed. See CNTK's documentation for help setting up CNTK's Python wheel on your system.

Then run the following to install CNTK's R package:

devtools::install_github("Microsoft/CNTK-R")

You can also take a look at our article on setting up CNTK and CNTK-R on your machine.

Usage

Documentation is still a work in progress, but the R package closely follows the CNTK Python interface where possible (Python docs). Here's the basic rundown of the differences:

  1. Properties are the same as in Python, and are accessed using the dollar sign ($) syntax:

    l <- Learner(parameters, lrschedule)
    l$parameters # returns parameters associated with learner
  2. Class methods are made global, and take the class object as the first property:

    learner.update(...) # Python
    update_learner(learner, ...) # R equivalent
    learner %>% update_learner(...) # R equivalent via pipe

    Since class methods are made global, some renaming from the original python API was necessary to avoid conflicts. See the documentation for a list of all available functions.

  3. R matrices are automatically converted to and from NumPy array's with float32 dtype.

  4. Python enums are accessed via function argument, e.g.:

    UnitType.Error # Python
    UnitType("Error") # R equivalent

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.