seaborn - heatmap - 31,000 square matrix sns.heatmap dies
Problem
seaborn heatmap dies in jupyter notebook and in python script form.
Literature review
seaborn failing, is the closest I can find to a similar problem, but this isn't exactly the same issue. Mine is just a standalone seaborn won't print the heatmap problem.
Symptoms
import numpy as np; np.random.seed(0)
import seaborn as sns; sns.set()
import matplotlib.pyplot as plt
M=np.ones((32000,32000))
ax = sns.heatmap(M)
plt.show()
With the above code, I get a kernel stopped running message in the jupyter notebook, and a [1]+ Killed: 9 python bible_ai_construction.py in my terminal after waiting 20 minutes for the heatmap.
Overarching Goal
My hope is to be able to investigate each states relationship to each other state in a dataset. I am supplied with each state, as well as a list of all other states it is related to, small example below:
d={'a':['b','c','e'],'b':['a','c'],'c':['a'],'d':['a','e','b'],'e':['a','c']}
#set the new dictionary to one_hot_encoding representation
d={'a':[0,1,1,0,1],'b':[1,0,1,0,0],'c':[1,0,0,0,0],'d':[1,1,0,0,1],'e':[1,0,1,0,0]}
#construct matrix
M=np.matrix(list(map(lambda x:x, d.values())))
#apply M to seaborn heatmap, i.e., M.shape->(32000,32000)
python-3.x jupyter-notebook seaborn heatmap
add a comment |
Problem
seaborn heatmap dies in jupyter notebook and in python script form.
Literature review
seaborn failing, is the closest I can find to a similar problem, but this isn't exactly the same issue. Mine is just a standalone seaborn won't print the heatmap problem.
Symptoms
import numpy as np; np.random.seed(0)
import seaborn as sns; sns.set()
import matplotlib.pyplot as plt
M=np.ones((32000,32000))
ax = sns.heatmap(M)
plt.show()
With the above code, I get a kernel stopped running message in the jupyter notebook, and a [1]+ Killed: 9 python bible_ai_construction.py in my terminal after waiting 20 minutes for the heatmap.
Overarching Goal
My hope is to be able to investigate each states relationship to each other state in a dataset. I am supplied with each state, as well as a list of all other states it is related to, small example below:
d={'a':['b','c','e'],'b':['a','c'],'c':['a'],'d':['a','e','b'],'e':['a','c']}
#set the new dictionary to one_hot_encoding representation
d={'a':[0,1,1,0,1],'b':[1,0,1,0,0],'c':[1,0,0,0,0],'d':[1,1,0,0,1],'e':[1,0,1,0,0]}
#construct matrix
M=np.matrix(list(map(lambda x:x, d.values())))
#apply M to seaborn heatmap, i.e., M.shape->(32000,32000)
python-3.x jupyter-notebook seaborn heatmap
Can you start withM=np.ones((10,10))? If you want to create a heatmap of a billion pixels, seabornheatmapis sure not the right tool. What's the purpose of such a large map? The more you can go into detail about the desired outcome the easier it is to help.
– ImportanceOfBeingErnest
Nov 24 '18 at 15:59
@ImportanceOfBeingErnest As(10,10)case is trivial, I did not include it. I have done this before in for(1200,1200). The purpose of this large heatmap is to discover unintuitive patterns within related state-spaces. Your point is relevant, however, perhaps describing what I hope to achieve, there may be a better approach. Making modifications now.
– bmc
Nov 24 '18 at 16:24
You cannot reasonably visualize the relationship between 32000 independent variables. But maybe they are by themselves somehow related? Maybe they can be grouped? In any case, your first step of analysis needs to be on data agregation or statistics, not on visualization.
– ImportanceOfBeingErnest
Nov 24 '18 at 17:17
add a comment |
Problem
seaborn heatmap dies in jupyter notebook and in python script form.
Literature review
seaborn failing, is the closest I can find to a similar problem, but this isn't exactly the same issue. Mine is just a standalone seaborn won't print the heatmap problem.
Symptoms
import numpy as np; np.random.seed(0)
import seaborn as sns; sns.set()
import matplotlib.pyplot as plt
M=np.ones((32000,32000))
ax = sns.heatmap(M)
plt.show()
With the above code, I get a kernel stopped running message in the jupyter notebook, and a [1]+ Killed: 9 python bible_ai_construction.py in my terminal after waiting 20 minutes for the heatmap.
Overarching Goal
My hope is to be able to investigate each states relationship to each other state in a dataset. I am supplied with each state, as well as a list of all other states it is related to, small example below:
d={'a':['b','c','e'],'b':['a','c'],'c':['a'],'d':['a','e','b'],'e':['a','c']}
#set the new dictionary to one_hot_encoding representation
d={'a':[0,1,1,0,1],'b':[1,0,1,0,0],'c':[1,0,0,0,0],'d':[1,1,0,0,1],'e':[1,0,1,0,0]}
#construct matrix
M=np.matrix(list(map(lambda x:x, d.values())))
#apply M to seaborn heatmap, i.e., M.shape->(32000,32000)
python-3.x jupyter-notebook seaborn heatmap
Problem
seaborn heatmap dies in jupyter notebook and in python script form.
Literature review
seaborn failing, is the closest I can find to a similar problem, but this isn't exactly the same issue. Mine is just a standalone seaborn won't print the heatmap problem.
Symptoms
import numpy as np; np.random.seed(0)
import seaborn as sns; sns.set()
import matplotlib.pyplot as plt
M=np.ones((32000,32000))
ax = sns.heatmap(M)
plt.show()
With the above code, I get a kernel stopped running message in the jupyter notebook, and a [1]+ Killed: 9 python bible_ai_construction.py in my terminal after waiting 20 minutes for the heatmap.
Overarching Goal
My hope is to be able to investigate each states relationship to each other state in a dataset. I am supplied with each state, as well as a list of all other states it is related to, small example below:
d={'a':['b','c','e'],'b':['a','c'],'c':['a'],'d':['a','e','b'],'e':['a','c']}
#set the new dictionary to one_hot_encoding representation
d={'a':[0,1,1,0,1],'b':[1,0,1,0,0],'c':[1,0,0,0,0],'d':[1,1,0,0,1],'e':[1,0,1,0,0]}
#construct matrix
M=np.matrix(list(map(lambda x:x, d.values())))
#apply M to seaborn heatmap, i.e., M.shape->(32000,32000)
python-3.x jupyter-notebook seaborn heatmap
python-3.x jupyter-notebook seaborn heatmap
edited Nov 24 '18 at 16:31
bmc
asked Nov 24 '18 at 15:51
bmcbmc
182113
182113
Can you start withM=np.ones((10,10))? If you want to create a heatmap of a billion pixels, seabornheatmapis sure not the right tool. What's the purpose of such a large map? The more you can go into detail about the desired outcome the easier it is to help.
– ImportanceOfBeingErnest
Nov 24 '18 at 15:59
@ImportanceOfBeingErnest As(10,10)case is trivial, I did not include it. I have done this before in for(1200,1200). The purpose of this large heatmap is to discover unintuitive patterns within related state-spaces. Your point is relevant, however, perhaps describing what I hope to achieve, there may be a better approach. Making modifications now.
– bmc
Nov 24 '18 at 16:24
You cannot reasonably visualize the relationship between 32000 independent variables. But maybe they are by themselves somehow related? Maybe they can be grouped? In any case, your first step of analysis needs to be on data agregation or statistics, not on visualization.
– ImportanceOfBeingErnest
Nov 24 '18 at 17:17
add a comment |
Can you start withM=np.ones((10,10))? If you want to create a heatmap of a billion pixels, seabornheatmapis sure not the right tool. What's the purpose of such a large map? The more you can go into detail about the desired outcome the easier it is to help.
– ImportanceOfBeingErnest
Nov 24 '18 at 15:59
@ImportanceOfBeingErnest As(10,10)case is trivial, I did not include it. I have done this before in for(1200,1200). The purpose of this large heatmap is to discover unintuitive patterns within related state-spaces. Your point is relevant, however, perhaps describing what I hope to achieve, there may be a better approach. Making modifications now.
– bmc
Nov 24 '18 at 16:24
You cannot reasonably visualize the relationship between 32000 independent variables. But maybe they are by themselves somehow related? Maybe they can be grouped? In any case, your first step of analysis needs to be on data agregation or statistics, not on visualization.
– ImportanceOfBeingErnest
Nov 24 '18 at 17:17
Can you start with
M=np.ones((10,10))? If you want to create a heatmap of a billion pixels, seaborn heatmap is sure not the right tool. What's the purpose of such a large map? The more you can go into detail about the desired outcome the easier it is to help.– ImportanceOfBeingErnest
Nov 24 '18 at 15:59
Can you start with
M=np.ones((10,10))? If you want to create a heatmap of a billion pixels, seaborn heatmap is sure not the right tool. What's the purpose of such a large map? The more you can go into detail about the desired outcome the easier it is to help.– ImportanceOfBeingErnest
Nov 24 '18 at 15:59
@ImportanceOfBeingErnest As
(10,10) case is trivial, I did not include it. I have done this before in for (1200,1200). The purpose of this large heatmap is to discover unintuitive patterns within related state-spaces. Your point is relevant, however, perhaps describing what I hope to achieve, there may be a better approach. Making modifications now.– bmc
Nov 24 '18 at 16:24
@ImportanceOfBeingErnest As
(10,10) case is trivial, I did not include it. I have done this before in for (1200,1200). The purpose of this large heatmap is to discover unintuitive patterns within related state-spaces. Your point is relevant, however, perhaps describing what I hope to achieve, there may be a better approach. Making modifications now.– bmc
Nov 24 '18 at 16:24
You cannot reasonably visualize the relationship between 32000 independent variables. But maybe they are by themselves somehow related? Maybe they can be grouped? In any case, your first step of analysis needs to be on data agregation or statistics, not on visualization.
– ImportanceOfBeingErnest
Nov 24 '18 at 17:17
You cannot reasonably visualize the relationship between 32000 independent variables. But maybe they are by themselves somehow related? Maybe they can be grouped? In any case, your first step of analysis needs to be on data agregation or statistics, not on visualization.
– ImportanceOfBeingErnest
Nov 24 '18 at 17:17
add a comment |
2 Answers
2
active
oldest
votes
Matrix with dimensions of 32000x32000 will have over billion elements.
On my computer this numpy array grows to over 8Gb in memory.
Seaborn/Matplotlib will not be able to plot such huge arrays.
You should perform some aggregation methods on your matrix, binning etc.
Simply plotting such big array will have no advantage, no one will be able to deduce any information from such detailed chart.
Could you please recommend what aggregation you would consider? e.g., how would you bin such as example as in theoverarching goalsection of the question.
– bmc
Nov 24 '18 at 16:33
add a comment |
I think you should preview the large data in some sort of a subsampled/summarized form
and then have a detailed view connected via mouse interactions with the larger
image. You can implement this using https://github.com/AaronWatters/jp_doodle and in fact I implemented something like this (using much smaller data) as the final example in this notebook: https://github.com/AaronWatters/jp_doodle/blob/master/notebooks/Simple%20Python%20Examples.ipynb
Here is a screen shot

the left image is the image at full resolution,
the middle image is a 3x3 detail from the full resolution image and the
left swatch is a color sample in the middle of the detail. It's a little
hard to see, but there is a gray square in the full image that shows
the location of the detail which can be dragged using the mouse.
In your case you would show the subsampled image at left and stream the
full size detail region slice from the Python kernel. See
https://github.com/AaronWatters/jp_doodle/blob/master/notebooks/misc/image%20streaming%20demo.ipynb for an example of streaming data
from numpy arrays to a jp_doodle widget.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53459832%2fseaborn-heatmap-31-000-square-matrix-sns-heatmap-dies%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Matrix with dimensions of 32000x32000 will have over billion elements.
On my computer this numpy array grows to over 8Gb in memory.
Seaborn/Matplotlib will not be able to plot such huge arrays.
You should perform some aggregation methods on your matrix, binning etc.
Simply plotting such big array will have no advantage, no one will be able to deduce any information from such detailed chart.
Could you please recommend what aggregation you would consider? e.g., how would you bin such as example as in theoverarching goalsection of the question.
– bmc
Nov 24 '18 at 16:33
add a comment |
Matrix with dimensions of 32000x32000 will have over billion elements.
On my computer this numpy array grows to over 8Gb in memory.
Seaborn/Matplotlib will not be able to plot such huge arrays.
You should perform some aggregation methods on your matrix, binning etc.
Simply plotting such big array will have no advantage, no one will be able to deduce any information from such detailed chart.
Could you please recommend what aggregation you would consider? e.g., how would you bin such as example as in theoverarching goalsection of the question.
– bmc
Nov 24 '18 at 16:33
add a comment |
Matrix with dimensions of 32000x32000 will have over billion elements.
On my computer this numpy array grows to over 8Gb in memory.
Seaborn/Matplotlib will not be able to plot such huge arrays.
You should perform some aggregation methods on your matrix, binning etc.
Simply plotting such big array will have no advantage, no one will be able to deduce any information from such detailed chart.
Matrix with dimensions of 32000x32000 will have over billion elements.
On my computer this numpy array grows to over 8Gb in memory.
Seaborn/Matplotlib will not be able to plot such huge arrays.
You should perform some aggregation methods on your matrix, binning etc.
Simply plotting such big array will have no advantage, no one will be able to deduce any information from such detailed chart.
answered Nov 24 '18 at 16:22
Kamil NiskiKamil Niski
2,5741214
2,5741214
Could you please recommend what aggregation you would consider? e.g., how would you bin such as example as in theoverarching goalsection of the question.
– bmc
Nov 24 '18 at 16:33
add a comment |
Could you please recommend what aggregation you would consider? e.g., how would you bin such as example as in theoverarching goalsection of the question.
– bmc
Nov 24 '18 at 16:33
Could you please recommend what aggregation you would consider? e.g., how would you bin such as example as in the
overarching goal section of the question.– bmc
Nov 24 '18 at 16:33
Could you please recommend what aggregation you would consider? e.g., how would you bin such as example as in the
overarching goal section of the question.– bmc
Nov 24 '18 at 16:33
add a comment |
I think you should preview the large data in some sort of a subsampled/summarized form
and then have a detailed view connected via mouse interactions with the larger
image. You can implement this using https://github.com/AaronWatters/jp_doodle and in fact I implemented something like this (using much smaller data) as the final example in this notebook: https://github.com/AaronWatters/jp_doodle/blob/master/notebooks/Simple%20Python%20Examples.ipynb
Here is a screen shot

the left image is the image at full resolution,
the middle image is a 3x3 detail from the full resolution image and the
left swatch is a color sample in the middle of the detail. It's a little
hard to see, but there is a gray square in the full image that shows
the location of the detail which can be dragged using the mouse.
In your case you would show the subsampled image at left and stream the
full size detail region slice from the Python kernel. See
https://github.com/AaronWatters/jp_doodle/blob/master/notebooks/misc/image%20streaming%20demo.ipynb for an example of streaming data
from numpy arrays to a jp_doodle widget.
add a comment |
I think you should preview the large data in some sort of a subsampled/summarized form
and then have a detailed view connected via mouse interactions with the larger
image. You can implement this using https://github.com/AaronWatters/jp_doodle and in fact I implemented something like this (using much smaller data) as the final example in this notebook: https://github.com/AaronWatters/jp_doodle/blob/master/notebooks/Simple%20Python%20Examples.ipynb
Here is a screen shot

the left image is the image at full resolution,
the middle image is a 3x3 detail from the full resolution image and the
left swatch is a color sample in the middle of the detail. It's a little
hard to see, but there is a gray square in the full image that shows
the location of the detail which can be dragged using the mouse.
In your case you would show the subsampled image at left and stream the
full size detail region slice from the Python kernel. See
https://github.com/AaronWatters/jp_doodle/blob/master/notebooks/misc/image%20streaming%20demo.ipynb for an example of streaming data
from numpy arrays to a jp_doodle widget.
add a comment |
I think you should preview the large data in some sort of a subsampled/summarized form
and then have a detailed view connected via mouse interactions with the larger
image. You can implement this using https://github.com/AaronWatters/jp_doodle and in fact I implemented something like this (using much smaller data) as the final example in this notebook: https://github.com/AaronWatters/jp_doodle/blob/master/notebooks/Simple%20Python%20Examples.ipynb
Here is a screen shot

the left image is the image at full resolution,
the middle image is a 3x3 detail from the full resolution image and the
left swatch is a color sample in the middle of the detail. It's a little
hard to see, but there is a gray square in the full image that shows
the location of the detail which can be dragged using the mouse.
In your case you would show the subsampled image at left and stream the
full size detail region slice from the Python kernel. See
https://github.com/AaronWatters/jp_doodle/blob/master/notebooks/misc/image%20streaming%20demo.ipynb for an example of streaming data
from numpy arrays to a jp_doodle widget.
I think you should preview the large data in some sort of a subsampled/summarized form
and then have a detailed view connected via mouse interactions with the larger
image. You can implement this using https://github.com/AaronWatters/jp_doodle and in fact I implemented something like this (using much smaller data) as the final example in this notebook: https://github.com/AaronWatters/jp_doodle/blob/master/notebooks/Simple%20Python%20Examples.ipynb
Here is a screen shot

the left image is the image at full resolution,
the middle image is a 3x3 detail from the full resolution image and the
left swatch is a color sample in the middle of the detail. It's a little
hard to see, but there is a gray square in the full image that shows
the location of the detail which can be dragged using the mouse.
In your case you would show the subsampled image at left and stream the
full size detail region slice from the Python kernel. See
https://github.com/AaronWatters/jp_doodle/blob/master/notebooks/misc/image%20streaming%20demo.ipynb for an example of streaming data
from numpy arrays to a jp_doodle widget.
answered Nov 27 '18 at 20:57
Aaron WattersAaron Watters
1,34421532
1,34421532
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53459832%2fseaborn-heatmap-31-000-square-matrix-sns-heatmap-dies%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Can you start with
M=np.ones((10,10))? If you want to create a heatmap of a billion pixels, seabornheatmapis sure not the right tool. What's the purpose of such a large map? The more you can go into detail about the desired outcome the easier it is to help.– ImportanceOfBeingErnest
Nov 24 '18 at 15:59
@ImportanceOfBeingErnest As
(10,10)case is trivial, I did not include it. I have done this before in for(1200,1200). The purpose of this large heatmap is to discover unintuitive patterns within related state-spaces. Your point is relevant, however, perhaps describing what I hope to achieve, there may be a better approach. Making modifications now.– bmc
Nov 24 '18 at 16:24
You cannot reasonably visualize the relationship between 32000 independent variables. But maybe they are by themselves somehow related? Maybe they can be grouped? In any case, your first step of analysis needs to be on data agregation or statistics, not on visualization.
– ImportanceOfBeingErnest
Nov 24 '18 at 17:17