Бінарна класифікація

Вступ до Deep Learning з Keras

Miguel Esteban

Data Scientist & Founder

Коли застосовувати бінарну класифікацію?

Вступ до Deep Learning з Keras

Наш набір даних

Вступ до Deep Learning з Keras

Парні графіки (pairplot)

import seaborn as sns

# Plot a pairplot
sns.pairplot(circles, hue="target")

Вступ до Deep Learning з Keras

Вступ до Deep Learning з Keras

Вступ до Deep Learning з Keras

Вступ до Deep Learning з Keras

Вступ до Deep Learning з Keras

Вступ до Deep Learning з Keras

Функція sigmoid

Вступ до Deep Learning з Keras

Створімо модель

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense

# Instantiate a sequential model model = Sequential()

Вступ до Deep Learning з Keras

Створімо модель

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense

# Instantiate a sequential model model = Sequential()
# Add input and hidden layer model.add(Dense(4, input_shape=(2,), activation='tanh'))

Вступ до Deep Learning з Keras

Створімо модель

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense

# Instantiate a sequential model model = Sequential()
# Add input and hidden layer model.add(Dense(4, input_shape=(2,), activation='tanh'))
# Add output layer, use sigmoid model.add(Dense(1, activation='sigmoid'))

Вступ до Deep Learning з Keras

Компіляція, навчання, передбачення

# Compile model
model.compile(optimizer='sgd',
              loss='binary_crossentropy')

# Train model model.train(coordinates, labels, epochs=20)
# Predict with trained model preds = model.predict(coordinates)
Вступ до Deep Learning з Keras

Вступ до Deep Learning з Keras

Давайте потренуємось!

Вступ до Deep Learning з Keras

Preparing Video For Download...