Install Theme

Does anyone know why scikit-learn is (pervasively) designed to raise exceptions whenever anything is a little unusual in a way that could maybe cause problems down the line, even if it’s not causing problems now?

Like, it has all these checks for things like whether data has the right type(s), or the right number or dimensions, or the right range of values in it, or whatever – where “right” usually means “necessary for doing something that is commonly done with this value at some point.”  But instead of applying these checks only when it’s about to do something that requires those properties, it applies them continually, again and again, inside every tiny moving part, even parts that have no reason of their own to care about the properties.  And instead of raising warnings, it raises exceptions, i.e. it just stops and refuses to continue.

This requires some pretty ridiculous workarounds if you want to do a lot of things that would be straightforward in other big Python libraries or just Python itself.  Is there some secret good reason it’s built this way?

In the Kingdom of Javaland, where King Java rules with a silicon fist, people aren’t allowed to think the way you and I do. In Javaland, you see, nouns are very important, by order of the King himself. Nouns are the most important citizens in the Kingdom. They parade around looking distinguished in their showy finery, which is provided by the Adjectives, who are quite relieved at their lot in life. The Adjectives are nowhere near as high-class as the Nouns, but they consider themselves quite lucky that they weren’t born Verbs.

Because the Verb citizens in this Kingdom have it very, very bad.

In Javaland, by King Java’s royal decree, Verbs are owned by Nouns. But they’re not mere pets; no, Verbs in Javaland perform all the chores and manual labor in the entire kingdom. They are, in effect, the kingdom’s slaves, or at very least the serfs and indentured servants. The residents of Javaland are quite content with this situation, and are indeed scarcely aware that things could be any different.

Verbs in Javaland are responsible for all the work, but as they are held in contempt by all, no Verb is ever permitted to wander about freely. If a Verb is to be seen in public at all, it must be escorted at all times by a Noun.

Of course “escort”, being a Verb itself, is hardly allowed to run around naked; one must procure a VerbEscorter to facilitate the escorting. But what about “procure” and “facilitate?” As it happens, Facilitators and Procurers are both rather important Nouns whose job is is the chaperonement of the lowly Verbs “facilitate” and “procure”, via Facilitation and Procurement, respectively.

The King, consulting with the Sun God on the matter, has at times threatened to banish entirely all Verbs from the Kingdom of Java. If this should ever to come to pass, the inhabitants would surely need at least one Verb to do all the chores, and the King, who possesses a rather cruel sense of humor, has indicated that his choice would be most assuredly be “execute”.

The Verb “execute”, and its synonymous cousins “run”, “start”, “go”, “justDoIt”, “makeItSo”, and the like, can perform the work of any other Verb by replacing it with an appropriate Executioner and a call to execute(). Need to wait? Waiter.execute(). Brush your teeth? ToothBrusher(myTeeth).go(). Take out the garbage? TrashDisposalPlanExecutor.doIt(). No Verb is safe; all can be replaced by a Noun on the run.

In the more patriotic corners of Javaland, the Nouns have entirely ousted the Verbs. It may appear to casual inspection that there are still Verbs here and there, tilling the fields and emptying the chamber pots. But if one looks more closely, the secret is soon revealed: Nouns can rename their execute() Verb after themselves without changing its character in the slightest. When you observe the FieldTiller till(), the ChamberPotEmptier empty(), or the RegistrationManager register(), what you’re really seeing is one of the evil King’s army of executioners, masked in the clothes of its owner Noun.

(Steve Yegge, “Execution in the Kingdom of Nouns”)

On the subject of “memories of my youthfully vigorous college self that are linked to dorky female-vocalist metal bands” –

Because I was listening to it a lot at the time, this song (specifically this orchestral version) became strongly linked in my mind to this big Wittgenstein-ish / Natural Language-ish revelation about philosophy that suddenly appeared in my brain out of nowhere over the course of a few days, back in winter break of sophomore year

The feeling of something gliding buoyantly and unopposedly forward fit the feeling that this revelation (centered around the phrase “the only thing philosophy can do is formalize our intuitions”) cut through many famous philosophical puzzles like butter, and even song’s somewhat tacky quality (that saxophone solo!) seemed to fit too – I was demonstrating that all of this Very Smart And Serious Stuff was inane child’s play, and thus that all other hierarchies of taste might be suspect too, and thus that I could listen to whatever kind of music I wanted, mom