This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env/ | |
__pycache__/ | |
*-app.py | |
*_files/ | |
*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(keras) | |
library(reticulate) | |
layer_multiplicative_lstm <-function( | |
object, units, activation = "tanh", recurrent_activation = "hard_sigmoid", use_bias = TRUE, | |
return_sequences = FALSE, return_state = FALSE, go_backwards = FALSE, stateful = FALSE, unroll = FALSE, | |
kernel_initializer = "glorot_uniform", recurrent_initializer = "orthogonal", bias_initializer = "zeros", | |
unit_forget_bias = TRUE, kernel_regularizer = NULL, recurrent_regularizer = NULL, bias_regularizer = NULL, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.models import Model | |
from keras import layers | |
from keras import Input | |
text_vocabulary_size = 10000 | |
question_vocabulary_size = 10000 | |
answer_vocabulary_size = 500 | |
text_input = Input(shape=(None,), dtype='int32', name='text') | |
embedded_text = layers.Embedding( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''Train MNIST with tfrecords yielded from a TF Dataset | |
In order to run this example you should first run 'mnist_to_tfrecord.py' | |
which will download MNIST data and serialize it into 3 tfrecords files | |
(train.tfrecords, validation.tfrecords, and test.tfrecords). | |
This example demonstrates the use of TF Datasets wrapped by a generator | |
function. The example currently only works with a fork of keras that accepts | |
`workers=0` as an argument to fit_generator, etc. Passing `workers=0` results | |
in the generator function being run on the main thread (without this various |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Untitled" | |
output: | |
revealjs::revealjs_presentation: | |
css: styles.css | |
--- | |
## R Markdown | |
This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Untitled" | |
output: revealjs::revealjs_presentation | |
--- | |
## R Markdown | |
This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>. | |
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Rcpp.h> | |
using namespace Rcpp; | |
// [[Rcpp::export]] | |
CharacterVector asUTF8(CharacterVector x) { | |
const void *vmax = vmaxget(); | |
CharacterVector xUTF8(x.length()); | |
for (int i = 0; i<x.length(); i++) { | |
const char* utf8 = Rf_translateCharUTF8(x[i]); | |
xUTF8[i] = Rf_mkCharCE(utf8, CE_UTF8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Rcpp.h> | |
using namespace Rcpp; | |
void finalizeInt(int* ptr) { | |
// do nothing | |
} | |
typedef XPtr<int,PreserveStorage,finalizeInt> XPtrInt; | |
// [[Rcpp::export]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Rcpp.h> | |
using namespace Rcpp; | |
// [[Rcpp::depends(BH)]] | |
#include <boost/bind.hpp> | |
#include <boost/function.hpp> | |
typedef boost::function<int(int,int)> Combiner; | |
int add(int x, int y) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Rcpp.h> | |
using namespace Rcpp; | |
using namespace Rcpp; | |
class Uniform { | |
public: | |
Uniform(double min_, double max_) : min(min_), max(max_) {} | |
NumericVector draw(int n) const { | |
RNGScope scope; | |
return runif( n, min, max ); |
NewerOlder