Machine Learning for Finance in Python
Use Python to build stock features, forecast price changes with tree, KNN and neural network models, and pick portfolios with the Sharpe ratio.
Forecasting a stock’s next price move and choosing which mix of stocks to hold are the two problems this course works on in Python. You compute moving averages and RSI from historical prices, shape them into features and targets, and compare how linear, tree-based, nearest-neighbor and neural network regressions predict future changes. The closing part brings in modern portfolio theory and the Sharpe ratio, using a random forest to predict the best portfolios and then checking the returns they produce.
What You Will Achieve
- Turn historical stock prices into moving average and RSI inputs with matching targets for a price-change forecast
- Fit and tune decision trees, random forests and gradient boosting models, then read which inputs matter most
- Standardize data and train KNN and neural network regressions, adding a custom loss, dropout and an ensemble
- Plot an efficient frontier, pick the portfolios with the best Sharpe ratios and predict them with a random forest
Program Overview
Stock Features, Linear Models, and Tree Methods
Explores stock data, builds features and targets, fits a first linear model, then moves to decision trees and forest-based methods for prediction and feature selection.
- Exploring stock data and correlations
- Moving average, RSI, volume and day-of-week features
- Linear models and decision trees
- Random forests, feature importances and gradient boosting
Neural Networks and KNN Regression
Scales the data so distance-based and neural methods work, then predicts future stock prices with both and checks how well they do.
- Standardizing data and choosing n_neighbors
- Building a simple neural net and plotting losses
- Custom loss functions
- Dropout and ensembling against overfitting
Machine Learning with Modern Portfolio Theory
Applies portfolio theory to several stocks at once and uses machine learning to predict the best-performing portfolios.
- Returns, covariances and efficient frontiers
- Sharpe ratios and EWMA features
- Random forest portfolio predictions
- Evaluating and plotting portfolio returns
Certificate Awarded (Paid)
Job Outlook
These skills apply in quantitative finance and investment analysis, where historical stock data is turned into price forecasts and portfolios are compared by their risk and return.
Good for: Python learners who want hands-on practice applying regression models and modern portfolio theory to real stock price data.
Keep in mind: Each model gets only a few exercises, so the course works best as a tour of methods applied to one forecasting task rather than a deep study of any single one.
Bottom line: It carries one stock forecasting problem through linear, tree, nearest-neighbor and neural network models before turning the same tools on portfolio selection.
Frequently Asked Questions
What role does the Sharpe ratio play in the course?
In the final chapter, Sharpe ratios identify the best portfolios along the efficient frontier. Those best portfolios then become the targets a random forest learns to predict, and the predicted portfolios are evaluated by the returns they would have produced.
Which stock features do the exercises build?
The first chapter creates moving average and RSI features from price history. The tree chapter adds features drawn from trading volume and the day of the week, and the portfolio chapter calculates exponentially weighted moving averages (EWMAs) as inputs.
How does the course handle overfitting?
Several lessons address it. You compare different maximum depths for decision trees, tune random forest hyperparameters, and check results on test features held back from training. In the neural network chapter, dropout layers and an ensemble of models are used to reduce overfitting.
Do the KNN and neural network methods apply beyond stock prices?
Yes. The chapter presents KNN and neural network regression as general methods for any regression problem, including the scaling and normalization steps they need. Predicting a stock's future price is the worked example used throughout.


There are no reviews yet.