Binär klassificering

Introduktion till djupinlärning med Keras

Miguel Esteban

Data Scientist & Founder

När använder man binär klassificering?

Introduktion till djupinlärning med Keras

Vår datamängd

Introduktion till djupinlärning med Keras

Pairplots

import seaborn as sns

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

Introduktion till djupinlärning med Keras

Introduktion till djupinlärning med Keras

Introduktion till djupinlärning med Keras

Introduktion till djupinlärning med Keras

Introduktion till djupinlärning med Keras

Introduktion till djupinlärning med Keras

Sigmoidfunktionen

Introduktion till djupinlärning med Keras

Vi bygger modellen

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

# Instantiate a sequential model model = Sequential()

Introduktion till djupinlärning med Keras

Vi bygger modellen

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'))

Introduktion till djupinlärning med Keras

Vi bygger modellen

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'))

Introduktion till djupinlärning med Keras

Kompilera, träna, predicera

# 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)
Introduktion till djupinlärning med Keras

Introduktion till djupinlärning med Keras

Nu kör vi en övning!

Introduktion till djupinlärning med Keras

Preparing Video For Download...