HN user

GChevalier

159 karma

Feel free to connect with me.

https://ca.linkedin.com/in/chevalierg

https://github.com/guillaume-chevalier/

https://twitter.com/guillaume_che

Posts40
Comments27
View on HN
www.neuraxle.org 5y ago

Neuraxle – A Clean Machine Learning Framework

GChevalier
27pts0
guillaume-chevalier.com 6y ago

No Fear for Deep Learning

GChevalier
2pts0
github.com 6y ago

Perfect Empty Python Project Template

GChevalier
3pts0
www.youtube.com 6y ago

Growing Neat Software Architecture from Notebooks

GChevalier
2pts0
www.neuraxio.com 6y ago

How to Code Neat Machine Learning Pipelines

GChevalier
5pts0
guillaume-chevalier.com 7y ago

LSTM for Human Activity Recognition

GChevalier
2pts0
porter.io 7y ago

Porter.io: A GitHub Repository Analyzer

GChevalier
1pts0
github.com 7y ago

Just What You Need to Start a New Python Project

GChevalier
3pts0
stackoverflow.com 7y ago

Figuring Out Embedding-Free Neural Networks for NLP: Reproducing Research

GChevalier
3pts0
github.com 7y ago

How to Grow Neat Software Architecture Out of Jupyter Notebooks

GChevalier
4pts0
github.com 7y ago

Conv library for convolutional loops: no, you won't code this from scratch again

GChevalier
1pts1
www.youtube.com 7y ago

TensorFlow 2.0 Changes

GChevalier
1pts0
montrealaisymposium.com 8y ago

Montréal AI Symposium

GChevalier
14pts0
github.com 8y ago

EOSJS Python Wrapper

GChevalier
2pts0
www.neuraxio.com 8y ago

Neuraxio Consulting – Take action on your data

GChevalier
1pts0
github.com 8y ago

LARNN: Linear Attention Recurrent Neural Network

GChevalier
1pts0
twitter.com 8y ago

You can now “pip install conv” to convolve on your iterators

GChevalier
1pts0
github.com 8y ago

Machine Learning: Attention Mechanisms Decoder Trees for Code Generation

GChevalier
4pts1
github.com 8y ago

Coding Google's Heat Dissipation Challenge in TensorFlow

GChevalier
2pts0
gist.github.com 8y ago

A Little Python Coding Kata: Geometric Series of Sine Waves

GChevalier
2pts0
webtorrent.io 8y ago

JS torrent upload and download library (in-browser)

GChevalier
2pts0
medium.freecodecamp.org 8y ago

Explained Simply: How DeepMind taught AI to play video games

GChevalier
3pts0
github.com 8y ago

PyTorch Machine Learning Tutorials from MILA

GChevalier
4pts0
github.com 8y ago

Awesome ASETIN, for tech students in Quebec

GChevalier
1pts0
github.com 8y ago

Python Algorithm to Smoothly Blend Image Patches

GChevalier
2pts0
news.startup.ml 8y ago

Site Like HackerNews for Machine Learning

GChevalier
2pts0
vooban.com 8y ago

Satellite Image Segmentation: A Workflow with U-Net

GChevalier
1pts0
vooban.com 8y ago

Hyperopt Tutorial for Optimizing Neural Networks’ Hyperparameters

GChevalier
2pts0
twitter.com 8y ago

TensorFlow stars on GitHub by user profiles' public location

GChevalier
3pts0
blog.otoro.net 8y ago

Hyper Networks: An RNN that changes the weights of an RNN

GChevalier
135pts16

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.

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.

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.

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.

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!

I see here that original poster (OP) of the post tried to use many-to-one LSTMs instead of many-to-many LSTMs. I tell that first by looking at the charts. Then I saw the method named "predict_point_by_point" with the comment "Predict each timestep given the last sequence of true data, in effect only predicting 1 step ahead each time" in his code here: https://github.com/jaungiers/LSTM-Neural-Network-for-Time-Se...

I strongly think the system would be better to perform many predictions at once instead, using seq2seq neural networks. The problem is properly explained here at the beginning of this other post: https://github.com/LukeTonin/keras-seq-2-seq-signal-predicti... This other post is, in turn, derived from my original project here doing seq2seq predictions with TensorFlow: https://github.com/guillaume-chevalier/seq2seq-signal-predic...

OP also forgot to cite the image I made: https://en.wikipedia.org/wiki/Long_short-term_memory#/media/...

Well, glad to see that some similar work as mine can get this much traction on HN. I would have loved to get this much traction when I did my post, too. Anyway, I would suggest OP to take a look at seq2seq, as it objectively performs better (and without the "laggy drift" visual effect observed as in OP's figure named "S&P500 multi-sequence prediction").

In other words, using many-to-one neural architectures creates some kind of feedback which doesn't happen with seq2seq which doesn't build on its own accumulated error. It has a decoder with different weights than the encoder, and can be deep (stacked).

So many ads and things that prompt for attention on this page! I needed to press "x" on 3 things to be able to read. And once read to the end, it refers to a "video above" that won't open under Chrome for mobile. Wired, calm down on crap!

I am co-writing a paper with a Ph.D. student and he is currently working on trying with other datasets. We are also trying different architectures, combining multiple LSTMs (stacked, residual connections + batch normalization, bidirectional LSTMs, and on)