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 keras | |
| from keras.datasets import mnist | |
| from keras.layers import Input, Dense | |
| from keras.models import load_model | |
| from skimage.util import invert | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| (X_train, y_train), (X_test, y_test) = mnist.load_data() |
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 os | |
| import pandas as pd | |
| import mysql.connector | |
| from sqlalchemy import create_engine | |
| # ====== Connection ====== # | |
| # Connecting to mysql by providing a sqlachemy engine | |
| engine = create_engine('mysql+mysqlconnector://myhu:password@192.168.68.102/dbname', echo=True) |
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 keras.datasets import mnist | |
| from keras.layers import Input, Dense | |
| from keras.models import Model | |
| import numpy as np | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| (X_train, _), (X_test, _) = mnist.load_data() | |
| X_train = X_train.astype('float32')/255 | |
| X_test = X_test.astype('float32')/255 |
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 __future__ import absolute_import, division, print_function, unicode_literals | |
| import tensorflow as tf | |
| import numpy as np | |
| from tensorflow import keras | |
| from tensorflow.keras import layers | |
| inputs = keras.Input(shape=(784,), name='digits') |
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 keras.models import Sequential | |
| from keras.layers.core import Dense, Dropout, Activation | |
| from keras import losses | |
| import numpy as np | |
| X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]]) | |
| y = np.array([[0], [1], [1], [0]]) | |
| model = Sequential() |
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
| def binary_data(n): | |
| b = [] | |
| for i in range(1 << n): | |
| s = bin(i)[2:] | |
| s = '0' * (n - len(s)) + s | |
| b.append(map(int, list(s))) | |
| return b |
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 sys | |
| import numpy | |
| import os | |
| os.environ['KMP_DUPLICATE_LIB_OK'] = 'True' | |
| numpy.set_printoptions(threshold=sys.maxsize) | |
| import torch | |
| from torch.distributions import normal | |
| import seaborn as sns; |
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 tensorflow as tf | |
| import os | |
| os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' | |
| mnist = tf.keras.datasets.mnist | |
| (x_train, y_train),(x_test, y_test) = mnist.load_data() |
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 mpl_toolkits.mplot3d import Axes3D | |
| import matplotlib.pyplot as plt | |
| from matplotlib import cm | |
| from matplotlib.ticker import LinearLocator, FormatStrFormatter | |
| import numpy as np | |
| from scipy.stats import norm | |
| fig = plt.figure() | |
| ax = fig.gca(projection='3d') |
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 mpl_toolkits.mplot3d import Axes3D | |
| import matplotlib.pyplot as plt | |
| from matplotlib import cm | |
| from matplotlib.ticker import LinearLocator, FormatStrFormatter | |
| import numpy as np | |
| from scipy.stats import norm | |
| fig = plt.figure() | |
| ax = fig.gca(projection='3d') |