Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 https://gist.github.com/shivakar/82ac5c9cb17c95500db1906600e5e1ea""" | |
| import os | |
| from SimpleHTTPServer import SimpleHTTPRequestHandler | |
| import sys | |
| import BaseHTTPServer | |
| class RangeHTTPRequestHandler(SimpleHTTPRequestHandler): | |
| """RangeHTTPRequestHandler is a SimpleHTTPRequestHandler |
This file contains hidden or 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 rl.callbacks import TrainIntervalLogger | |
| from tqdm import tqdm_notebook | |
| import timeit | |
| class TrainIntervalLoggerTQDMNotebook(TrainIntervalLogger): | |
| """TrainIntervalLogger using tqdm_notebook for jupyter-notebook.""" | |
| def reset(self): | |
| self.interval_start = timeit.default_timer() | |
| self.metrics = [] | |
| self.infos = [] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 rl.callbacks import Callback | |
| from rl.callbacks import TrainIntervalLogger | |
| from keras import backend as K | |
| import warnings | |
| from tqdm import tqdm_notebook | |
| import timeit | |
| import numpy as np | |
| class TrainIntervalLoggerTQDMNotebook(TrainIntervalLogger): | |
| """TrainIntervalLogger for keras-rl using tqdm_notebook for jupyter-notebook.""" |
This file contains hidden or 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 numpy as np | |
| from matplotlib import pyplot as plt | |
| def subimshow(image, title=''): | |
| """ | |
| Show each band seperately. | |
| The shape si a square or rectangle of images | |
| image: array of shape (channel, height, width) | |
This file contains hidden or 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
| # summarize model | |
| from collections import OrderedDict | |
| import pandas as pd | |
| import torch | |
| from torch import nn | |
| from torch.autograd import Variable | |
| class TorchSummarizeDf(object): | |
| def __init__(self, model, weights=False, input_shape=True, nb_trainable=False, debug=False): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.