Machine Learning for Finance in Python
Learn to model and predict stock data values using linear models, decision trees, random forests, and neural networks.
Start Course for Free4 hours15 videos59 exercises28,319 learnersStatement of Accomplishment
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.Training 2 or more people?
Try DataCamp for BusinessLoved by learners at thousands of companies
Course Description
How to Predict Stock Prices with Machine Learning
Machine learning has a huge number of applications within the finance industry and is commonly used to predict stock values and maintain a strong stock portfolio. This course will teach you how to use Python to calculate technical indicators from historical stock data and create features and targets.Build Your Knowledge of ML Models
Strong stock predictions start with good data preparation. You’ll learn how to prepare your financial data for ML algorithms and fit it into various models, including linear models, xgboost models, and neural network models.The second chapter moves on to using Python decision trees to predict future values for your stock, and forest-based machine learning methods to enhance your predictions.
The second half of this course will cover how to scale your data for use in KNN and neural networks before using those tools to predict the future value of your stock. You’ll learn how to plot losses, measure performance, and visualize your prediction results.
Use the Sharpe Ratio to Build Your Ideal Portfolio
Machine learning can also help you find the optimal stock portfolio. You’ll learn how to use modern portfolio theory (MPT) and the Sharpe ratio as part of your process to predict the best portfolios. Once you’ve completed this course, you’ll also understand how to evaluate the performance of your machine learning-predicted portfolio.You’ll use a variety of real-world data sets from NASDAQ and apply robust theories and techniques to them so that you can create your own predictions and optimize for your risk appetite and budget. "
For Business
Training 2 or more people?
Get your team access to the full DataCamp library, with centralized reporting, assignments, projects and more- 1
Preparing data and a linear model
FreeIn this chapter, we will learn how machine learning can be used in finance. We will also explore some stock data, and prepare it for machine learning algorithms. Finally, we will fit our first machine learning model -- a linear model, in order to predict future price changes of stocks.
Machine learning for finance50 xpExplore the data with some EDA100 xpCorrelations100 xpData transforms, features, and targets50 xpCreate moving average and RSI features100 xpCreate features and targets100 xpCheck the correlations100 xpLinear modeling50 xpCreate train and test features100 xpFit a linear model100 xpEvaluate our results100 xp - 2
Machine learning tree methods
Learn how to use tree-based machine learning models to predict future values of a stock's price, as well as how to use forest-based machine learning methods for regression and feature selection.
Engineering more features50 xpFeature engineering from volume100 xpCreate day-of-week features100 xpExamine correlations of the new features100 xpDecision trees50 xpFit a decision tree100 xpTry different max depths100 xpCheck our results100 xpRandom forests50 xpFit a random forest100 xpTune random forest hyperparameters100 xpEvaluate performance100 xpFeature importances and gradient boosting50 xpRandom forest feature importances100 xpA gradient boosting model100 xpGradient boosting feature importances100 xp - 3
Neural networks and KNN
We will learn how to normalize and scale data for use in KNN and neural network methods. Then we will learn how to use KNN and neural network regression to predict the future values of a stock's price (or any other regression problem).
Scaling data and KNN Regression50 xpStandardizing data100 xpOptimize n_neighbors100 xpEvaluate KNN performance100 xpNeural Networks50 xpBuild and fit a simple neural net100 xpPlot losses100 xpMeasure performance100 xpCustom loss functions50 xpCustom loss function100 xpFit neural net with custom loss function100 xpVisualize the results100 xpOverfitting and ensembling50 xpCombatting overfitting with dropout100 xpEnsembling models100 xpSee how the ensemble performed100 xp - 4
Machine learning with modern portfolio theory
In this chapter, you'll learn how to use modern portfolio theory (MPT) and the Sharpe ratio to plot and find optimal stock portfolios. You'll also use machine learning to predict the best portfolios. Finally, you'll evaluate performance of the ML-predicted portfolios.
Modern portfolio theory (MPT); efficient frontiers50 xpJoin stock DataFrames and calculate returns100 xpCalculate covariances for volatility100 xpCalculate portfolios100 xpPlot efficient frontier100 xpSharpe ratios; features and targets50 xpGet best Sharpe ratios100 xpCalculate EWMAs100 xpMake features and targets100 xpPlot efficient frontier with best Sharpe ratio100 xpMachine learning for MPT50 xpMake predictions with a random forest100 xpGet predictions and first evaluation100 xpEvaluate returns100 xpPlot returns100 xpClosing remarks and advice50 xp
For Business
Training 2 or more people?
Get your team access to the full DataCamp library, with centralized reporting, assignments, projects and morecollaborators
prerequisites
Supervised Learning with scikit-learnNathan George
See MoreAssistant Professor of Data Science at Regis University
What do other learners have to say?
FAQs
Join over 14 million learners and start Machine Learning for Finance in Python today!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.