QuantConnect / Documentation

QuantConnect Wiki Style Documentation Behind QuantConnect
https://www.quantconnect.com/docs/v2/
Apache License 2.0
168 stars 135 forks source link

Review Machine Learning tutorials #1626

Open DerekMelchin opened 6 months ago

DerekMelchin commented 6 months ago

Expected Behavior

The ML tutorials here provide educational material on how to use all three learning paradigms: supervised, unsupervised, and reinforcement learning. Each example is unique and informative.

Actual Behavior

Most of the examples solve the same problem, but just use a different library to do so. The text is also largely duplicated.

Checklist

AlexCatarino commented 5 months ago

Before we review the tutorials to add more example, we need to review those we have. Because of Tensorflow upgrade, Keras was broken (fixed by 8ee3fcb), but Tensorflow is still broken. For example, we cannot use

tf.reset_default_graph()
sess = tf.Session()

We could use it with compat.v1

tf.compat.v1.reset_default_graph()
sess = tf.compat.v1.Session()

but we shouldn't rely on Tensorflow backward compatibility since this is an example for the community.

Additionally, let's add a link to a backtest with the notebook to avoid copy and paste the code snippets. The notebook should include the page text.

DerekMelchin commented 4 months ago

Some issues I found with the new TF tutorials:

Might be other errors too, please review it.

The TF tutorial should include a Lambda layer so that we can demonstrate how to fix the "name 'tf' is not defined" error when saving and loading from the Object Store. To avoid the error, instead of passing a lambda to the Lambda constructor, you need to pass a function. The function definition needs to have the @register_keras_serializable() decorator. Refer to https://stackoverflow.com/questions/54347963/tf-is-not-defined-on-load-model-using-lambda

The TF tutorial should use Dense and Sequential, not dense and sequential

LouisSzeto commented 4 months ago

Since we are not using .h5 saving mode anymore, we don't need the Lambda logic.

DerekMelchin commented 4 hours ago

The Aesera tutorial defines a self.train method, overriding the built-in self.train.