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 os | |
import cloudpickle | |
import multiprocessing as mp | |
class RunAsCUDASubprocess: | |
def __init__(self, num_gpus=0, memory_fraction=0.8): | |
self._num_gpus = num_gpus | |
self._memory_fraction = memory_fraction | |
@staticmethod |
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
module.exports = class BaseCtrl | |
@register: (module, name) -> | |
name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1] | |
module.controller name, @ | |
@inject: (annotations...) -> | |
ANNOTATION_REG = /^(\S+)(\s+as\s+(\w+))?$/ | |
@annotations = annotations.map (annotation) -> |
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
// Viterbi algorithm for finding hidden relationships | |
function Viterbi(data) { | |
var V = [{}]; | |
var path = {}; | |
// Initialize base cases (t == 0) | |
for(var i=0;i<data.states.length;i++) { | |
var state = data.states[i]; | |
V[0][state] = data.start_probability[state] * data.emission_probability[state][data.observations[0]]; | |
path[state] = [state]; |