Neural networks और layers

PyTorch के साथ Deep Learning परिचय

Jasmin Ludolf

Senior Data Science Content Developer, DataCamp

Neural network layers

इनपुट, hidden layer और आउटपुट वाला neural network का डायग्राम

PyTorch के साथ Deep Learning परिचय

Neural network layers

इनपुट, hidden layer और आउटपुट वाला neural network का डायग्राम

PyTorch के साथ Deep Learning परिचय

Neural network layers

इनपुट, hidden layer और आउटपुट वाला neural network का डायग्राम

PyTorch के साथ Deep Learning परिचय

Neural network layers

इनपुट, hidden layer और आउटपुट वाला neural network का डायग्राम

PyTorch के साथ Deep Learning परिचय

हमारा पहला neural network

सिर्फ इनपुट और आउटपुट वाला बेसिक neural network

  • Fully connected network
  • Linear model के बराबर
PyTorch के साथ Deep Learning परिचय

Neural network डिजाइन करना

Neural network के इनपुट को दर्शाते तीन nodes

# Importing as nn to avoid writing torch.nn
import torch.nn as nn


# Create input_tensor with three features input_tensor = torch.tensor( [[0.3471, 0.4547, -0.2356]])
  • Input neurons = features
  • Output neurons = classes
PyTorch के साथ Deep Learning परिचय

Neural network डिजाइन करना

तीन इनपुट nodes और आगे की ओर तीर, linear layer दर्शाते हुए

# Importing as nn to avoid writing torch.nn
import torch.nn as nn


# Create input_tensor with three features input_tensor = torch.tensor( [[0.3471, 0.4547, -0.2356]])
# Define our linear layer linear_layer = nn.Linear(
in_features=3,
out_features=2
)
PyTorch के साथ Deep Learning परिचय

Neural network डिजाइन करना

सिर्फ इनपुट और आउटपुट वाला बेसिक neural network

# Importing as nn to avoid writing torch.nn
import torch.nn as nn


# Create input_tensor with three features input_tensor = torch.tensor( [[0.3471, 0.4547, -0.2356]])
# Define our linear layer linear_layer = nn.Linear( in_features=3, out_features=2 )
# Pass input through linear layer output = linear_layer(input_tensor) print(output)
PyTorch के साथ Deep Learning परिचय

Neural network डिजाइन करना

सिर्फ इनपुट और आउटपुट वाला बेसिक neural network

$$ $$ $$

# Pass input through linear layer
output = linear_layer(input_tensor)
print(output)
tensor([[-0.2415, -0.1604]], 
    grad_fn=<AddmmBackward0>)
PyTorch के साथ Deep Learning परिचय

Weights और biases

output = linear_layer(input_tensor)

Linear operation का निरूपण

PyTorch के साथ Deep Learning परिचय

Weights और biases

  • .weight
    print(linear_layer.weight)
    
Parameter containing:
tensor([[-0.4799,  0.4996,  0.1123],
        [-0.0365, -0.1855,  0.0432]], 
        requires_grad=True)

$$

  • अलग-अलग features की अहमियत दर्शाता है
  • .bias
    print(linear_layer.bias)
    
Parameter containing:
tensor([0.0310, 0.1537], requires_grad=True)

$$

$$

  • neuron को baseline आउटपुट देता है
PyTorch के साथ Deep Learning परिचय

एक fully connected network क्रिया में

सिर्फ इनपुट और आउटपुट वाला बेसिक neural network

PyTorch के साथ Deep Learning परिचय

एक fully connected network क्रिया में

सिर्फ इनपुट और आउटपुट वाला बेसिक neural network

PyTorch के साथ Deep Learning परिचय

एक fully connected network क्रिया में

सिर्फ इनपुट और आउटपुट वाला बेसिक neural network

  • Humidity फीचर का weight ज़्यादा अहम होगा
  • Bias baseline जानकारी जोड़ने के लिए है
PyTorch के साथ Deep Learning परिचय

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

PyTorch के साथ Deep Learning परिचय

Preparing Video For Download...