Scenario
Program turnstile that controls the operation of a subway turnstile ( gate that you have to walk through before you get to the subway train)
(function(){ | |
angular.module('app', []) | |
.config(['$httpProvider', function($httpProvider) { | |
$httpProvider.interceptors.push(['$q', '$window', '$timeout', '$injector', function ($q, $window, $timeout, $injector) { | |
var $login, $http, $auth; | |
$timeout(function () { | |
$login = $injector.get('$login'); | |
$http = $injector.get('$http'); | |
$auth = $injector.get('$auth'); |
import numpy as np | |
from keras import backend as K | |
from keras.preprocessing.image import Iterator, load_img, img_to_array | |
class FileListIterator(Iterator): | |
"""Iterator capable of reading images from an array of the filenames. | |
# Arguments | |
filenames: Path to the directory to read images from. | |
Each subdirectory in this directory will be | |
considered to contain images from one class, |
def find_learning_rate(model, data_loader, criterion, lr:tuple=(1e-7, 1), epochs:int=1): | |
history = [] | |
min_lr, max_lr = lr | |
num_batches = epochs * len(data_loader) | |
last_avg_loss, i, beta = 0, 0, 0.98 | |
# preserve initial state | |
initial_weights = './temp.model' | |
torch.save(model.state_dict(), initial_weights) |
class LearningRateFinder(Callback): | |
''' | |
This callback implements a learning rate finder(LRF) | |
The learning rate is constantly increased during training. | |
On training end, the training loss is plotted against the learning rate. | |
One may choose a learning rate for a model based on the given graph, | |
selecting a value slightly before the minimal training loss. | |
# Example | |
lrf = LearningRateFinder([0.0001, 0.0005, 0.001, 0.005, 0.01, 0.05]) | |
model.fit(x_train, y_train, epochs=1, batch_size=128, callbacks=[lrf]) |
Program turnstile that controls the operation of a subway turnstile ( gate that you have to walk through before you get to the subway train)
Your task is to implement a simplified version of text editor.
All operations that should be supported are listed below. Partial credit will be given for each implemented operation. Please submit often to ensure partial credits are captured.
Implement operations and provided steps one by one, and not all together, keeping in mind that you will need to make refactors to support each additional step. In the first three levels you can assume that only one text document is modified.
// Much of the Node.js core API is built around an idiomatic asynchronous event-driven architecture | |
// in which certain kinds of objects (called "emitters") emit named events that cause | |
// Function objects ("listeners") to be called. | |
Class: EventEmitter | |
// Synchronously calls each of the listeners registered for the event named eventName, | |
// in the order they were registered, passing the supplied arguments to each. | |
emit(eventName[, ...args]) | |
// Removes the specified listener from the listener array for the event named eventName. |