Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
Not sure if this is the right place to ask, but does anyone know where the phrase `Embarrassingly parallel' was first coined, or by whom? I'm using it in a maths paper and should probably cite it somehow.

Adbot
ADBOT LOVES YOU

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
I was only going to use it in a throwaway remark at the end of an unimportant section, but now I will use it all over the drat place.

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
The acknowledgements section of my thesis now thanks SH/SC "for clarifying the use of the term `embarrassingly parallel' ". :colbert:

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

csammis posted:

This is CoC, actually, so I'm going to have to write to your professors and invalidate your thesis immediately :colbert:

Theses are like software: it doesn't really matter if something is wrong so long as you fix it at some point.

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
Silly complexity question, is the worst-case cost of merging n sorted lists (each of size O(1) ) into a single sorted list O(n log n)?

Obviously this can be done in O(n log n) time by running your favourite O(n log n) sorting algorithm, but I wanted to double-check that I wasn't being stupid and overlooking some better way.

DoctorTristan fucked around with this message at 20:55 on Jan 13, 2010

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
Once you lay it out like that it's obvious. Thanks.

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

coffeetable posted:

I'm trying to build a primitive election simulator, but one of the things I'm having trouble with is a good way to generate the preference votes: I want them to be "biased" so that some candidates will have a higher ranking on average than others. Anyone know an algorithm for this?

Hooray! A question that's vaguely within my field!

You'll need to define a vector of voting probabilities, so that a given voter votes for candidate 1 with probability p1, for candidate 2 with probability p2, etc. If you already know what voting probabilities you want then you can implement it yourself like AD suggested. Alternatively if you have access to a probability library that has a function for simulating multinomial distributions you can use that.

If you want to simulate a random vector of voting probabilities, then I suggest you model it as a Dirichlet distribution with appropriate parameters. You can simulate from this by renormalising a vector of Gamma random variables - any good probability/stats library should have a function for simulating gamma rvs.

This is also a pretty good reference for random variable simulation, but it's more probability than CS-oriented.

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

coffeetable posted:

yeah, i'm doing something like this at the moment. unfortunately i'm wanting to generate 2-3 million preference ballots (in batches of a thousand or so, generating a new set of probabilities for each)

Ok, if you're simulating large numbers of votes using the same probability vector you should definitely simulate that as a multinomial random variable, using an appropriate prob/stats library.

To clarify what I mean by this, if there are r candidates and n voters cast their votes with identical probabilities (p1,..., pr), then the vector of votes for each candidate (n1,...,nr) has a multinomial distribution. Any good implementation of this will be able to simulate (n1,...,nr) in a time that is O(r), rather than O(n).

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

coffeetable posted:

Ah, I think I messed up - by preference ballot, I meant a ranking of the candidates by preference, not "tick the candidates you like".

Ah ok, I was thinking of a single vote system.

The proble isn't so much about programming as it is the model you put on the voter preferences. You model each voter's preference vote as a (multivariate) random variable; and within each batch each voter has the same (probabilistic) distribution on their preferences.

What distribution do you choose? In principle this is up to you. A simple way is to model each voter's 'liking' for each candidate as a univariate random variable (log-Gaussian, Gamma, Beta or whatever) and have them vote according to their liking rank.

Might be better to move this to the SPE thread if you've any further questions.

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
Open them with macros disabled? Do it in a VM if you really want to be careful?

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

Dominoes posted:

Does anyone know of any resources that track financial news article performance? Doing a Google search for "financial news article track records" doesn't produce relevant results. A random scan of a few financial news articles at any point appears to produce a few vague, but quantifiable predictions over time spans ranging from a week to a year. I'm suspicious that all predictions, including ones from respected sources, are no better than random, since my understanding from statistics is that any better-than-random guess can be leveraged into large profits using derivatives. This includes price changes (or lack-thereof) of any kind.

I'm posting here instead of a finance thread, since I suspect the replies will be less biased. May crosspost later.

There are any number of (paid) services that do things like scrape news sources for company names and push out a feed with the time stamp, ticker and some kind of sentiment score - the usual suspects in the financial data world (Thomson Reuters, Bloomberg, Factset, Nasdaq...) all offer something like this.

If you’re asking whether someone has put together a comprehensive historical dataset of financial news stories, combined this with (expensive) intraday equities data and made the results freely available on the internet, then the answer is no, not that I’m aware of.

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

Dominoes posted:

Nailed it! It wouldn't be too difficult,

Systematically identifying and extracting stock predictions from news articles is a non-trivial NLP problem. Even after that the question of ‘was it accurate?’ is not always obvious (Over what timeframe? Relative to what benchmark?)

Such a study would involve several months work by a skilled team, plus (probably) licensing a few proprietary software libraries and datasets. That is expensive and finance is not an industry people go into in order to give valuable work away for free.

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
On an unrelated note, you currently have class Car inheriting from two other classes, name and model:

code:

class Car(name,model):
    def __init__(self):
         ....

This probably isn’t what you want to do; if you want to express “a Car has a name and a model” then the usual approach would be to make these properties of a Car and set their values when constructing a Car object:

code:

class Car(object):
    def __init__(self, name, model):
        self.name = name
        self.model = model
         ...

DoctorTristan fucked around with this message at 09:42 on Apr 16, 2019

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

Linear Zoetrope posted:

So I'm getting interested in one of my old projects again: making a deckbuilder for Kingdom Hearts Re: Chain of Memories. God Goofy knows why I'd play this game again but I may do it in another playthrough of the series.

So basically, in COM there are sleights you can use to do special attacks, and building a sleight deck is essentially the only tolerable to play the game (in my opinion). Sleights operate on the following principle: you have an ordered (non-shuffled) deck chosen from a larger card list of yours. During combat if you choose an ordered set of 3 cards in the deck whose properties meet some constraint (usually related to something analogous to card "suit" or "color" and sum of the card "ranks"), you permanently remove the first card in the set from combat, temporarily discard cards 2 and 3 (which will be restored next time you go through your deck), and then execute an attack.

The "sleight deck": is basically abusing this mechanic so you can spam the sleight button and win. So for instance, Sonic Blade is a popular sleight for bosses, and to use it you need three cards whose "ranks" (0-9) sum to 20-23 (inclusive), and are all of different "suits" (there are 8 or 9 different attack card suits). So to build a Sonic Blade sleight deck you basically just get out a sheet of paper, write down your cards, and find some order that, for multiple reduction passes discarding the first of 3 cards, the next pass will still have cards that sum between 20-23, and all attack cards are still of different types/suits, for as many passes as possible.

There's also a deck limit, but instead of being number of cards, each card has its own cost and your deck has a cost limit.

A more complex folding sleight, which I only used for the final boss and is a pain to make, is a lethal frame deck. Lethal frame involves specifically the magic card "stop", followed by any two attack cards, rank/suit agnostic. So the trick there is to build the deck so that the first pass is all lethal frames, and then after that it reduces into a normal sleight deck (e.g. Sonic Blade above).

I'm wondering if anyone has any ideas for how to approach this. It seems like a cursed, even harder mashup of the subset sum and knapsack problems since we have 1. a cost limit, 2. the need for subsets to sum to a given range, 3. a hard size of the subset, 4. subsets-of-subsets to consider, 5. order matters, and 6. elements have additional constraints (tags like attack type, magic, etc). I'm leaving out some of the fuzzier constraints you can do when building by hand (e.g. "when we get to the last reduction it's acceptable for me to press left or right once or twice to get more mileage out of the reduction so they don't need to be strictly in order"), because it would just make it even harder. Can anyone think of any strategies for this? The additional constraints break almost every existing DP or approximate solution to subset sum and knapsack I can think of. I'm guessing it'd have to have some sort of heuristic-driven guess and check component because there's absolutely no way to solve it exactly, as well as just hardcoding certain things ("when building this sleight don't even bother to guess cards with value/type <X>"), but the multiple reduction step is the primary thing eluding me. I'm thinking the easiest way would be to build up the "last" reduction first, and then only insert things in the "discard" slots for the higher level, but then there's still the issue of backtracking in case there's a better option.

Have you considered getting obsessed with a different game

The most popular/successful set of techniques for highly constrained discrete programming problems like this are so-called ‘state-space relaxation’ methods. Unfortunately I don’t know these nearly well enough to teach them, and the iirc usual approach is ‘Find a professor who knows about state-space relaxation and agree a consulting fee’.

You might be able to get somewhere with a combination of brute force, heuristics and branch and bound. You didn’t say anything about how big is the card list from which you choose the deck, but if it’s (say) 400 cards, then the number of ordered 3 card combos is about 63 million, and presumably most of those aren’t feasible solutions, so you may be able to get a few steps in (e.g find all feasible 3, 4 card decks) via brute force.

After that I’d try tightening the constraints then progressively loosening them, so eg if you want to solve for decks with a maximum value of 100, do something like:

1) brute force solutions for 3,4 card decks, store them
2) set MaxValue = 1
3) Find candidate solutions by adding cards to the ‘tighter constraint’ solutions found in previous steps,
4) remove any candidate solutions that breach constraints
5) heuristically filter the set of solutions down filter if necessary (if it’s getting too large)
6) store all the solutions for this MaxValue
7) set MaxValue += 1 and repeat from (3)

This may or may not work, and there are a lot of details that it will be up to you to figure out, but it might give you a reasonable starting point.

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
Python and its environment/path fuckery is going to drive me to a killing spree one day.

Is your path the same before/after running activate/deactivate (try echo %PATH% before and after) ?

Is there possibly a naming conflict between the HTK files and something in your python path?

Speculating slightly here, but did you install Anaconda for all users or just for a single user?

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
That entirely depends on what this event is. If it’s Easter Sunday then the only thing you need is a calendar. If it’s the date of the highest recorded temperature in a particular location then you should probably just forecast a date in the middle of summer. If it’s the date of the high point of the S&P 500 in a given year then you are likely wasting your time.

The most commonly recommended introductory text to ML algorithms is still ‘The elements of statistical learning’ by Friedman, Hastie and Tibshirani. Though before you go too crazy with your 50 observations you should search for ‘Overfitting’, ‘Data Snooping’ and ‘Out-of-sample Validation’

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

AgentCow007 posted:

How do you go about converting random bits (like from a hardware RNG) into constrained results? For example if I want to randomly pick from [A-Za-z0-9] (62 values), using 6 bits of random data (64 values), do I have any options besides mod (which would bias the first two characters) or discarding out-of-range values (wasting muh precious entropy)?

You are trying to construct a map from each of 64 possible inputs to one of 62 possible outputs. A simple application of the pigeonhole principle shows that you can’t do this without either (i) at least one output that multiple inputs map to, or (ii) some inputs that map to nothing.

As you point out, doing (i) will bias the distribution of the output, so with a single input your only option is (ii) - if you get one of the unmapped values you throw it away and try again with a fresh rng call (this is known as ‘rejection sampling’)

Alternatively you could do what the poster above suggested and consume additional inputs to generate a longer sequence of outputs - a quick calculation shows you’d need to consume 31 random 6-bit inputs to generate a sequence of 32 random symbols. The benefit of this is that you’re now making fewer calls per symbol to the (presumably expensive ) hardware rng.

(Unless you’re doing something critical like generating cryptographic keys, worrying about ‘muh entropy’ is probably overthinking it and some flavour of prng will usually be fine for the vast majority of use cases )

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

Hughmoris posted:

I've been trying to teach myself the basics of git and contributing to open source. I found some typos in a popular repo, submitted my first PR, and they merged it. I'm now listed as a contributer. :3:

I'm assuming I can put this on my resume now?

Feel no shame; the other applicants certainly won’t.

DoctorTristan fucked around with this message at 19:27 on Apr 14, 2021

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
Speculation, but is the median returning a NaN value (could conceivably happen if there’s missing or bad data)? That would fail both inequalities and hit the ELSE condition.

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

hbag posted:

i uh
im getting this in python
AttributeError: 'dict' object has no attribute 'descendants'

this makes no sense, i thought dicts did have descendants, that was the whole point
idk heres my code lmao
Python code:
            for post in posts:
                #resp_object[post] = 'wahooo'
                resp_object['cum'].append('wahoo')
neither of these worked


What this guy said, also - not saying this is drawn from experience or anything - but you can never really predict where a piece of code you write is going to end up or who might demand to see it, so maybe dance like nobody’s watching but pick variable names like they’ll be read out in a televised courtroom

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

KillHour posted:

Well that's a lot easier to answer. First, findAll has been deprecated and moved to find_all:

Is this… package maintainers actually deciding to give a poo poo about PEP8? :aaaaa:

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
Assuming you’re only going to generate at most few hundred cards per game I don’t see any reason to bother with a hash anyway - just generating a random sequence of cards and retrying any that .equals() any previous card in the sequence will certainly be Good Enough™️

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
This is going to be a horrifically vague question, but is there a good tutorial anywhere on Active Directory, OAuth2, client credential flow and all that? Everything I’ve found so far is either uselessly vague or assumes you already know most of the terminology. (Paid is fine - I can probably swing the training budget)

Background is that I have never had to think about authentication before, but now I’m trying to deploy some dash apps that need to make api calls that require authorisation against some other AD app and I need to gain some idea of what needs to be done here so I can ask one of the AD specialists the right questions.

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

ultrafilter posted:

This came up in another thread and it's a nice little puzzle:

Here's what I've got so far:
  1. Make a guess y_1.
  2. If that's not right, you have a range of possible years [a, b]. Guess a.
  3. If the error gets larger, you know you picked the wrong direction, so the range is now [y_1, b]. If it doesn't, you guessed the right direction, so the range is now [a, y_1].
  4. If the error range you got was the smallest possible, start linearly searching in that range until you get the answer.
  5. Otherwise, guess the midpoint of your current range and go to step two.
Of course, you stop when your guess is right.

Are there any errors I'm not seeing? Is it possible to improve on this?

If you’re eg 3-5 years out then the range is the two disjoint intervals [y-5, y-3], [y+3, y+5].

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

Computer viking posted:

It also looks fairly easy to use the Google drive API to ask for a copy of a file in a given format, as long as the export stays under 10 MB. Possibly useful if you need to automate this on a schedule, though I don't know how often you need to do an interactive OAuth login.

Gonna take a wild guess here that OP does not wish to deal with web apis nor OAuth

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
It’s pronounced like the ‘i’ in ‘linux’

Adbot
ADBOT LOVES YOU

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

Computer viking posted:

I'm case you're joking, that does have one officially correct pronunciation, using i as in Linus as pronounced by a Swedish-speaking Finn. He owns the trademark, and while he didn't name it, it is based on his name; he gets to dictate how it should sound. :)

:thejoke:

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply