Photo by Ryo Yoshitake

FastAPI is a web framework commonly used to deploy machine learning models behind RESTful APIs. Users and applications use these APIs to retrieve predictions from models.

For this use case, I have a model developed with Keras that classifies Iris flowers to the correct species by predicting class probabilities. I want my server to load that model, accept requests to an endpoint, process inputs passed as path parameters, run the inputs through the model, and pass the output back to the client. At the end, we go over how to pass our input data as a JSON payload instead of…


Photo by Fumiaki Hayashi

Streamlit is an open-source Python framework that helps machine learning and data science teams create data applications that look professional out-of-the-box without any front-end web development knowledge.

Imagine the case where your team has trained a machine learning model and now wants to supply a customer or another end user an application for interfacing with your model: running inference on new inputs and visualizing the output predictions. This is a use case for Streamlit that we will look at in this article.

In this example case, I have trained a neural network to classify Iris flowers between different species (Setosa…


A common tool used for visualizing stock price changes over time is an OHLC (open, high, low, close) chart. This is a chart of “candles” where each candle contains the open, high, low, and close of a stock price over a set time interval. If we use a daily OHLC chart, the time interval for each candle is one trading day. Other common time intervals used are month, hour, and minute.

https://en.wikipedia.org/wiki/Candlestick_chart

Let’s use minute OHLC data to demonstrate. Use Polygon’s API to retrieve this data. Polygon’s API requires either a Polygon key or Alpaca key. If you don’t have this…


Dow Jones Industrial Average

Two common portfolios investors use are the Maximum Sharpe Ratio (MSR) portfolio and the Global Minimum Variance (GMV) portfolio.

To construct the MSR portfolio, an investor needs to calculate the asset weights yielding the largest excess return per unit of risk (using the standard deviation of a portfolio’s return as the measure of risk). Constructing this portfolio requires two components: an estimate of the expected returns of each asset and an estimated covariance matrix, representing the covariance between each asset. In practice, it is difficult to calculate accurate estimates of the expected returns of assets.

The GMV portfolio is another…


AWS Lambda’s logo

Stock prices fluctuate over time depending on market sentiment. Firms can gauge the current and historic market sentiment for individual stocks or entire markets by using financial news articles. With these articles, firms can use natural language processing techniques such as named entity recognition and sentiment analysis to measure outlook for specific stocks or the market as a whole. These methods help to tag articles about publicly traded companies like Microsoft or Netflix and to calculate a sentiment tag or rating indicating if the financial article is positive, neutral, or negative.

This article will go over how you can compile…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store