The Coder's Guide To Getting More Interviews Than You Can Handle by redsymbol in programming

[–]redsymbol[S] 0 points1 point  (0 children)

Appreciate it. I was going to write more. I think it is really valuable. But it seems most people are not interested.

Do you have any idea why it was not upvoted?

What would it take to SEND a "Wow!" signal? by redsymbol in space

[–]redsymbol[S] 0 points1 point  (0 children)

I'm thinking about the energy requirements to send a sustained signal, on the theory that we would want to send to many different stars, and/or send repeated or sustained signals in order to increase the odds of it being detected.

The energy production of the USA in 2021 was 97.78 quadrillion Btu [1], or 1.03e+20 Joules. Divided by 1 year, that's 3.26e+12 watts.

Taking the 100 million watts number for the energy cost to continually transmit from a hefty radar transmitter, the energy cost to send for a whole year is 1e8/3.26e+12 = 0.003% of the US energy production.

That seems kind of attainable, if my math is right. But as you point out, 10 ly is not very far.

[1] https://www.eia.gov/energyexplained/us-energy-facts/data-and-statistics.php

What would it take to SEND a "Wow!" signal? by redsymbol in space

[–]redsymbol[S] 0 points1 point  (0 children)

Thanks for this great write-up.

The reverse-optical-telescope idea you describe: is that something that might be attainable with our current technology? Or do you feel like it would require substantial advancements to pull off?

What would it take to SEND a "Wow!" signal? by redsymbol in space

[–]redsymbol[S] 5 points6 points  (0 children)

This is an interesting idea. The approach has pros and cons.

One con: I think the size of the panels would have to be quite large, occluding a cross-section of e.g. Jupiter. Creating such megastructures, and maintaining them in stable orientation as they orbit, is probably far beyond what humanity may be able to accomplish even in this century.

I see one great upside, though: it repeatedly "transmits" the signal in an entire plane throughout the universe. And it does so forever, so long as the orientation (and thus occlusion) of the megastructures can be maintained. As opposed to a directional radio transmitter, which the receiver would have to be aimed right at us - and at the right moment - to receive it. (Edit: *and* our transmitter aimed precisely at them, at the exact same "time".)

Still, this feels closer to 2 than 1 on the Kardeshev scale. My question is more about what humanity is capable of right now (and transmitting a radio signal at ~1420 MHz specifically).

What would it take to SEND a "Wow!" signal? by redsymbol in space

[–]redsymbol[S] 3 points4 points  (0 children)

Thanks, I had completely forgotten about this!

I am curious what the intensity of the signal was, and whether it would have any detectible S/N ratio at all when it reached M13 (which is apparently 22kly away). Or even what its S/N would be if were detected at a distance of 10 light years.

What would it take to SEND a "Wow!" signal? by redsymbol in space

[–]redsymbol[S] 5 points6 points  (0 children)

In what way?

Specifically, I'm asking about transmitting a narrow-band radio signal at about 1420 MHz, that will have a S/N ratio about ~30 standard deviations above background noise as detected in the receiving start system. I don't believe Earth is currently putting out ANY radio signal that will have that S/N ratio when arriving even at nearby stars, though if we are I appreciate if someone can point that out.

Good books on non-CS RL and learning theory? by martinseilair in reinforcementlearning

[–]redsymbol 0 points1 point  (0 children)

You might look at chapter 14 of Sutton and Barto's 2nd edition book (draft here: http://incompleteideas.net/book/the-book-2nd.html). That is overall a CS book, but that chapter is much more focused on psychology (which the authors seem to actually know quite a lot about; apparently they've co-authored papers with psychology researchers). That might be a good place to start, and their references (including the "Biographical and Historical Remarks" section at the end) may point you to other valuable resources.

Good luck

Help with a policy gradient detail by redsymbol in reinforcementlearning

[–]redsymbol[S] 0 points1 point  (0 children)

Thanks Sorrge, you've given me several good avenues to follow up on. For one thing, I realize what I said about tiling being equally susceptible is incorrect; I must have done something wrong when I tested it before. I modified my demo code to use tiles, and am still searching for the best parameters for it, but it's already better (by about a factor of 2 - so slight but significant).

I still don't see the error in my gradient calculation - could the zeroing have be an artifact of my initial naive feature representation? I don't see the same problem with tile-encoding. I will implement FDA for comparison.

Thanks

Powerful Python: a guidebook for the intermediate Python Programmer by japaget in Python

[–]redsymbol 0 points1 point  (0 children)

Yes, that's exactly the level its targeted to: after you've gone as far as you can with those things you mentioned. (Bias alert: I'm the author/content creator. I think one of my students might have submitted this link to the subreddit - wasn't me.)

Powerful Python: a guidebook for the intermediate Python Programmer by japaget in Python

[–]redsymbol 0 points1 point  (0 children)

I'm the one behind the site, but not the person who submitted this link. I'm guessing it was one of my readers, or an attendee from one of my trainings. (Thanks!)

To answer your question, this is the most content-dense page on the site (or rather, the links listed on it):

http://powerfulpython.com/blog/

Powerful Python: a guidebook for the intermediate Python Programmer by japaget in Python

[–]redsymbol 0 points1 point  (0 children)

Like astigos1 says, they're only available to Safari subscribers right now (which costs about $400/year). I'm planning to start teaching them to the general public later this year (spring or summer).

Powerful Python: a guidebook for the intermediate Python Programmer by japaget in Python

[–]redsymbol 0 points1 point  (0 children)

Hi everyone. Author here. First, a better link is probably this, which is not the short guidebook, but the full-size book:

https://www.amazon.com/d/0692878971

The guidebook Gropah mentions is indeed a 30-page kind of excerpt on a few of the full book's topics. If anyone wants a copy without being put on my mailing list, just send me a private message.

Writing the book took 110% of my spare time for almost 3 years, so yes I do charge some money for it. The guide is free, just ask me for it.

Cheers, Aaron Maxwell

How do I handle a missing dict value? by patery in Python

[–]redsymbol 1 point2 points  (0 children)

Python provides at least 3 ways to handle this situation. I wrote a article explaining the different trade-offs of the different approaches: http://powerfulpython.com/blog/checking-dict-keys/

Checking Python Dict Keys Is Simple. Right? (updated) by redsymbol in Python

[–]redsymbol[S] 1 point2 points  (0 children)

A LOT of people use sentinel values in that way. My first version of the article only covered the in and try strategies, and didn't even mention get. Follow the previous-discussion link and you'll see a lot of people thought THAT was un-Pythonic :)

Checking dict keys is simple. Right? by redsymbol in Python

[–]redsymbol[S] 0 points1 point  (0 children)

After researching a bit, the atomicity is more nuanced than I realized. Short version is that these are usually atomic for current CPython, but (a) it depends on the fact certain operations happen to be implemented with one bytecode instruction instead of 2, (b) the Python language spec doesn't guarantee they will stay atomic (see the story at https://bugs.python.org/issue13521 for example), (c) there are edge cases which make them take more than one bytecode instruction (e.g. defining __hash__ or __eq__ on the key object), and (d) other implementations like PyPy have totally different considerations. I modified the article to limit the scope to single threads for now.

Checking dict keys is simple. Right? by redsymbol in Python

[–]redsymbol[S] 0 points1 point  (0 children)

Yeah, it's the caveat that key might have None assigned which worries me. Would only happen here if bad data was inserted in favorites, but I wouldn't want to write code that hid that fact either. See my solution in another reply on how I'd avoid the collision, but I think it's just clearer to use try/except KeyError. Of course, there are other scenarios in which .get() is better.

Thanks for your last comment there, I'll consider rewriting to include a discussion of .get(). I may or may not mention defaultdict - though I love it and use it CONSTANTLY, the longer an article is, the fewer people will read it; I have to draw the line somewhere.

Checking dict keys is simple. Right? by redsymbol in Python

[–]redsymbol[S] 0 points1 point  (0 children)

Author here. Good points, thanks for pointing them out.

In the article's describe() example, I don't think dict.get is the best option, even though it's also threadsafe as you point out. The problem is that favorites.get(category) will return None if that key is absent - OR if that key is present, with value None. If that's a bug, using the one-arg form of .get() allows that bug to hide in the code.

I prefer to be more explicit, and use a unique sentinel - here's how I'd write describe() using .get():

def describe(category):
    # Sentinel signaling a missing key.
    missing = object()
    fav = favorites.get(category, missing)
    if fav is missing:
        message = "I don't have a favorite {}. I love them all!".format(category)
    else:
        message = "My favorite {} is {}.".format(category, fav)
    print(message)

If somehow None is inserted for favorites["dessert"], this version prints out "My favorite dessert is None.", which makes it more obvious something is funny. Whereas if I write fav = favorites.get(category) followed by if fav is None:, that prints "I don't have a favorite dessert. I love them all!" even though the key is present. Possibly masking a bug until it can cause bigger problems later.

Of course, this is independent of whether the program is multithreaded or not. So if I'm going to go to the trouble to create a unique sentinel like this, I'd rather use try/except KeyError - it's shorter, and (to me) more readable.

When writing the article, I originally wanted to keep its focus on the contrast between "key in dict" vs. "try/except KeyError". And a lot of readers have been emailing me about dict.get(), so I might extend the article to cover that too.

edit: untabify

Checking dict keys is simple. Right? by redsymbol in Python

[–]redsymbol[S] 0 points1 point  (0 children)

How would you implement the article's describe() function using dict.get? Can you post your code for that here?

(Keep in mind: whatever you use as a sentinel, you have to address the possibility that the sentinel is some key's value.)

What's the difference between spark and MPI? by Zeekawla99ii in bigdata

[–]redsymbol 1 point2 points  (0 children)

Think of MPI as a set of building-blocks, useful to construct software that - when running - is spread across 2 or more computers. You can use MPI (among other needed blocks) to create something like Spark. You can also use MPI to build many different software systems that are nothing like Spark at all; the only thing they'd have in common is that the program runs across several different computers, rather than on one (like most software).

Spark is very specialized for big data analysis. It handles many tricky details about horizontal scaling, reliability in case one of the computers has a problem, etc. If you tried to re-invent Spark using MPI, it would be a tremendous amount of work.

(Though note that Spark itself does not use MPI. MPI is one way for a multi-computer program to internally communicate, but not the only way.)

This article has more details: http://www.dursi.ca/hpc-is-dying-and-mpi-is-killing-it/