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
document.querySelectorAll("a").forEach(link=>link.setAttribute("target", "_blank")) |
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
# Datasetimizi parçalayarak test datası oluşturacağız. | |
# Datamızın 1/3 ünü test datası olarak oluşturuyoruz | |
# Yani 30 satırımızın 20 si train datası olarak ayrılacak | |
# Ve 10 satırımız da test datası olucak. | |
X_train, X_test, y_train, y_test = train_test_split(x, y, test_size = 1/3, random_state = 123, shuffle=1) |
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
history = model.fit(X_train, y_train, validation_split=0.1, epochs=10, batch_size=200, | |
verbose=1, shuffle=1) |
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 requests | |
from PIL import Image | |
url = 'https://www.researchgate.net/profile/Jose_Sempere/publication/221258631/figure/fig1/AS:305526891139075@1449854695342/Handwritten-digit-2.png' | |
response = requests.get(url, stream = True) | |
img = Image.open(response.raw) | |
plt.imshow(img) |
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
assert(X_train.shape[0] == y_train.shape[0]), "The number of images is not equal .." | |
assert(X_test.shape[0] == y_test.shape[0]), "The number of images is not equal .." | |
assert(X_train.shape[1:] == (28, 28)), "The dimension of the images are not 28x28" | |
assert(X_test.shape[1:] == (28, 28)), "The dimension of the images are not 28x28" |
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
num_of_samples = [] | |
cols = 5 #We will select 5 random images | |
num_of_classes = 10 #each digit total: 10 | |
fig, axs = plt.subplots(nrows=num_of_classes, ncols=cols, | |
figsize=(5, 10)) | |
fig.tight_layout() | |
for i in range(cols): | |
for j in range(num_of_classes): |
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
def create_model(): | |
model = Sequential() | |
model.add(Dense(10, input_dim = num_pixels, #num_pixels: 784 | |
activation = 'relu')) | |
model.add(Dense(30, activation='relu')) | |
model.add(Dense(10, activation='relu')) | |
model.add(Dense(num_of_classes, activation='softmax')) | |
model.compile(Adam(lr=0.01), #lr: learning rate | |
loss='categorical_crossentropy', #loss function | |
metrics=['accuracy']) |
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
def create_model(): | |
model = Sequential() | |
model.add(Dense(10, input_dim = num_pixels, #num_pixels: 784 | |
activation = 'relu')) | |
model.add(Dense(30, activation='relu')) | |
model.add(Dense(10, activation='relu')) | |
model.add(Dense(num_of_classes, activation='softmax')) | |
model.compile(Adam(lr=0.01), #lr: learning rate | |
loss='categorical_crossentropy', #loss function | |
metrics=['accuracy']) |