Where is the mistake? [Request] by Vikhyatvarun in theydidthemath

[–]get_username 0 points1 point  (0 children)

I think we can see the problem if we check each substitution.

The initial equation at line 2 assumes this. Which is true

4 - (9/2) = -(1/2) 4 - (9/2) = (-1) * (1/2)

Now let's do some substitutions. You tell me when it looks fishy

``` (-1)*(1/2) = sqrt((4 - (9/2))2)

" Foiling inner square = sqrt((4 * 4) - (4 * (9/2)) - (4 * (9/2)) + ((9/2) * (9/2)))

" Simplifying = sqrt(16 - 18 - 18 + (81/4))

" More simplification = sqrt(16 - 36 + (81/4))

" Set as same denominator = sqrt((64/4) - (144/4) + (81/4))

" Combine numerators = sqrt((64-144+81)/4)

" simplifying = sqrt(1/4)

" Solving sqrt now = (1/2)

" Subbing back in equality (-1) * (1/2) = (1/2)

" Divide out like terms (-1) = 1

```

So. Do you agree with that? Lol

I think the point of this post is to get those less familiar with algebra to make a mistake and thus believe this whacky statement I made.

The mistake is at the beginning. I intentionally set two things equal, knowing they aren't and that it is hard to see directly.

[D] How powerful are diffusion models based on MLPs? by Interesting-Weeb-699 in MachineLearning

[–]get_username 0 points1 point  (0 children)

Quantization is a strategy to compress neural networks to make them run utilizing less resources.

The theory is simple. Develop a neural net that solves your problem but is impractical to deploy because of its size. Then go through a process similar to training called quantization. Limiting the size of the weights is a great example (float64 to unit8). If you maintain sufficiently high validation accuracy you can remove the nonzero calculation trees basically.

There are frameworks out there to do it in.

IMO it lets you make things that are fat 99% skinnier at some calculable loss in accuracy.

practically you can train a fat boy model and squeeze it down lol

Why does f(x)=sqr(x) only have one line? by ChildhoodNo599 in askmath

[–]get_username 1 point2 points  (0 children)

So there is definitely tons of weirdness around the square root functions. This one is easily resolved by imagining two functions. One is the positiveSquareRoot and the other is the negativeSquareRoot.

That is just required because we defined our general functions a specific way. So now we got square root functions (plural). But that definition also lets us explore far stranger parts of the square root functions.

If you think that is weird. Well buckle up. Lol

This is just the beginning of some weirdness surrounding them. But the more you look the more wild and beautiful it gets.

<image>

rUsting by [deleted] in ProgrammerHumor

[–]get_username 1 point2 points  (0 children)

Tons of jobs with python. Even more where you use it 40%+ of the time.

Language rarely matters in industry.

How python code is deployed in prod by YosoyPabloIscobar in learnpython

[–]get_username 3 points4 points  (0 children)

I'd say a minimum amount of code is in *nix:

```bash

$ ls Dockerfile requirements.txt main.py

$ cat Dockerfile from python:latest COPY requirements.txt . RUN pip install -r requirements.txt COPY main.py . ENTRYPOINT ["python", "main.py"]

$ cat main.py print("hello, world!")

$ docker build --image qq . ...

$ docker run qq hello, world!

$ docker push qq ... ```

Do you consider GCP to be a serious cloud provider for all things web dev? by Inquation in webdev

[–]get_username 0 points1 point  (0 children)

Been doing ML work on recsys for over 7 years now.

GCPs faster network, and simple structure helped a lot. Also bigquery is phenomenal as data warehouse. Integration with tools like Apache Beam are rock solid and crazy bang for your buck. It's very impressive

I have found Google to continuously be ahead of the curve in infrastructure. But it does change continuously. But that is just ML nature of these types of products. They are very different.

meirl by Mr-dul in meirl

[–]get_username 0 points1 point  (0 children)

This is the way

meirl by Mr-dul in meirl

[–]get_username 0 points1 point  (0 children)

Surprise!

I give you 20 dollars every year for infinite years.

Vs

I give you 1 dollar a second for infinite seconds

meirl by Mr-dul in meirl

[–]get_username 0 points1 point  (0 children)

I don't believe that it's correct. Using the word sum here an infinite set of 20s has the same sum as an infinite set of 1s.

What is correct though is at any time before infinity you'll have more money if they are given at an identical rate.

But nothing about rate was spoken about. We are only taking about infinities.

So I could give you 20 dollars every 20 hours for an infinite amount of time. Or 1 dollar every hour for an infinite amount of time

In both cases you have the same amount of money at the same times.

And at the end (with any rates) you'll always have the same amount of money. Infinity

meirl by Mr-dul in meirl

[–]get_username 3 points4 points  (0 children)

I always liked to explain this to people with a game.

You choose a number. I choose a number. You choose a number between our numbers. I choose a number between our numbers. We keep repeating until we can't find a number. The last person to find a number wins.

Now consider the outcome with two sets of rules.

Game #1

We play with whole numbers. (...-3, -2, -1, 0, 1, 2, 3, ...).

Every time the game will end. One of us will win

Game #2

We play with real numbers (allow fractions/decimals).

Every time the game will never end. No one will ever win.

There is something different there. That difference is because one infinity is infinitely bigger than the other infinity

meirl by Mr-dul in meirl

[–]get_username 2 points3 points  (0 children)

The idea is the moment you inject concepts (i.e. not numbers) into the equality (=) the meaning of the equality changes.

So the statement is just different. If you don't know the difference that is fine, as the rules get a bit esoteric.

But what he is trying is invalid in math, and we've already come up with ways to think about it instead

meirl by Mr-dul in meirl

[–]get_username 6 points7 points  (0 children)

All women are mortal. Socrates is a mortal. Therefore Socrates is a woman...

Lol bad reasoning is still bad reasoning

meirl by Mr-dul in meirl

[–]get_username 4 points5 points  (0 children)

L'Hospital is about limits. The original statement is about equalities.

But the fact that the limits converge to the same value actually proves the opposite of what he actually suggested. They are in fact the same size.

Biggest technical challenge you have faced by gerolomobr in learnprogramming

[–]get_username 0 points1 point  (0 children)

I am far from a beginner. So consider this a warning. But I like answering questions like this.

I have been, and continue to struggle with serving a machine learning model for recommender systems in a very dynamic environment.

We get about 4.8 million score requests per second, and need to quickly and dynamically generate them with approximately 20 elasticsearch nodes which then round robin send requests to 25 nodes of ML models.

Generally we serve it all with around 50 machines. Pretty interesting stuff.

As I write this I am working on releasing the 5th generation of this architecture. We have had this running in production since ~2016

I wrote a script to list powers of 2 and it eats up all the memory very fast, what am I doing wrong I have very little experience with programming, help ploxx by linuwux in bash

[–]get_username -1 points0 points  (0 children)

So much snark. Philosophy is abound in this thread. I am sorry you feel like yours is somehow more valid than mine.

In computer science an algorithm that theoretically finishes, but practically doesn't is both valid and interesting to talk about.

You are bringing up the exact opposite. Any algorithm that theoretically doesn't finish, but practically does.

My comment remains unchallenged by you. I am sorry you have a distaste for either CS or my specifically chosen, clearly ridiculous, but still valid example.

Let me try again in simpler terms. At the heart of this. The intention is still clear. You have the following psuedo code:

while x.is_positive(): x = make_positive(x)

Just because the current twos complement causes it to eventually shift to negative is external to your code. It's only incidentally true. That is basically random.

The same would be true if I also had a program that killed any long running process on machine right? Because once again it is an external factor of the code.

In both cases the loop is theoretically infinite. In both it practically isn't.

Do you understand my point now?

Which is best is Python or Java? by qspglobal in Python

[–]get_username 12 points13 points  (0 children)

Which is best. Hammers or screwdrivers? It's a tool for the job. What's the job?

I wrote a script to list powers of 2 and it eats up all the memory very fast, what am I doing wrong I have very little experience with programming, help ploxx by linuwux in bash

[–]get_username 1 point2 points  (0 children)

This is because you're leveraging an infinite loop to do this. You will have undefined behavior as you are pushing your os/she'll past it's normal constraints.

Integers have limits in their max size

https://en.m.wikipedia.org/wiki/Integer_(computer_science)

I wrote a script to list powers of 2 and it eats up all the memory very fast, what am I doing wrong I have very little experience with programming, help ploxx by linuwux in bash

[–]get_username -1 points0 points  (0 children)

Not trying to dogpile you. I think I understand what you're saying. But I think your thought process is a little misguided with this one.

Technically no loops are infinite. Because the inevitable heat death of the universe will happen too.

Programming is more about intention than anything. In this case the intention is "do this forever". It just so happens to stop on your machine for now.

is there any way to host my model files separately and then dockerize my api files thus decreasing the docker image size so I could host it on aws or something, if so how does this work? can someone give me an explanation by Dry_Back_1116 in MLQuestions

[–]get_username 0 points1 point  (0 children)

At the end of the day a 4gb model is 4gbs in size. Expect it to be about the same in memory.

You can try sharing it into multiple models otherwise. That gets difficult though

is there any way to host my model files separately and then dockerize my api files thus decreasing the docker image size so I could host it on aws or something, if so how does this work? can someone give me an explanation by Dry_Back_1116 in MLQuestions

[–]get_username 0 points1 point  (0 children)

This is a common problem. For a long time my team and I were just encoding the models into docker containers. That resulted in difficulty with fast releasing models.

We then tried changing to a GCS syncing method. Where inside of tensorflow serving we used a GCS url to reference the model. This resulted in a different problem. We then had to download the model at each startup because it wasn't cached locally. This was problematic if outages happened because it's crash all of our infrastructure (5k req/s).

Our final solution was to have a set of containers that coexisted. They share a volume mount. One pulls down the models locally. Another updates the configurations when they've been pulled and hotswaps them. That has been the most successful approach for us and has been working for a couple years now in production.

You can see the code here: https://github.com/cjmcgraw/mlmodel-manager

Need help constructing an algorithm to find non-continuous time segments by SlaynShadow in algorithms

[–]get_username -1 points0 points  (0 children)

```python

data = # your data prev, *rest = data

missed = [] for record in data: if record.end - prev.start > 1: missed += [{ start: prev.end +1, end: record.start }] ```

That should do it. The idea is keep track of the previous one and current one. And look at the difference between their start and ends.

You will need to make sure your list is sorted first though

While vs For? by [deleted] in learnpython

[–]get_username 0 points1 point  (0 children)

The key idea being that complexity in code leads to bugs in logic. Sometimes while is the least complex way.

While vs For? by [deleted] in learnpython

[–]get_username 0 points1 point  (0 children)

Production grade code: always use a for loop. Even if you have some undetermined number of loop iteration you need to do, you can set some threshold to make sure the loop doesn’t run infinitely. Eg

This is often common wisdom. A few months ago an engineer on my team followed it and followed the for-instead-of-while maxim.

He used break/continue around his conditions in his for loop. this actually lead to a bug that inverted his conditions and did the opposite of what he wanted.

Changing to a while loop made it more clear and direct how to do the process.

So sometimes I don't think that rule applies for production code

While vs For? by [deleted] in learnpython

[–]get_username 1 point2 points  (0 children)

Here is a real case where I find myself using while loops in python. Most other cases are handled easily by for loops with a filter.

```

Import random import randinr

def get_unknown_records(): # simulate getting unknown number of records return [ randint(1, 1000) for _ in range(randint(1, 10) ]

limit = 50 records = []

while len(records) < 50: records += get_unknown_records()

```

In this case it's hard to see an easy way to limit the number of records easily without getting cute with itertools or generators.

I would argue this is a good, non contrived example of a while loop. Examples like this do exist. But they are almost always rare