Creating our Machine Learning Classifiers - Python for Finance 16



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: http://pythonprogramming.net http://hkinsley.com https://twitter.com/sentdex http://sentdex.com http://seaofbtc.com

Comments

  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. sentdex please please PLEASE make some videos about R (language). i m beginner-goodish to both languages and let me tell you you are gonna LOVE it
  4. This is basically the same algorithm as in your Forex ML playlist, right?
  5. finally:
        bar += 1

    would be more elegant
  6. 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
  7. +sentdex ?
  8. 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)
  9. Nice!
    How Do I download specific files from websites, with urllib? 
    Thanks, sorry if I am going on a tangent.


Additional Information:

Visibility: 5789

Duration: 12m 33s

Rating: 39