0% found this document useful (0 votes)
11 views1 page

ML Code

The document outlines a process for cloning a GitHub repository and setting up a deep learning model using TensorFlow. It includes steps for preparing image data generators for training and testing datasets, defining a simple neural network model, compiling it, and training the model for five epochs. Finally, it displays the model summary after training.

Uploaded by

mpplat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

ML Code

The document outlines a process for cloning a GitHub repository and setting up a deep learning model using TensorFlow. It includes steps for preparing image data generators for training and testing datasets, defining a simple neural network model, compiling it, and training the model for five epochs. Finally, it displays the model summary after training.

Uploaded by

mpplat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

!git clone [Link]

com/cbtn-data-science-ml/introduction-to-deep-
[Link]

import os

%pwd

[Link]('introduction-to-deep-learning')

%pwd

import tensorflow as tf
from [Link] import ImageDataGenerator

# Reproduceable random
[Link].set_seed(42)

# Data Gens
train_datagen = ImageDataGenerator(rescale=1./255)
test_datagen = ImageDataGenerator(rescale=1./255)

# Train data generators


train_generator = train_datagen.flow_from_directory(
'ramen_sushi/train/', # path to train data
target_size=(200,200),
batch_size=32,
class_mode='binary',
seed=42
)

test_generator = test_datagen.flow_from_directory(
'ramen_sushi/test/', # path to train data
target_size=(200,200),
batch_size=32,
class_mode='binary',
seed=42
)

# Define model
model = [Link]([
[Link](input_shape=(200,200, 3)),
[Link](32, activation='relu'),
[Link](1, activation='sigmoid')
])

# Compile model
[Link](optimizer='adam',
loss='binary_crossentropy',
metrics=['accuracy'])

# Train model
history = [Link](train_generator, epochs=5)

[Link]()

You might also like