Meaning of weights from a 1D convolutional network












0












$begingroup$


just trying to better understand what's happening in my network. I built a 3 layer convolutional network to classify 1D signals. Here it is:



model = Sequential()
model.add(Conv1D(32, 12, activation='relu', input_shape=(1500, 1)))
model.add(MaxPooling1D(3))
model.add(Dropout(0.5))
model.add(Conv1D(64, 12, activation='relu'))
model.add(MaxPooling1D(3))
model.add(Dropout(0.5))
model.add(Conv1D(128, 12, activation='relu'))
model.add(GlobalAveragePooling1D())
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))

model.compile(loss='binary_crossentropy',
optimizer='rmsprop',
metrics=['accuracy'])


I have 224 (32 + 64 + 128) filters each of size 12. I expect each of my signals (size 1500) to pass through a filter, have the activation function applied, pooled, and repeat...



So, when all is said and done, I expect 224 filters each with 12 weights (32x12), (64x12), and (128x12). But, when I use get_weights() I get a completely different shape. I opened the cell up in Matlab, and it looks like this:



1D Conv weights



Can anyone help me understand what I'm missing? Why does each pooling layer have a number of weights equal to the number of filters from the convolutional layer before? (cell 2 is a 1x32 vector)(is that what's happening?)



I'm trying to visualize what is happening to a random signal that passes through these layers, but haven't found much in the way for visualization for 1D signals. I'd like to extract the filters and and save them, then convolve manually.



I feel like I've completely misunderstood how these things work.









share









$endgroup$












  • $begingroup$
    AHH! The pooling layer weights are not from the pooling layer, because that's dumb. They're the weights on the synapses between the layers of neurons, correct?
    $endgroup$
    – B. Erickson
    4 mins ago
















0












$begingroup$


just trying to better understand what's happening in my network. I built a 3 layer convolutional network to classify 1D signals. Here it is:



model = Sequential()
model.add(Conv1D(32, 12, activation='relu', input_shape=(1500, 1)))
model.add(MaxPooling1D(3))
model.add(Dropout(0.5))
model.add(Conv1D(64, 12, activation='relu'))
model.add(MaxPooling1D(3))
model.add(Dropout(0.5))
model.add(Conv1D(128, 12, activation='relu'))
model.add(GlobalAveragePooling1D())
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))

model.compile(loss='binary_crossentropy',
optimizer='rmsprop',
metrics=['accuracy'])


I have 224 (32 + 64 + 128) filters each of size 12. I expect each of my signals (size 1500) to pass through a filter, have the activation function applied, pooled, and repeat...



So, when all is said and done, I expect 224 filters each with 12 weights (32x12), (64x12), and (128x12). But, when I use get_weights() I get a completely different shape. I opened the cell up in Matlab, and it looks like this:



1D Conv weights



Can anyone help me understand what I'm missing? Why does each pooling layer have a number of weights equal to the number of filters from the convolutional layer before? (cell 2 is a 1x32 vector)(is that what's happening?)



I'm trying to visualize what is happening to a random signal that passes through these layers, but haven't found much in the way for visualization for 1D signals. I'd like to extract the filters and and save them, then convolve manually.



I feel like I've completely misunderstood how these things work.









share









$endgroup$












  • $begingroup$
    AHH! The pooling layer weights are not from the pooling layer, because that's dumb. They're the weights on the synapses between the layers of neurons, correct?
    $endgroup$
    – B. Erickson
    4 mins ago














0












0








0





$begingroup$


just trying to better understand what's happening in my network. I built a 3 layer convolutional network to classify 1D signals. Here it is:



model = Sequential()
model.add(Conv1D(32, 12, activation='relu', input_shape=(1500, 1)))
model.add(MaxPooling1D(3))
model.add(Dropout(0.5))
model.add(Conv1D(64, 12, activation='relu'))
model.add(MaxPooling1D(3))
model.add(Dropout(0.5))
model.add(Conv1D(128, 12, activation='relu'))
model.add(GlobalAveragePooling1D())
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))

model.compile(loss='binary_crossentropy',
optimizer='rmsprop',
metrics=['accuracy'])


I have 224 (32 + 64 + 128) filters each of size 12. I expect each of my signals (size 1500) to pass through a filter, have the activation function applied, pooled, and repeat...



So, when all is said and done, I expect 224 filters each with 12 weights (32x12), (64x12), and (128x12). But, when I use get_weights() I get a completely different shape. I opened the cell up in Matlab, and it looks like this:



1D Conv weights



Can anyone help me understand what I'm missing? Why does each pooling layer have a number of weights equal to the number of filters from the convolutional layer before? (cell 2 is a 1x32 vector)(is that what's happening?)



I'm trying to visualize what is happening to a random signal that passes through these layers, but haven't found much in the way for visualization for 1D signals. I'd like to extract the filters and and save them, then convolve manually.



I feel like I've completely misunderstood how these things work.









share









$endgroup$




just trying to better understand what's happening in my network. I built a 3 layer convolutional network to classify 1D signals. Here it is:



model = Sequential()
model.add(Conv1D(32, 12, activation='relu', input_shape=(1500, 1)))
model.add(MaxPooling1D(3))
model.add(Dropout(0.5))
model.add(Conv1D(64, 12, activation='relu'))
model.add(MaxPooling1D(3))
model.add(Dropout(0.5))
model.add(Conv1D(128, 12, activation='relu'))
model.add(GlobalAveragePooling1D())
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))

model.compile(loss='binary_crossentropy',
optimizer='rmsprop',
metrics=['accuracy'])


I have 224 (32 + 64 + 128) filters each of size 12. I expect each of my signals (size 1500) to pass through a filter, have the activation function applied, pooled, and repeat...



So, when all is said and done, I expect 224 filters each with 12 weights (32x12), (64x12), and (128x12). But, when I use get_weights() I get a completely different shape. I opened the cell up in Matlab, and it looks like this:



1D Conv weights



Can anyone help me understand what I'm missing? Why does each pooling layer have a number of weights equal to the number of filters from the convolutional layer before? (cell 2 is a 1x32 vector)(is that what's happening?)



I'm trying to visualize what is happening to a random signal that passes through these layers, but haven't found much in the way for visualization for 1D signals. I'd like to extract the filters and and save them, then convolve manually.



I feel like I've completely misunderstood how these things work.







classification time-series cnn visualization





share












share










share



share










asked 7 mins ago









B. EricksonB. Erickson

1




1












  • $begingroup$
    AHH! The pooling layer weights are not from the pooling layer, because that's dumb. They're the weights on the synapses between the layers of neurons, correct?
    $endgroup$
    – B. Erickson
    4 mins ago


















  • $begingroup$
    AHH! The pooling layer weights are not from the pooling layer, because that's dumb. They're the weights on the synapses between the layers of neurons, correct?
    $endgroup$
    – B. Erickson
    4 mins ago
















$begingroup$
AHH! The pooling layer weights are not from the pooling layer, because that's dumb. They're the weights on the synapses between the layers of neurons, correct?
$endgroup$
– B. Erickson
4 mins ago




$begingroup$
AHH! The pooling layer weights are not from the pooling layer, because that's dumb. They're the weights on the synapses between the layers of neurons, correct?
$endgroup$
– B. Erickson
4 mins ago










0






active

oldest

votes











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "557"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f44361%2fmeaning-of-weights-from-a-1d-convolutional-network%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Data Science Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f44361%2fmeaning-of-weights-from-a-1d-convolutional-network%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to label and detect the document text images

Vallis Paradisi

Tabula Rosettana