News for hackers. Stuff that matters.

GChevalier

Re:Why “alias” is my last resort for aliases on Wednesday March 05, 2025 @09:50AM (#43267218)
Another option is to create functions in the bashrc, they can contain logic like the suggested bin approach.
Re:Multi-Layered Calendars on Thursday July 06, 2023 @10:45PM (#36626423)
This is amazing. I want this.
Re:Open source is not about you (2018) on Saturday July 02, 2022 @11:14AM (#31959715)
I admit I chuckled at "You are not entitled to this explanation" while reading the article. How far can it go xD
Re:Maybe visual programming is the answer, maybe not on Sunday April 26, 2020 @01:13AM (#22984676)
Please someone do a PyCharm plugin for this!
Re:Maybe visual programming is the answer, maybe not on Sunday April 26, 2020 @01:10AM (#22984652)
You make me think of Azure ML studio.
Re:Theories of Error Back-Propagation in the Brain on Sunday August 11, 2019 @04:32AM (#20667081)
> "The relationship of spike-time-dependent plasticity to other models requires further clarifying work"

- I got something for that, in fact I think I discovered that backpropagation engenders STDP:

https://github.com/guillaume-chevalier/Spiking-Neural-Networ...

Re:Theories of Error Back-Propagation in the Brain on Sunday August 11, 2019 @04:31AM (#20667077)
> "The relationship of spike-time-dependent plasticity to other models requires further clarifying work"

- I got something for that, in fact I think I discovered that backpropagation engenders STDP:

https://github.com/guillaume-chevalier/Spiking-Neural-Networ...

Re:How to Linear-Fit a Noisy Signal with Regular Discontinuities on Wednesday January 02, 2019 @04:55PM (#18810631)
Thanks for pointing out to "phase unwrapping", I didn't know it had a name! Interesting.
Re:How to Linear-Fit a Noisy Signal with Regular Discontinuities on Wednesday January 02, 2019 @04:52PM (#18810599)
Also, I forgot: to improve convergence, I'd use an Hann-Poisson window such as here: https://en.wikipedia.org/wiki/Window_function#Hann%E2%80%93P...

I'd apply the window to randomly-sampled mini-batches of consecutive points instead of optimizing the neural network on just randomly-sampled batch points or on all the dataset at once. I guess that using an Hann-Poisson window will make the "gradient" valley easier to "ski down" with gradient descent which is a greedy algorithm. I guess that the spectral leakage caused by the Hann-Poisson window function will make the gradient landscape more monotonically decreasing in every point towards the global minima.

Re:How to Linear-Fit a Noisy Signal with Regular Discontinuities on Wednesday January 02, 2019 @04:06PM (#18810193)
I would have instead done like this:

(tldr; use a sine and cosine function regression like a linear regression. Think like solving for a free angle and a free phase instead than for a free bias and weight).

1. Convert the hours to an angle in degrees or in radians (a simple linear transformation).

2. Take the cos and sin of the angle to get the x and y position in a plane, respectively.

3. Introduce a time axis such that the thing doesn't draw a circle but rather an helix (like DNA).

4. So we now have a ton of 3D data points: (time, x, y). Create a ML model to fit a sine and a cosine to those data points to match them perfectly. Your model has only 2 free parameters to optimize for: a shared phase offset and a shared frequency. The sine uses (time, y) and the cosine (time, x).

5. Initialize the model with a random phase offset and a frequency ideally already close to the one you think you have. Don't initialize with a too high frequency to avoid fitting just Nyquist-frequency-close-noise.

6. Optimize! (With the least squares.) I guess that you might congerge only to a local minima and need to try different randon starting frequencies if you fail to converge.

7. The answer to your problem is the now-optimized free parameter of the frequency. It won't sit between two bins of your fft anymore.

Related: https://stackoverflow.com/questions/16716302/how-do-i-fit-a-...

Note: This link contains images picturing the transformations I try to explain.

Disclaimer: I didn't do that yet, this is just off the top of my head. If I said something wrong, please comment. Mostly about a wrong convergence to Nyquist freq or something like that (?).

In the end, this way, you won't have discrete fft bins. You'll approach the problem orthogonally to that: you solve for finding the one best fft bin (frequency) directly.

In other words: solve for the content in the exponential of "e" as free parameters, and for one such frequency and phase offset instead of many bins.

Re:How to Grow Software Architecture out of Jupyter Notebooks on Wednesday December 12, 2018 @03:43PM (#18667578)
Also, you should be able to use your favorite editor for the code outside notebooks (over time, more and more of the code will be outside of your notebook). You might often work in the editor, and at other times in the notebook depending on the nature of the work. As the project advances, notebooks will become less and less important, they only kickstart projects.
Re:How to Grow Software Architecture out of Jupyter Notebooks on Wednesday December 12, 2018 @03:39PM (#18667538)
Never tried macOS, but matplotlib works fine under Windows and Linux. Maybe you could save plots to images on disks and prevent them to show? I once ran code that used PLT on a server and I needed to use something like `matplotlib.use('Agg')` to prevent the code from crashing because of lacking graphical output.

See this SO answer: https://stackoverflow.com/a/34583288/2476920

Personally, I love to have notebook cells to be able to code without re-running everything. Especially in the case of deep learning, training a model is long. Jupyter is very good for creating and debugging code that: A) needs a trained model loaded for it to work but you want to skip the part of saving/loading the model, or B) code that saves-then-load a model.

If the "mutable state with global variables" drives you crazy, you may want to avoid reusing the same variable names from one cell to another, and reset the notebook more often. Also, avoid side effects (such as writing/loading from disks) and try to have what's called pure functions (e.g.: avoid singletons or service locators, pass references instead). If your code is clean and does not do too much side effects, you should be able to work fine in notebooks without having headaches.

EDIT: typo.

Re:How to Grow Software Architecture out of Jupyter Notebooks on Wednesday December 12, 2018 @02:07PM (#18666746)
Author here.

Whoa, thank you all for the nice comments, I didn't expect to make such a buzz here nor today. I'm glad to see the reactions - even the bad ones, it seems aligned with what I thought. Yes, notebooks are very useful for the faster coding cycle, but they become easily heavy (I'd love to see a better multiline edit and a better autocompletion in Jupiter).

Seems like I already posted my article 2 months ago, but renamed the GitHub repo since then, which may explain why someone else (jedwhite) could submit my article again: https://news.ycombinator.com/item?id=18339703

I didn't submit it twice to HN. Well, nice to see that in a parallel world my post did the 1st page on HN! :-)

But could this mean that my HN account is like "shadow banned" or something? Strange to see that all my own submissions on HN haven't got much attention for months. Or maybe it's just the random factor... Well, thanks!

Re:Analyzing My Google Location History on Friday November 23, 2018 @01:23AM (#18514735)
> How can Google possibly predict activity type between IN_TWO_WHEELER_VEHICLE vs IN_FOUR_WHEELER_VEHICLE ?!

Could they be using this from accelerometer data instead of GPS? https://github.com/guillaume-chevalier/LSTM-Human-Activity-R...

Re:Ask HN: How can I learn to read mathematical notation? on Thursday November 22, 2018 @12:02PM (#18511096)
For maths and machine learning, Khan Academy and Coursera can get you somewhere.
Re:Swiss experiment with sound to make cheese tastier on Monday November 05, 2018 @03:44AM (#18380806)
Advertisement at it's finest: I was suggested to buy an oscilloscope on that page
Re:Apple's New Map on Friday November 02, 2018 @05:15AM (#18361610)
Perhaps they simply used a U-Net?
I submitted it to HN too, why not! Here: https://news.ycombinator.com/item?id=18339703
I recently wrote on how to build/grow clean software out of Jupyter notebooks and on pitfalls to avoid when coding like that: https://github.com/guillaume-chevalier/How-to-Grow-Neat-Soft...

Older »