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 tensorflow.examples.tutorials.mnist import input_data | |
mnist = input_data.read_data_sets('mnist/', one_hot=True) | |
X_train = mnist.train.images | |
y_train = mnist.train.labels | |
X_test = mnist.test.images | |
y_test = mnist.test.labels |
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 pandas as pd | |
import numpy as np | |
base = pd.read_csv('census.csv') | |
# Transforming 'income' into 0 or 1 | |
income = pd.get_dummies(base['income'], drop_first=True) | |
base.drop('income', axis=1, inplace=True) |
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 tensorflow.examples.tutorials.mnist import input_data | |
import numpy as np | |
mnist = input_data.read_data_sets('mnist/', one_hot=False) | |
X_train = mnist.train.images | |
y_train = mnist.train.labels | |
X_test = mnist.test.images | |
y_test = mnist.test.labels |
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 sklearn import datasets | |
iris = datasets.load_iris() | |
X = iris.data | |
y = iris.target | |
from sklearn.preprocessing import StandardScaler | |
scaler_x = StandardScaler() |
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 warnings | |
warnings.filterwarnings('ignore') | |
import pandas as pd | |
import numpy as np | |
from tensorflow.python.keras import backend as K | |
from tensorflow.python.keras.models import Sequential | |
from tensorflow.python.keras.layers import InputLayer, Input | |
from tensorflow.python.keras.layers import Reshape, MaxPooling2D | |
from tensorflow.python.keras.layers import Conv2D, Dense, Flatten, Dropout |
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 warnings import filterwarnings | |
filterwarnings('ignore') | |
import pandas as pd | |
import numpy as np | |
from lightgbm import LGBMClassifier | |
from sklearn.preprocessing import MinMaxScaler | |
from sklearn.model_selection import train_test_split | |
from sklearn.metrics import roc_auc_score |
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 matplotlib.pyplot as plt | |
from tensorflow.examples.tutorials.mnist import input_data | |
import numpy as np | |
tf.reset_default_graph() | |
mnist = input_data.read_data_sets('mnist/', one_hot=True) | |
# Test |
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 tensorflow.examples.tutorials.mnist import input_data | |
import matplotlib.pyplot as plt | |
import tensorflow as tf | |
import numpy as np | |
mnist = input_data.read_data_sets('mnist/', one_hot=True) | |
X = mnist.train.images | |
# 784 -> 128 -> 64 -> 128 -> 784 |
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.python.framework import ops | |
from tensorflow.python.ops import gen_nn_ops | |
@ops.RegisterGradient("GuidedRelu") | |
def _GuidedReluGrad(op, grad): | |
return tf.select(0. < grad, gen_nn_ops._relu_grad(grad, op.outputs[0]), tf.zeros(grad.get_shape())) | |
if __name__ == '__main__': | |
with tf.Session() as sess: |
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_addons as tfa | |
import tensorflow as tf | |
def get_norm_layer(norm): | |
"""Utility function to get the normalization layer | |
""" | |
if norm == None: | |
return lambda: lambda x: x | |
elif norm == 'batch_norm': |
OlderNewer