poetry new <project-name>potry add <library>| version: '3' | |
| services: | |
| influxdb: | |
| image: 'influxdb:latest' | |
| container_name: influxDB | |
| networks: | |
| - tick-network | |
| volumes: | |
| - '/home/tick/influxdb/data:/var/lib/influxdb' | |
| - '/home/tick/influxdb/config/:/etc/influxdb/' |
| #!/bin/sh | |
| if [ "$PYENV_VERSION" -ne "" ] | |
| then | |
| name=`pyenv version-name` | |
| python=`pyenv which python` | |
| else | |
| name=`basename "$VIRTUAL_ENV"` | |
| python="$VIRTUALENV/bin/python" | |
| fi |
| def make_weights_for_balanced_classes(images, nclasses): | |
| count = [0] * nclasses | |
| for item in images: | |
| count[item[1]] += 1 | |
| weight_per_class = [0.] * nclasses | |
| N = float(sum(count)) | |
| for i in range(nclasses): | |
| weight_per_class[i] = N/float(count[i]) | |
| weight = [0] * len(images) | |
| for idx, val in enumerate(images): |
| { | |
| 0: "tench, Tinca tinca", | |
| 1: "goldfish, Carassius auratus", | |
| 2: "great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias", | |
| 3: "tiger shark, Galeocerdo cuvieri", | |
| 4: "hammerhead, hammerhead shark", | |
| 5: "electric ray, crampfish, numbfish, torpedo", | |
| 6: "stingray", | |
| 7: "cock", | |
| 8: "hen", |
| class ImagesDataset(torch.utils.data.Dataset): | |
| pass | |
| class Net(nn.Module): | |
| pass | |
| model = Net() | |
| optimizer = torch.optim.SGD(model.parameters(), lr=0.01) | |
| scheduler = lr_scheduler.StepLR(optimizer, step_size=30, gamma=0.1) | |
| criterion = torch.nn.MSELoss() |
| import torch | |
| import torchvision as tv | |
| class ImagesDataset(torch.utils.data.Dataset): | |
| def __init__(self, df, transform=None, | |
| loader=tv.datasets.folder.default_loader): | |
| self.df = df | |
| self.transform = transform | |
| self.loader = loader |
While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.
Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.
lib/ is intended for code that can run as-issrc/ is intended for code that needs to be manipulated before it can be used| import numpy as np | |
| import tensorflow as tf | |
| from keras.callbacks import TensorBoard | |
| from keras.layers import Input, Dense | |
| from keras.models import Model | |
| def write_log(callback, names, logs, batch_no): | |
| for name, value in zip(names, logs): | |
| summary = tf.Summary() |