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
## Parameters | |
batch_sze = 4 | |
enc_layers = 4 | |
enc_timesteps = 120 | |
dec_timesteps = 30 | |
min_lr=0.01, # min learning rate. | |
lr=0.15, # learning rate | |
min_input_len = 2 | |
num_hidden = 256 |
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
// Consider an object having a num property | |
var obj = {num:2}; | |
// Note the use of this in the function | |
var addToThis = function(a,b,c){ | |
return this.num + a+b+c; | |
}; | |
// call is used to call a function on an object with the arguments passed along | |
var result = addToThis.call(obj,4,3,4); // functioname.call(object_to_be_called, arguments_to_function) |
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
var addTo = function(passed){ | |
var inner=2; | |
return passed+inner; | |
}; | |
console.log(addTo(3)); // 5 |
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
var x = new Object(); // empty object in js | |
var y= {} ; // another way of creating empty object | |
// Adding properties to our empty object | |
y.name="Tim"; | |
y.age=20; | |
y.getName= function(){ | |
return this.name; | |
}; |
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
/* | |
This gist covers creating a subclass from a baseclas, overriding in the prototype chain, and adding properties | |
to the master Object prototype | |
*/ | |
// baseclass | |
var Job = function() { | |
this.pays = true; | |
}; |
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
Array.prototype.reduce = function(combiner, initialValue) { | |
var counter, accumulatedValue; | |
// If the array to be reduced is empty, then do nothing | |
if (this.length === 0) { | |
return this; //this refers to the Array being reduced | |
} else { | |
/* | |
If the user did not pass an initialValue, that is if the number of arguments passed to the reduce function is just 1, | |
then use the first item from the array as the accumulatedValue to begin with |
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
Array.prototype.map = function(projectionFunction) { | |
var results = []; | |
this.forEach(function(itemInArray) { | |
/* | |
projectionFunction is applied to each element of the array, which returns the modified value of that element | |
*/ | |
results.push(projectionFunction(itemInArray)); | |
}); |
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
import multiprocessing | |
from gensim.corpora.wikicorpus import WikiCorpus | |
from gensim.models.word2vec import Word2Vec | |
from gensim.models import TfidfModel | |
# logging is important to get the state of the functions | |
import logging | |
logging.basicConfig(format='%(asctime)s: %(levelname)s: %(message)s') | |
logging.root.setLevel(level=logging.INFO) |
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
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
## Created by: Hang Zhang, Rutgers University, Email: zhang.hang@rutgers.edu | |
## Modified by Thomas Wolf, HuggingFace Inc., Email: thomas@huggingface.co | |
## Copyright (c) 2017-2018 | |
## | |
## This source code is licensed under the MIT-style license found in the | |
## LICENSE file in the root directory of this source tree | |
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
"""Encoding Data Parallel""" |
OlderNewer