Dense layers

Python में TensorFlow परिचय

Isaiah Hull

Visiting Associate Professor of Finance, BI Norwegian Business School

The linear regression model

डायग्राम एक रिग्रेशन मॉडल दिखाता है जिसमें दो फीचर हैं: वैवाहिक स्थिति और उम्र। मॉडल का लक्ष्य क्रेडिट कार्ड उधारकर्ता का डिफॉल्ट स्टेटस है.

Python में TensorFlow परिचय

What is a neural network?

डायग्राम एक न्यूरल नेटवर्क दिखाता है जिसमें दो इनपुट फीचर हैं: वैवाहिक स्थिति और उम्र। नेटवर्क का लक्ष्य क्रेडिट कार्ड उधारकर्ता का डिफॉल्ट स्टेटस है.

Python में TensorFlow परिचय

What is a neural network?

यह चित्र एक अधिक जटिल न्यूरल नेटवर्क दिखाता है जिसमें 10 इनपुट फीचर, 3 डेंस हिडन लेयर, और एक आउटपुट लेयर हैं.

  • एक डेंस लेयर पिछली लेयर के सभी नोड्स पर वेट्स लागू करती है.
Python में TensorFlow परिचय

A simple dense layer

import tensorflow as tf
# Define inputs (features)
inputs = tf.constant([[1, 35]])
# Define weights
weights = tf.Variable([[-0.05], [-0.01]])
# Define the bias
bias = tf.Variable([0.5])
Python में TensorFlow परिचय

A simple dense layer

# Multiply inputs (features) by the weights
product = tf.matmul(inputs, weights)
# Define dense layer
dense = tf.keras.activations.sigmoid(product+bias)

यह डायग्राम एक डेंस लेयर दिखाता है जो दो इनपुट नोड लेती है और एक आउटपुट बनाती है.

Python में TensorFlow परिचय

Defining a complete model

import tensorflow as tf
# Define input (features) layer
inputs = tf.constant(data, tf.float32)
# Define first dense layer
dense1 = tf.keras.layers.Dense(10, activation='sigmoid')(inputs)
Python में TensorFlow परिचय

Defining a complete model

# Define second dense layer
dense2 = tf.keras.layers.Dense(5, activation='sigmoid')(dense1)
# Define output (predictions) layer
outputs =  tf.keras.layers.Dense(1, activation='sigmoid')(dense2)

यह डायग्राम एक डेंस लेयर दिखाता है जो दो इनपुट नोड लेती है और एक आउटपुट बनाती है.

Python में TensorFlow परिचय

High-level versus low-level approach

  • High-level approach
    • High-level API ऑपरेशन
dense = keras.layers.Dense(10,\
 activation='sigmoid')
  • Low-level approach
    • लीनियर-एल्जब्रिक ऑपरेशन
prod = matmul(inputs, weights)
dense = keras.activations.sigmoid(prod)
Python में TensorFlow परिचय

अभ्यास करते हैं!

Python में TensorFlow परिचय

Preparing Video For Download...