Python

[See Description] Creating our Machine Learning Classifiers – Python for Finance 16



UPDATED series:

This series has become outdated with Quantopian 2.0.

Now that we have our features and our labels, we’re ready to create and train our machine learning classifiers for our algorithmic trading strategy.

The classifiers we use here are the Random Forest, Linear SVC, NuSVC, and Logistic Regression.

sample code:…

Similar Posts

9 thoughts on “[See Description] Creating our Machine Learning Classifiers – Python for Finance 16
  1. Keep getting a runtime error. No idea why πŸ™
    ValueError: setting an array element with a sequence.
    There was a runtime error on line 85.

    I deleted line 85 just to see what happen and got the same error on line 90.

    79 clf = RandomForestClassifier()

    81 last_prices = price_list[-context.feature_window:]
    82 current_features = (np.around(np.diff(last_prices) / last_prices[:-1]) * 100.0, 1)

    84 X.append(current_features)
    85 X = preprocessing.scale(X)

    87 current_features = X[-1]
    88 X = X[:-1]

    90 clf.fit(X,y)

    92 p = clf.predit(current_features)[0]
    93 print(('Prediction',p))

  2. +sentdex hello ive been following the series with ease but for some weird reason for this part i get the error message:
    " ValueError: setting an array element with a sequence." for the line: clf.fit(X,y)
    I dont really understand why I'm getting this message, could you help?
    Thanks in advance & Thank you for giving us the opportunity to learn a combination of things πŸ™‚

  3. Dear Harrison,

    Pls check the Video you have uploaded in Python for Finance 16, It seems you have uploaded Python for Finance 15 for this tutorial. Thx

  4. Hi!
    Its me, again… πŸ˜‰
    As always i have problem with build.
    "Runtime exception: TypeError: unbound method fit() must be called with RandomForestClassifier instance as first argument (got ndarray instance instead)"
    at line 85
    74: clf = RandomForestClassifier

    82: current_features = X[-1]
    83: X = X[:-1]
    84:
    85: clf.fit(X,y)

Leave a Reply

Your email address will not be published. Required fields are marked *