Keras इनपुट और डेंस लेयर्स

Keras के साथ Advanced Deep Learning

Zach Deane-Mayer

Data Scientist

कोर्स रूपरेखा

  • अध्याय 1: Keras फंक्शनल API परिचय (रीफ़्रेशर)
  • अध्याय 2: 2 इनपुट वाले मॉडल
  • अध्याय 3: 3 इनपुट वाले मॉडल
  • अध्याय 4: मल्टीपल आउटपुट
Keras के साथ Advanced Deep Learning

कोर्स डेटासेट: कॉलेज बास्केटबॉल डेटा, 1989-2017

डेटासेट 1: रेगुलर सीजन

  • टीम ID 1
  • टीम ID 2
  • होम बनाम अवे
  • स्कोर डिफरेंस (टीम 1 - टीम 2)
  • टीम 1 स्कोर
  • टीम 2 स्कोर
  • जीता बनाम हारा

डेटासेट 2: टूर्नामेंट गेम्स

  • डेटासेट 1 जैसा ही
  • साथ ही Seed का डिफरेंस भी
Keras के साथ Advanced Deep Learning

कोर्स डेटासेट: कॉलेज बास्केटबॉल डेटा, 1989-2017

import pandas as pd
games_season = pd.read_csv('datasets/games_season.csv')
games_season.head()

Out[1]:
   season  team_1  team_2  home  score_diff  score_1  score_2  won
0    1985    3745    6664     0          17       81       64    1
1    1985     126    7493     1           7       77       70    1
2    1985     288    3593     1           7       63       56    1
3    1985    1846    9881     1          16       70       54    1
4    1985    2675   10298     1          12       86       74    1

games_tourney = pd.read_csv('datasets/games_tourney.csv')
games_tourney.head()

Out[2]:
   season  team_1  team_2  home  seed_diff  score_diff  score_1  score_2  won
0    1985     288      73     0         -3          -9       41       50    0
1    1985    5929      73     0          4           6       61       55    1
2    1985    9884      73     0          5          -4       59       63    0
3    1985      73     288     0          3           9       50       41    1
4    1985    3920     410     0          1          -9       54       63    0
Keras के साथ Advanced Deep Learning

इनपुट्स और आउटपुट्स

दो बुनियादी हिस्से:

  • इनपुट लेयर
  • आउटपुट लेयर
Keras के साथ Advanced Deep Learning

इनपुट्स

from tensorflow.keras.layers import Input
input_tensor = Input(shape=(1,))

Keras के साथ Advanced Deep Learning

इनपुट्स

from tensorflow.keras.layers import Input
input_tensor = Input(shape=(1,))
print(input_tensor)

KerasTensor(type_spec=TensorSpec(shape=(None, 1), dtype=tf.float32, name='input_1'), name='input_1', description="created by layer 'input_1'")

Keras के साथ Advanced Deep Learning

आउटपुट्स

from tensorflow.keras.layers import Dense
output_layer = Dense(1)

Keras के साथ Advanced Deep Learning

आउटपुट्स

from tensorflow.keras.layers import Dense
output_layer = Dense(1)
print(output_layer)

<keras.layers.core.dense.Dense object at 0x15df15e80>

Keras के साथ Advanced Deep Learning

इनपुट्स को आउटपुट्स से जोड़ना

from tensorflow.keras.layers import Input, Dense
input_tensor = Input(shape=(1,))
output_layer = Dense(1)
output_tensor = output_layer(input_tensor)

Keras के साथ Advanced Deep Learning

इनपुट्स को आउटपुट्स से जोड़ना

print(output_tensor)

KerasTensor(type_spec=TensorSpec(shape=(None, 1), dtype=tf.float32, name=None), name='dense_1/BiasAdd:0', description="created by layer 'dense_1'")

Keras के साथ Advanced Deep Learning

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

Keras के साथ Advanced Deep Learning

Preparing Video For Download...