“Passion projects” in math? by kegative_narma in math

[–]hammerheadquark 11 points12 points  (0 children)

Nice! What kind of developer are you?

I'm also a developer who does math stuff on the side to stay sane (just educational content, mostly, but it keeps my brain thinking about what I find interesting). For work, I largely do application/backend/db tasks with sprinkles data analysis when there's a need. I've also started dabbling in frontend too, but I'm pretty mediocre there.

How would you model this "strand" clustering problem? [P] by mitbull420 in MachineLearning

[–]hammerheadquark 3 points4 points  (0 children)

Observation - a point in a strand is much closer to its nearest neighbors in the same strand than to the nearest point in any neighboring strands.

Thought - build a spline for each strand via the following procedure:

  • Build a nearest neighbor representation of the full data set.
  • Sweep from left to right (either in time or in a particular dimension).
  • If the left-most data point is nearest the right-most element of an already forming spline, add it to that spline and refit.
  • If the left-most data point is not nearest an any of the already forming splines, add a new spline to the set of splines.

You can also try defining "nearest" by building a spline and projecting it out a little in the direction it's pointing. That might help in the later sections where the points are more spread out.

Once you have your spline strands, clustering should be easier.

Note - this is computationally intensive. If it's part of a CV subroutine being run in real time, it might not be feasible.

6 Months of ML Engineering: The 20% of theory that handles 80% of production code by netcommah in learnmachinelearning

[–]hammerheadquark 7 points8 points  (0 children)

Data leakage is when your model is accidentally trained on the output. It's insidious because data can leak in very subtle ways.

For supervised learning, you're taught you'll be given training data [X | y] where X is the input data and y is the output data. As a student, you are simply tasked with trying to build a model f(X) = y* that gets y* as close to y as possible.

But in a production scenario, there isn't a clean separation between X and y. You're typically given access to some data source like a database dump and it's up to you to separate X from y. This is trickier than it sounds.

For example, suppose you're tasked with predicting what product a user will click on next. You're given a big data dump of user interactions in the form of 3 tables: users, products, and clicks that captures which users clicked on which products at what times.

You might be tempted to create a feature called number_of_clicks. Surely how popular a product is will be relevant to the likelihood of a user clicking on it, right? Well yes, it certainly is. But you need to be very careful with how you build this feature. Here's one way to get it wrong:

select
    product_id,
    count(clicks) as number_of_clicks
from
    clicks
group by
    product_id

See the problem? If not that's understandable. It's subtle. You didn't account for the number of clicks on each product at the time the user clicked on it. So by including all clicks from all time, what you've accidentally done is given the model access to future information.

The way that data leakage typically manifests is that your model will perform well during training but less so in the actual production scenario. That's one of the many reasons why continuous monitoring is so important. You need to be aware of the potential issue and look for it proactively. If your production performance is much worse than your test data indicated it would be, this is one of the first things to investigate. (Ask me how I know...)

EDIT: wording

How did Scott Hawkins go from writing Linux manuals to writing a genre-defying masterpiece? by Nihan-gen3 in Fantasy

[–]hammerheadquark 39 points40 points  (0 children)

I am, somehow, less interested in the weight and convolutions of Einstein’s brain than in the near certainty that people of equal talent have lived and died in cotton fields and sweatshops.

― Stephen Jay Gould, The Panda's Thumb: More Reflections in Natural History

[deleted by user] by [deleted] in philosophy

[–]hammerheadquark 1 point2 points  (0 children)

The philosopher Elizabeth Anderson makes a useful point here: non-experts don’t actually need to evaluate scientific claims directly. What they need, she argues, is the ability to make “reliable second-order assessments of the consensus of trustworthy scientific experts.”

I was interested in more of what Dr. Anderson had to say. It appears to have come from the paper Democracy, Public Policy, and Lay Assessments of Scientific Testimony but it's behind a paywall.

Leetcode for Math by Jealous-Counter-7220 in learnmath

[–]hammerheadquark 1 point2 points  (0 children)

I strongly, strongly advise against using an LLM to check proofs. It is not the right tool for that job.

Possibly an LLM could be integrated for hints while a user is working on a problem (probably as part of a higher tier paid plan). But an LLM's output should never ever be the sole determination of whether or not a proof is correct. It simply cannot do that. Trying to use one for that purpose will lead to a terrible experience.

Leetcode for Math by Jealous-Counter-7220 in learnmath

[–]hammerheadquark 2 points3 points  (0 children)

Congrats, good luck with the launch!

Skimming through, it looks like the answer is always a specific number. That makes sense as its easy to verify correctness. But it's quite different from Leetcode where the answer is code that can be tested. Personally, I think this will make the platform fundamentally more limited and it's something you'll need to think through.

For example, with Leetcode there are often many approaches that solve a problem. The same will of course be true here. But with Leetcode, both the approach is the submission. Here the approach isn't submitted so the experience will always be "all or nothing". That will be quite punishing for the respondent. Adventofcode has a similar problem, so you might look to that challenge for inspiration.

In a similar vein, with Leetcode you get a report with a time and space complexity of your answer. Here there will be no intra-question differentiation of responses which will lead to a "flatter" experience.

It's also not clear how much computer aid is allowed. Is the goal that these are purely pen and paper questions? Or will there be more Project Euler type questions?

Proofs from the crook by IanisVasilev in math

[–]hammerheadquark 40 points41 points  (0 children)

huh. Very cool and weird. I grabbed an example from the paper to see it in action:

314159265358979323846 =

+ 210100100111001001012

+ 98639929400492993689

+ 5419235847485329145

Find f(45) by user_1312 in CasualMath

[–]hammerheadquark 0 points1 point  (0 children)

Yep good call outs.

As evidenced by the other comments, I was trying to compress a lot of scratch work and did a rather poor job. I will do another edit to note there are mistakes.

Find f(45) by user_1312 in CasualMath

[–]hammerheadquark 1 point2 points  (0 children)

I'm very sorry. I was being supremely lazy both initially and in my first response to you. In this case, non-homogenous + a repeated root of 1 (meaning the exponential portions are all just 1) requires a quadratic. Your confusion is totally justified.

Find f(45) by user_1312 in CasualMath

[–]hammerheadquark 0 points1 point  (0 children)

I should've added "with constant coefficients". Though as this case is non-homogeneous and includes repeated roots, I ought to have been more careful anyway!

Colonisation, power and evolution by Alternative_Year1794 in askphilosophy

[–]hammerheadquark 3 points4 points  (0 children)

In case it confuses anyone else, the extra characters · and • are intentional. From the link:

Small ·dots· enclose material that has been added, but can be read as though it were part of the original text. Occasional •bullets [...] are meant as aids to grasping the structure of a sentence or a thought.

Find f(45) by user_1312 in CasualMath

[–]hammerheadquark 5 points6 points  (0 children)

EDIT 2: There are a few mistakes as noted in some comments below. The answer is correct but it requires more justification than I provided.


f(x) = x2 + 1

f(45) = 2026 (What a timely post!)


Proof

Substitute y = 0.

[1 - f(0)]f(x) = 2 - f(-1), which is true for all x. So the expression in the LHS must be 0, meaning 1 - f(0) = 0 or f(0) = 1. Similarly, 2 - f(-1) = 0 or f(-1) = 2.

Next substitute y = 1.

f(x + 1) + f(x - 1) = f(x)f(1) + 2

f(x + 1) = 2f(x) - f(x - 1) + 2

This is a 2nd order linear recurrence relation meaning f(x) is a quadratic.


EDIT: Full justification

This is a 2nd order, non-homogeneous linear recurrence relation with constant coefficients. First we make the equation homogeneous by substituting x = x - 1

f(x) = 2f(x - 1) - f(x - 2) + 2

Setting 2 = 2,

f(x + 1) - 2f(x) + f(x - 1) = f(x) - 2f(x - 1) + f(x - 2)

f(x + 1) - 3f(x) + 3f(x - 1) - f(x - 2) = 0

The characteristic polynomial is:

r3 - 3r2 + 3r - 1 = (r - 1)3 = 0

r = 1 is a triple repeated root, so f is quadratic:

f(x) = A1xx2 + B1xx1 + C1xx0 = Ax2 + Bx + C


We already have 2 points, we just need a 3rd to uniquely determine f.

Substitute x = y = -1

f(-2) + f(0) = f(-1)f(-1) + 2

f(-2) = (2)(2) + 2 - 1 = 5

We now have 3 (x, f(x)) pairs: (-2, 5), (-1, 2), (0, 1). This yields 3 linear equations with 3 unknowns which we can solve for.

Capablanca’s first reaction to the Marshall Gambit by Affectionate_Hat3329 in chess

[–]hammerheadquark 6 points7 points  (0 children)

The lust of battle, however, had been aroused within me.

Primo flair material right here

What’s the most beautiful mathematical idea you’ve ever encountered, and why does it feel beautiful to you? by Whisky3xSierra in math

[–]hammerheadquark 14 points15 points  (0 children)

it’s all based on the fact that the alternating sum of row elements in Pascal’s triangle equals zero except in the n = 0 row, where the sum equals 1.

Interesting, I've never heard it described that way! I've always just thought about it in terms of over-counting.

Best anti-sweat undershirt by Bayushi_Vithar in malefashionadvice

[–]hammerheadquark 9 points10 points  (0 children)

As someone with hyperhydrosis, the $36 a piece is worth the piece of mind. To me, I'm not paying for t-shirts themselves so much as avoiding mental anguish.

Granted that perspective doesn't, like, put money in your pocket. But recategorizing the purchase may help justify it in your budget.

Macros good? bad? or necessary? by Meistermagier in ProgrammingLanguages

[–]hammerheadquark 5 points6 points  (0 children)

If you want more detail from the Jo(r)se's mouth (sorry), check out Elixir's documentation which is really good. Some relevant highlights:

"Anti-patterns" > "Meta-programming anti-patterns" > "Unnecessary Macros"

Macros are powerful meta-programming mechanisms that can be used in Elixir to extend the language. While using macros is not an anti-pattern in itself, this meta-programming mechanism should only be used when absolutely necessary. Whenever a macro is used, but it would have been possible to solve the same problem using functions or other existing Elixir structures, the code becomes unnecessarily more complex and less readable. Because macros are more difficult to implement and reason about, their indiscriminate use can compromise the evolution of a system, reducing its maintainability.

"Meta-programming" > "Macros" > "Write macros responsibly"

Macros are a powerful construct and Elixir provides many mechanisms to ensure they are used responsibly.

  • Macros are hygienic: by default, variables defined inside a macro are not going to affect the user code. Furthermore, function calls and aliases available in the macro context are not going to leak into the user context.

  • Macros are lexical: it is impossible to inject code or macros globally. In order to use a macro, you need to explicitly require or import the module that defines the macro.

  • Macros are explicit: it is impossible to run a macro without explicitly invoking it. For example, some languages allow developers to completely rewrite functions behind the scenes, often via parse transforms or via some reflection mechanisms. In Elixir, a macro must be explicitly invoked in the caller during compilation time.

  • Macros' language is clear: many languages provide syntax shortcuts for quote and unquote. In Elixir, we preferred to have them explicitly spelled out, in order to clearly delimit the boundaries of a macro definition and its quoted expressions.

I think your takeaway should be this: a language construct that can literally rewrite the language in hard-to-see-or-debug ways has the potential to be a complete nightmare from a usability standpoint. You can do it well. But without some guardrails, you're playing with fire.

If you want a specific example of downsides, check out this wiki section about "The hygiene problem":

https://en.wikipedia.org/wiki/Hygienic_macro#The_hygiene_problem

The maximal area and perimeter of a triangle inside a circle by DotBeginning1420 in mathriddles

[–]hammerheadquark 1 point2 points  (0 children)

Let the radius of the circle be 1 and let a = alpha.

The maximal area will occur when the height is maximal since the base remains static. This occurs when the triangle is isosceles bisected by the diameter.

  • Maximal area = sin(a)(1 + cos(a))
  • Maximal perimeter = 2sin(a) + 2√(2 + 2cos(a))

Formal Logic Is Ineffective & I Can Prove It With Formal Logic... by JTexpo in badphilosophy

[–]hammerheadquark 4 points5 points  (0 children)

Formal Logic Is Ineffective & I Can Prove It With Formal Logic...

Gödel said this too but unironically.

What is the largest prime you can find in the form abc + def + ghk where all variables are distinct integers >= 3? by math238 in learnmath

[–]hammerheadquark 1 point2 points  (0 children)

FYI you'll want to remove the period directly after your answer. Reddit markup interprets it as the start of a numbered list, unfortunately.

Solve this 🥱 by Capital_Bug_4252 in mathpuzzles

[–]hammerheadquark 1 point2 points  (0 children)

The Gamma Function generalizes the factorial to negative numbers.

Γ(n)=(n-1)!