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 tensorflow as tf | |
from tensorflow.contrib.tensorboard.plugins import projector | |
LOG_DIR = "your-tensorboard-log-dir-here" | |
FEATURE_VECTORS = "your-feature-vectors-as-npy" | |
MAX_NUMBER_SAMPLES = 8191 | |
METADATA_FILE = os.path.join(LOG_DIR, 'metadata.tsv') | |
CHECKPOINT_FILE = os.path.join(LOG_DIR, 'features.ckpt') | |
# Create metadata |
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 glob | |
import cv2 | |
LOG_DIR = "your-tensorboard-log-dir-here" | |
IMAGES_DIR = "your-images-dir-here" | |
IMAGE_SIZE = (64, 64) | |
SPRITES_FILE = os.path.join(LOG_DIR, "sprites.png") |
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 numpy as np | |
def create_sprite(data): | |
""" | |
Tile images into sprite image. | |
Add any necessary padding | |
""" | |
# For B&W or greyscale images | |
if len(data.shape) == 3: |
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
def train(model, train_loader, device, optimizer, log_interval, epoch, globaliter, tb): | |
""" | |
Example training function for PyTorch recording to tensorboardcolab. | |
""" | |
model.train() | |
for batch_idx, (data, target) in enumerate(train_loader): | |
globaliter += 1 | |
data, target = data.to(device), target.to(device) |
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
def train(model, train_loader, device, optimizer, log_interval, epoch, globaliter): | |
""" | |
Example training function for PyTorch recording to TensorBoard. | |
""" | |
model.train() | |
for batch_idx, (data, target) in enumerate(train_loader): | |
globaliter += 1 | |
data, target = data.to(device), target.to(device) |
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
Optimize a model with 889545 rows, 7495464 columns and 230380625 nonzeros | |
Coefficient statistics: | |
Matrix range [1e-03, 7e+02] | |
Objective range [8e-01, 1e+00] | |
Bounds range [0e+00, 0e+00] | |
RHS range [5e-01, 6e+06] | |
Concurrent LP optimizer: dual simplex and barrier | |
Showing barrier log only... |
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
"""" | |
Try to create model, variable and constraint objects. | |
Try to read the lp into a model object faster. | |
""" | |
import os | |
from profilehooks import profile, timecall | |
class Model(object): |
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 csv | |
import pres_builder as pb | |
# Indicates whether prescription set A or B | |
# is to be generated, in the case a prescription | |
# set will be generated. | |
global model_type | |
model_type = 'B' |
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 camelot.view.art import Icon | |
from camelot.admin.application_admin import ApplicationAdmin | |
from camelot.admin.section import Section | |
from camelot.core.utils import ugettext_lazy as _ | |
class MyApplicationAdmin(ApplicationAdmin): | |
name = 'Videostore' | |
application_url = 'http://www.python-camelot.com' |