Live data from Hacker News

Why train when you can optimize?

justinmeiners.github.io

31–40 of 70 posts

Re: Why train when you can optimize?

#31
post #25

Earlier quoted context omitted.

Periodic function like sin(x) are not a dynamical system so its previous state does not determine the current state. So it should be approximated in that way.

Periodic functions like sin(x) are the solutions to differential equations like dy/dx = -y that describe for example, oscillations of springs, to name but one of an extremely large number of dynamical systems that behave this way.

Of course sine can appear in the solution for dynamical systems but the function itself is not dynamical. When evaluating sin(x) you do not need to know about the previous state.

Re: Why train when you can optimize?

#33
post #28
post #13

Earlier quoted context omitted.

And yet neural networks can solve symbolic integral and derivative problems and differential equations better than other computer algebra programs. Sure one network might fail to compute sin(x) numerically, but another could easily tell you its derivative is cos(x). Turns out they are pretty flexible. Do they need to do everything?

Source? I would be very surprised if there was a neural symbolic PDE solver better than what’s in wolfram mathematica.

Related https://arxiv.org/abs/1806.07366

Re: Why train when you can optimize?

#34
post #31

Earlier quoted context omitted.

Periodic functions like sin(x) are the solutions to differential equations like dy/dx = -y that describe for example, oscillations of springs, to name but one of an extremely large number of dynamical systems that behave this way.

Of course sine can appear in the solution for dynamical systems but the function itself is not dynamical. When evaluating sin(x) you do not need to know about the previous state.

That is true, the problem is with the conclusion you drew from that fact:

> So it should not be approximated in that way.

We can’t conclude a dynamic approximation is a bad approach based purely on the fact the underlying function isn’t dynamic.

The function might nevertheless be easily approximated via dynamics — as in the case of predicting sine from seeing the recent history.

Re: Why train when you can optimize?

#35
post #4

Neural networks can approximate any function, but that doesn’t mean they do so efficiently. Depending on the function, they can require incredible amounts of neurons and training. At their worst, they devolve into a lookup table. It’s not hard to find these examples either. Just try training a neural network to compute sin(x)! This is possible! One of the cool things about neural networks is that you can try to encod…

Shameless plug as I'm the author: Primeclue uses math functions to express models and one of its function is sine. Like here: https://github.com/lukaszwojtow/primeclue/blob/68e3b4c8e9f1a...

Re: Why train when you can optimize?

#36

I've always been interested in reinforcement learning, believing it will magically solve anything I throw at it. Unfortunately, I haven't got it to work everywhere yet. I hoped to learn a couple good RL algorithms and then never have to actually learn the concrete details of optimization, because RL can do almost as good. I don't truly believe this, but I think it is an underlying psychological reason for my love of…

> I hoped to learn a couple good RL algorithms and then never have to actually learn the concrete details of optimization

I think that you can use optimization without having to learn anything about its algorithms (learning the basics is always advised of course, but that takes nowhere near as much effort). Nowadays, an off-the-shelf black-box solver will perform better than a custom implementation in most cases: what you lose in fine-tuning is more than compensated by the implementation quality and the sheer number of algorithms available.

> best resources for branching out from RL to more classical control and optimization

It depends on your problem. For general unstructured (nonconvex continuous) optimization, like the OP, you can use NLopt's documentation as a pragmatic starting point [1].

Optimal control is a whole different thing though, and you may have to start with some academic papers/books. I have been recommended this one [2], but I have not read it.

[1] https://nlopt.readthedocs.io/en/latest/

[2] https://link.springer.com/book/10.1007/978-1-4471-0967-9

Re: Why train when you can optimize?

#37

Earlier quoted context omitted.

> and then your NN can't represent anything else than periodic functions.. This is a quote from the parent comment where you state that NNs with periodic activations can't represent non periodic functions. Siren (what I linked) uses periodic activations and is able to represent non periodic functions.

Oh OK, thanks yes that's what I was looking for! However if this NN can represent non Periodic functions, what cost does the Periodic function support incur on non Periodic function accuracy, if any?

It actually behaves a lot better than non periodic functions in some scenarios. It seems that period functions enable a network to encode positional information within [-1,1]. This is supported by the fact that positional encoding is needed in transformers to make them work.

Re: Why train when you can optimize?

#38
post #25

Earlier quoted context omitted.

It’s hard to walk if you can’t feel your legs. The problem is improperly evaluating the neural network as a function of time, instead of evaluating the network as a function of previous state. When we humans approximate functions (let’s say you’re drawing it on a piece of paper, or waving your arm around) we do not simply look at a clock and feed forward that information directly into our motor neurons. Rather, we ha…

Periodic function like sin(x) are not a dynamical system so its previous state does not determine the current state. So it should be approximated in that way.

It's completely valid and equivalent to formulate trigonometric functions as a dynamic system (x,y-coordinates as you go around the circle using a rotation matrix).

Re: Why train when you can optimize?

#39
post #4

Neural networks can approximate any function, but that doesn’t mean they do so efficiently. Depending on the function, they can require incredible amounts of neurons and training. At their worst, they devolve into a lookup table. It’s not hard to find these examples either. Just try training a neural network to compute sin(x)! This is possible! One of the cool things about neural networks is that you can try to encod…

I have the creeping feeling that soon the field is going to reinvent all of Fourier analysis from scratch.

Re: Why train when you can optimize?

#40
The author claims ML is overused and many problems that could be solved more effectively with optimizations are solved using ML.

If wonder what classes of problems fit this? For sure, I can't imagine how can you tackle sentiment analysis or text classifiers using optimization.

Post reply on HN