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 import layers, models | |
from keras.callbacks import ReduceLROnPlateau | |
from keras.preprocessing.image import ImageDataGenerator | |
from sklearn.model_selection import train_test_split | |
import time | |
import random | |
# load data | |
train_data = pd.read_csv("/kaggle/input/digit-recognizer/train.csv") |
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 import layers, models | |
from keras.callbacks import ReduceLROnPlateau | |
from keras.preprocessing.image import ImageDataGenerator | |
from sklearn.model_selection import train_test_split | |
# Install Gpyopt | |
!pip install GPyOpt | |
import GPy, GPyOpt |
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 keras.preprocessing.image import ImageDataGenerator | |
def image_data_generator(): | |
return ImageDataGenerator(rotation_range=30, | |
width_shift_range=0.20, | |
height_shift_range=0.20, | |
shear_range=0.2, | |
zoom_range=0.2, | |
fill_mode='nearest') |
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 keras.callbacks import ModelCheckpoint, ReduceLROnPlateau | |
model_checkpoint_callback = ModelCheckpoint(filepath=os.path.join("./weights/", "model-{epoch:02d}-{val_loss:.4f}.hdf5"), | |
monitor='val_loss', | |
mode='min', | |
save_best_only=True) | |
reduce_lr_callback = ReduceLROnPlateau(monitor='val_loss', | |
factor=0.47, | |
patience=5, |
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 import layers, models | |
model = models.Sequential() | |
model.add(layers.Conv2D(128, (7, 7), activation='relu', padding='same', input_shape=(28, 28, 1))) | |
model.add(layers.Dropout(0.4)) | |
model.add(layers.MaxPooling2D((2, 2))) | |
model.add(layers.Conv2D(256, (3, 3), activation='relu')) | |
model.add(layers.Dropout(0.4)) |
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
print("Hello, World!") |