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 torch | |
import torch.nn as nn | |
import torch.optim as optim | |
import torch.nn.functional as F | |
import torchvision | |
import torchvision.transforms as transforms | |
from torchvision.utils import save_image | |
from torchvision.datasets import MNIST, FashionMNIST, CIFAR10, STL10 | |
import os | |
import pickle |
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
# https://mail.python.org/pipermail/scipy-user/2011-May/029521.html | |
import numpy as np | |
def KLdivergence(x, y): | |
"""Compute the Kullback-Leibler divergence between two multivariate samples. | |
Parameters | |
---------- | |
x : 2D array (n,d) |
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 matplotlib.pyplot as plt | |
import pickle | |
from keras.layers import Input, Conv2D, Activation, MaxPool2D, BatchNormalization, Flatten, Dense, Dropout | |
from keras.models import Model | |
from keras.optimizers import Adam | |
from keras.utils import to_categorical | |
from keras.datasets import cifar10 | |
from keras.preprocessing.image import ImageDataGenerator | |
(X_train, y_train), (X_val, y_val) = cifar10.load_data() |
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 torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
from torch.utils.data import DataLoader | |
import torchvision | |
import torchmetrics | |
import pytorch_lightning as pl | |
class TenLayersModel(pl.LightningModule): | |
def __init__(self): |
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 torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
from torch.utils.data import DataLoader | |
import torchvision | |
import torchmetrics | |
import pytorch_lightning as pl | |
import time | |
class ResNet50(pl.LightningModule): |
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.keras.layers import Conv2D, BatchNormalization, Activation, Input, Concatenate, MaxPool2D, Conv2DTranspose, Add | |
from tensorflow.keras.models import Model | |
from tensorflow.keras.callbacks import Callback, History | |
import tensorflow.keras.backend as K | |
from keras.objectives import mean_squared_error | |
import os, tarfile, shutil, pickle | |
from PIL import Image |
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 | |
import matplotlib.pyplot as plt | |
from mpl_toolkits.mplot3d import Axes3D | |
from matplotlib import cm | |
# 単回帰分析 # | |
# データ | |
X = np.array([6.1101,5.5277,8.5186,7.0032,5.8598,8.3829,7.4764,8.5781,6.4862,5.0546,5.7107,14.164,5.734,8.4084,5.6407,5.3794,6.3654,5.1301,6.4296,7.0708,6.1891,20.27,5.4901,6.3261,5.5649,18.945,12.828,10.957,13.176,22.203,5.2524,6.5894,9.2482,5.8918,8.2111,7.9334,8.0959,5.6063,12.836,6.3534,5.4069,6.8825,11.708,5.7737,7.8247,7.0931,5.0702,5.8014,11.7,5.5416,7.5402,5.3077,7.4239,7.6031,6.3328,6.3589,6.2742,5.6397,9.3102,9.4536,8.8254,5.1793,21.279,14.908,18.959,7.2182,8.2951,10.236,5.4994,20.341,10.136,7.3345,6.0062,7.2259,5.0269,6.5479,7.5386,5.0365,10.274,5.1077,5.7292,5.1884,6.3557,9.7687,6.5159,8.5172,9.1802,6.002,5.5204,5.0594,5.7077,7.6366,5.8707,5.3054,8.2934,13.394,5.4369]) |
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.keras.applications import InceptionV3, VGG16, MobileNet | |
from tensorflow.keras.layers import GlobalAveragePooling2D, Dense | |
from tensorflow.keras.models import Model | |
from tensorflow.keras.callbacks import History, Callback | |
import tensorflow.keras.backend as K | |
from tensorflow.contrib.tpu.python.tpu import keras_support | |
from keras.utils import to_categorical | |
from keras.datasets import cifar10 |
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 torch | |
from torch import nn | |
import torchvision | |
import torchvision.transforms as transforms | |
import numpy as np | |
from tqdm import tqdm | |
import os | |
import pickle | |
import statistics |
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 | |
import tensorflow.python.keras as keras | |
import tensorflow.python.keras.layers as layers | |
from tensorflow.contrib.tpu.python.tpu import keras_support | |
import datetime | |
import time | |
import pickle | |
import os | |
def conv_bn_relu(input, ch, reps): |
NewerOlder