Skip to content

yorkjong/colab

Repository files navigation

Back up my notebooks on Google Colab

After discovering the usefulness of Google Colab, I ran some small programs there as practice. Some of them were interesting, so I moved them to this GitHub repository to share.

These notebooks are currently divided into the following categories:

  • Pytorch Tutorial Series
  • Visualizing Stocks

Pytorch Tutorial Series

This Colab notebook files of PytorchTutorial series includes the following:

I initially copied and pasted these files from Professor Mofan's teaching website to Colab for code verification and familiarization with PyTorch.

After performing a lot of refactoring, I also added new features for them.The original example code's visualization was through Matplotlib, to better compatibility with Colab, I added a Plotly version. Both are side by side, allowing for easy comparison.

The following chart is the final result from PytorchTutorial7_CNN.ipynb, which is a CNN model trained using PyTorch in Google Colab to recognize the Arabic numerals 0 to 9 in the MNIST dataset. During the process, it was dimensionality reduced using TSNE and visualized using Plotly.

PT7_VisualizeLastLayer


Visualizing Stocks

Initially, just for fun, I gave ChatGPT a simple task, to write a program to draw basic charts such as candlesticks, moving average lines, and volume. However, after ChatGPT struggled for a whole day, it still couldn't produce accurate results. So I had to roll up my sleeves, with the assistance of ChatGPT, and spend two days studying Plotly to finally achieve the current result. The following is its Colab notebook file.

I retrieve the historical data of a stock using yfinance, after obtaining the stock's DataFrame table, I plot related charts using both mplfinance (a Matplotlib utilities for the visualization, and visual analysis, of financial data) and Plotly. I also tried using TA-Lib with mplfinance to plot technical analysis indicators.

As an example, below are the TSLA's price and volume accumulation charts so-called Volume Profile (or Price-by-Volume), the first one is plotted using mplfinance and the latter two are plotted using Plotly.

TSLA_20230203_VolumeProfile_mpl TSLA_20230207_VolumeProfile_Plotly2s TSLA_20230203_VolumeProfile_Plotly

About

Backup site of my Colab notebooks

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published