<jupyter_start><jupyter_text>Learnable Parameters<jupyter_code>from keras.models import Sequential
from keras.layers import Dense, Activation
model = Sequential([
    Dense(3, input_shape=(2,), activation='relu'),
    Dense(2, activation='softmax')
])
model.summary()
model.get_weights()<jupyter_output><empty_output><jupyter_text>Learnable Parameters in a CNN<jupyter_code>from keras.layers.core import Flatten
from keras.layers.convolutional import *
from keras.layers.pooling import *
model = Sequential([
    Conv2D(2, kernel_size=(3,3), input_shape=(20,20,3), activation='relu', padding='same'),
    Conv2D(3, kernel_size=(3,3), activation='relu', padding='same'),
    Flatten(),
    Dense(2, activation='softmax')
])
model.summary()<jupyter_output>_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
conv2d_1 (Conv2D)            (None, 20, 20, 2)         56        
_________________________________________________________________
conv2d_2 (Conv2D)            (None, 20, 20, 3)         57        
_________________________________________________________________
flatten_1 (Flatten)          (None, 1200)              0         
_________________________________________________________________
dense_3 (Dense)              (None, 2)                 2402      
=================================================================
Total params: 2,515
Trainable params: 2,515
Non-trainable params: 0
_________________________________________________________________<jupyter_text>Remove zero-padding<jupyter_code>no_padding_model = Sequential([
    Conv2D(2, kernel_size=(3,3), input_shape=(20,20,3), activation='relu'),
    Conv2D(3, kernel_size=(3,3), activation='relu'),
    Flatten(),
    Dense(2, activation='softmax')
])
no_padding_model.summary()<jupyter_output>_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
conv2d_3 (Conv2D)            (None, 18, 18, 2)         56        
_________________________________________________________________
conv2d_4 (Conv2D)            (None, 16, 16, 3)         57        
_________________________________________________________________
flatten_2 (Flatten)          (None, 768)               0         
_________________________________________________________________
dense_4 (Dense)              (None, 2)                 1538      
=================================================================
Total params: 1,651
Trainable params: 1,651
Non-trainable params: 0
_________________________________________________________________<jupyter_text>Add max pooling<jupyter_code>pooling_model = Sequential([
    Conv2D(2, kernel_size=(3,3), input_shape=(20,20,3), activation='relu', padding='same'),
    Conv2D(3, kernel_size=(3,3), activation='relu', padding='same'),
    MaxPooling2D(pool_size=(2,2), strides=2),
    Flatten(),
    Dense(2, activation='softmax')
])
pooling_model.summary()<jupyter_output>_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
conv2d_5 (Conv2D)            (None, 20, 20, 2)         56        
_________________________________________________________________
conv2d_6 (Conv2D)            (None, 20, 20, 3)         57        
_________________________________________________________________
max_pooling2d_1 (MaxPooling2 (None, 10, 10, 3)         0         
_________________________________________________________________
flatten_3 (Flatten)          (None, 300)               0         
_________________________________________________________________
dense_5 (Dense)              (None, 2)                 602       
=================================================================
Total params: 715
Trainable params: 715
Non-trainable params: 0
_________________________________________________________________
{'fraction_non_alphanumeric': 0.17614323735785145, 'fraction_numerical': 0.04258407936123881, 'mean_word_length': 4.2729591836734695, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '105200', 'license': 'MIT', 'n_tokens_mistral': 1077, 'n_tokens_neox': 946, 'n_words': 201, 'path': 'deeplizard-keras-tutorial/deeplizard_kerastutorial_learnableparams.ipynb', 'repo_name': 'sem-onyalo/ml-sandbox', 'size': '4133'}