Jupyter is stuckPassword request from jupyter notebook session even though I don't set itTweepy won't import to Jupyter notebook on azurePrinting inside jupyter notebook custom loss function with Keras/TFJupyter Deep Learning AMIissue with running a response client in Jupyter notebookCan't import cv2 on Jupyter notebook(Anaconda)Setting up the VM server on Google Cloud to run Jupyter notebookCannot import python package in jupyterJupyter Notebook stuck in loading data setLabeling Images using Python
How can I write humor as character trait?
Stack Interview Code methods made from class Node and Smart Pointers
Multiplicative persistence
Shouldn’t conservatives embrace universal basic income?
Quoting Keynes in a lecture
A variation to the phrase "hanging over my shoulders"
A Trivial Diagnosis
awk assign to multiple variables at once
"It doesn't matter" or "it won't matter"?
What fields between the rationals and the reals allow a good notion of 2D distance?
What does "Scientists rise up against statistical significance" mean? (Comment in Nature)
Did the UK lift the requirement for registering SIM cards?
The IT department bottlenecks progress, how should I handle this?
Is it allowed to activate the ability of multiple planeswalkers in a single turn?
Biological Blimps: Propulsion
Why does this expression simplify as such?
Is there a way to have vectors outlined in a Vector Plot?
Were Persian-Median kings illiterate?
Why is the "ls" command showing permissions of files in a FAT32 partition?
Is there a RAID 0 Equivalent for RAM?
What are some good ways to treat frozen vegetables such that they behave like fresh vegetables when stir frying them?
What's the name of the logical fallacy where a debater extends a statement far beyond the original statement to make it true?
Does "he squandered his car on drink" sound natural?
Is this toilet slogan correct usage of the English language?
Jupyter is stuck
Password request from jupyter notebook session even though I don't set itTweepy won't import to Jupyter notebook on azurePrinting inside jupyter notebook custom loss function with Keras/TFJupyter Deep Learning AMIissue with running a response client in Jupyter notebookCan't import cv2 on Jupyter notebook(Anaconda)Setting up the VM server on Google Cloud to run Jupyter notebookCannot import python package in jupyterJupyter Notebook stuck in loading data setLabeling Images using Python
I have this following code:
The code is simply stuck when I give input n=6 ,(in jupyter)I don't know what to do please help.
n=int(input("Enter a number to experiment:"))
l=[]
w=[]
nw=[]
c=0
for i in range(2*n):
if(i<n):
l.append(0)
else:
l.append(1)
import itertools as it
permset=set([i for i in it.permutations(l)])
for x in permset:
w.append(x)
print (w)
for j in range(len(w)):
c=1
for y in range(2*n-1):
if(w[j][y]==w[j][y+1]):
c=c
else:
c=c+1
nw.append(c)
print(nw)
from collections import Counter
Counter(nw)
jupyter-notebook
New contributor
add a comment |
I have this following code:
The code is simply stuck when I give input n=6 ,(in jupyter)I don't know what to do please help.
n=int(input("Enter a number to experiment:"))
l=[]
w=[]
nw=[]
c=0
for i in range(2*n):
if(i<n):
l.append(0)
else:
l.append(1)
import itertools as it
permset=set([i for i in it.permutations(l)])
for x in permset:
w.append(x)
print (w)
for j in range(len(w)):
c=1
for y in range(2*n-1):
if(w[j][y]==w[j][y+1]):
c=c
else:
c=c+1
nw.append(c)
print(nw)
from collections import Counter
Counter(nw)
jupyter-notebook
New contributor
What is your end goal?
– Nathan Wright
15 hours ago
I want to run this for various n and understand how the frequencies of the 1,2, etc in nw depend on n
– SundarNarasimhan
15 hours ago
This code is written to solve a problem in combinatorics...
– SundarNarasimhan
15 hours ago
"The phenomenon of just a few inputs producing a large number of outcomes is called a combinatorial explosion and is something to keep in mind when working with combinations(), combinations_with_replacement(), and permutations()" source
– Antonino
14 hours ago
add a comment |
I have this following code:
The code is simply stuck when I give input n=6 ,(in jupyter)I don't know what to do please help.
n=int(input("Enter a number to experiment:"))
l=[]
w=[]
nw=[]
c=0
for i in range(2*n):
if(i<n):
l.append(0)
else:
l.append(1)
import itertools as it
permset=set([i for i in it.permutations(l)])
for x in permset:
w.append(x)
print (w)
for j in range(len(w)):
c=1
for y in range(2*n-1):
if(w[j][y]==w[j][y+1]):
c=c
else:
c=c+1
nw.append(c)
print(nw)
from collections import Counter
Counter(nw)
jupyter-notebook
New contributor
I have this following code:
The code is simply stuck when I give input n=6 ,(in jupyter)I don't know what to do please help.
n=int(input("Enter a number to experiment:"))
l=[]
w=[]
nw=[]
c=0
for i in range(2*n):
if(i<n):
l.append(0)
else:
l.append(1)
import itertools as it
permset=set([i for i in it.permutations(l)])
for x in permset:
w.append(x)
print (w)
for j in range(len(w)):
c=1
for y in range(2*n-1):
if(w[j][y]==w[j][y+1]):
c=c
else:
c=c+1
nw.append(c)
print(nw)
from collections import Counter
Counter(nw)
jupyter-notebook
jupyter-notebook
New contributor
New contributor
edited 14 hours ago
Bogdan Doicin
6041025
6041025
New contributor
asked 15 hours ago
SundarNarasimhanSundarNarasimhan
83
83
New contributor
New contributor
What is your end goal?
– Nathan Wright
15 hours ago
I want to run this for various n and understand how the frequencies of the 1,2, etc in nw depend on n
– SundarNarasimhan
15 hours ago
This code is written to solve a problem in combinatorics...
– SundarNarasimhan
15 hours ago
"The phenomenon of just a few inputs producing a large number of outcomes is called a combinatorial explosion and is something to keep in mind when working with combinations(), combinations_with_replacement(), and permutations()" source
– Antonino
14 hours ago
add a comment |
What is your end goal?
– Nathan Wright
15 hours ago
I want to run this for various n and understand how the frequencies of the 1,2, etc in nw depend on n
– SundarNarasimhan
15 hours ago
This code is written to solve a problem in combinatorics...
– SundarNarasimhan
15 hours ago
"The phenomenon of just a few inputs producing a large number of outcomes is called a combinatorial explosion and is something to keep in mind when working with combinations(), combinations_with_replacement(), and permutations()" source
– Antonino
14 hours ago
What is your end goal?
– Nathan Wright
15 hours ago
What is your end goal?
– Nathan Wright
15 hours ago
I want to run this for various n and understand how the frequencies of the 1,2, etc in nw depend on n
– SundarNarasimhan
15 hours ago
I want to run this for various n and understand how the frequencies of the 1,2, etc in nw depend on n
– SundarNarasimhan
15 hours ago
This code is written to solve a problem in combinatorics...
– SundarNarasimhan
15 hours ago
This code is written to solve a problem in combinatorics...
– SundarNarasimhan
15 hours ago
"The phenomenon of just a few inputs producing a large number of outcomes is called a combinatorial explosion and is something to keep in mind when working with combinations(), combinations_with_replacement(), and permutations()" source
– Antonino
14 hours ago
"The phenomenon of just a few inputs producing a large number of outcomes is called a combinatorial explosion and is something to keep in mind when working with combinations(), combinations_with_replacement(), and permutations()" source
– Antonino
14 hours ago
add a comment |
1 Answer
1
active
oldest
votes
The problem is the call to itertools.permutations
. It is computing every possible ordering of the array built previously, which for N=6 is:
[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]
I believe this will return (12!)=479001600 items, which your code is then turning into a set to remove duplicates. It never gets that far of course, but if it did, I believe the 479001600 items would be turned into a set of just 924 items.
Not sure what your goal is but maybe what you need for this part is a way to generate that set of 924 items without building the larger list, which has many many duplicates. As I understand it, that part of the code is building the set of arrays of size (2*n) where exactly half of the elements are 0 and half are 1.
Yes I see... Thank you I will try to find easier way out
– SundarNarasimhan
13 hours ago
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
);
);
SundarNarasimhan is a new contributor. Be nice, and check out our Code of Conduct.
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%2f55280086%2fjupyter-is-stuck%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem is the call to itertools.permutations
. It is computing every possible ordering of the array built previously, which for N=6 is:
[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]
I believe this will return (12!)=479001600 items, which your code is then turning into a set to remove duplicates. It never gets that far of course, but if it did, I believe the 479001600 items would be turned into a set of just 924 items.
Not sure what your goal is but maybe what you need for this part is a way to generate that set of 924 items without building the larger list, which has many many duplicates. As I understand it, that part of the code is building the set of arrays of size (2*n) where exactly half of the elements are 0 and half are 1.
Yes I see... Thank you I will try to find easier way out
– SundarNarasimhan
13 hours ago
add a comment |
The problem is the call to itertools.permutations
. It is computing every possible ordering of the array built previously, which for N=6 is:
[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]
I believe this will return (12!)=479001600 items, which your code is then turning into a set to remove duplicates. It never gets that far of course, but if it did, I believe the 479001600 items would be turned into a set of just 924 items.
Not sure what your goal is but maybe what you need for this part is a way to generate that set of 924 items without building the larger list, which has many many duplicates. As I understand it, that part of the code is building the set of arrays of size (2*n) where exactly half of the elements are 0 and half are 1.
Yes I see... Thank you I will try to find easier way out
– SundarNarasimhan
13 hours ago
add a comment |
The problem is the call to itertools.permutations
. It is computing every possible ordering of the array built previously, which for N=6 is:
[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]
I believe this will return (12!)=479001600 items, which your code is then turning into a set to remove duplicates. It never gets that far of course, but if it did, I believe the 479001600 items would be turned into a set of just 924 items.
Not sure what your goal is but maybe what you need for this part is a way to generate that set of 924 items without building the larger list, which has many many duplicates. As I understand it, that part of the code is building the set of arrays of size (2*n) where exactly half of the elements are 0 and half are 1.
The problem is the call to itertools.permutations
. It is computing every possible ordering of the array built previously, which for N=6 is:
[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]
I believe this will return (12!)=479001600 items, which your code is then turning into a set to remove duplicates. It never gets that far of course, but if it did, I believe the 479001600 items would be turned into a set of just 924 items.
Not sure what your goal is but maybe what you need for this part is a way to generate that set of 924 items without building the larger list, which has many many duplicates. As I understand it, that part of the code is building the set of arrays of size (2*n) where exactly half of the elements are 0 and half are 1.
answered 14 hours ago
BampferBampfer
1,200517
1,200517
Yes I see... Thank you I will try to find easier way out
– SundarNarasimhan
13 hours ago
add a comment |
Yes I see... Thank you I will try to find easier way out
– SundarNarasimhan
13 hours ago
Yes I see... Thank you I will try to find easier way out
– SundarNarasimhan
13 hours ago
Yes I see... Thank you I will try to find easier way out
– SundarNarasimhan
13 hours ago
add a comment |
SundarNarasimhan is a new contributor. Be nice, and check out our Code of Conduct.
SundarNarasimhan is a new contributor. Be nice, and check out our Code of Conduct.
SundarNarasimhan is a new contributor. Be nice, and check out our Code of Conduct.
SundarNarasimhan is a new contributor. Be nice, and check out our Code of Conduct.
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%2f55280086%2fjupyter-is-stuck%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
What is your end goal?
– Nathan Wright
15 hours ago
I want to run this for various n and understand how the frequencies of the 1,2, etc in nw depend on n
– SundarNarasimhan
15 hours ago
This code is written to solve a problem in combinatorics...
– SundarNarasimhan
15 hours ago
"The phenomenon of just a few inputs producing a large number of outcomes is called a combinatorial explosion and is something to keep in mind when working with combinations(), combinations_with_replacement(), and permutations()" source
– Antonino
14 hours ago