Showing posts with label Pythoncode. Show all posts
Showing posts with label Pythoncode. Show all posts

Use a Python script to read and write on Excel File in Python

This post demonstrates how to utilize the xlwings Python package to execute a Python script to read and write Excel in Python.

Executing a Python script within Excel using xlwings

This post demonstrates how to utilize the xlwings Python package to execute a Python script within Excel.

Python: Constructing Time Series Sequence Samples Dataset

This post construct the multivariate time series data into sequence samples dataset for RNNs, LSTMs, CNNs, and similar models in Keras or Tensorflow.

Python: Independent Component Analysis (ICA) versus PCA

This post demonstrates the usage of Independent Component Analysis (ICA) in Python, a technique akin to PCA but focused on independent factors (source signals).

Python: t-SNE dimensional reduction technique

This post shows how to use the t-SNE (t-Distributed Stochastic Neighbor Embedding) in Python, which is a non-linear probabilistic technique for dimensionality reduction.

TensorFlow: Weighted Average Layer with Trainable Weights

This post implements TensorFlow code that estimates the weights used to construct an output composite time series from three input time series.

TensorFlow: Weighted Average Layer with Fixed Weights

This post demonstrates the process of implementing a TensorFlow code to calculate the weighted average of the previous layer's output. This simple exercise serves as a practical guide to creating a custom layer in TensorFlow.

TensorFlow: Variational Autoencoder (VAE) for MNIST Digits

This post demonstrates the implementation of Tensorflow code for Variational Autoencoder (VAE) using a well-established example with MNIST digit data.

Python: Solving ODEs with Deep Learning in TensorFlow

This post explains how to implement TensorFlow code to solve ODE problems. This approach is known as 'Physics-Informed Neural Networks' (PINNs) or 'Neural ODEs.'

PyTorch : A Simple MLP model for Univariate Time Series Forecasting

This post explains how to implement a simple MLP model for a univariate time series forecasting using PyTorch. The estimation of the PyTorch model is slightly different from the Keras model, so it's worth focusing on how it differs.

Python : download stock prices using the yfinance package

This post shows how to read prices of stock prices with a list of symbols as a string using Python. Splitting data by price types or symbols are illustrated as examples.

Python: Empirical Mode Decomposition

This post shows how to use Empirical Mode Decomposition (EMD), which decomposes a non-stationary univariate time series into several components of different time scales. These components are called intrinsic mode functions (IMFs).

Python: The Hodrick-Prescott filter or HP filter

This post shows how to extract trend and cyclical components from a univariate time series using the Hodrick-Prescott (HP) filter. A more realistic version is the one-sided HP filter since it uses only the information available at time t, not the full sample.

Python : Save and Load Tensorflow Keras Model

This post shows how to save and load your Keras model. The loaded model contains the same parameters (weights and biases) and the model structure as the final model you saved.

Python : Select subset using sub column numbers or names

This post shows how to select sub columns from array or dataframe using sub column numbers or names. For example, this method is useful when we want to select yields with relevant maturities (1,3,5,7,10,15,20,30 years) from full spectrum of maturities (1,2,3,4,...,28,29,30 years).

Python : Nelson-Siegel or Svensson model with fixed lambda

This post implements the period-by-period OLS estimation of the Nelson-Siegel and Svensson yield curve model with fixed lambda.

Python : Tensorflow Keras Tuner for the optimization of hyper parameters

This post shows how to use the Keras Tuner for the hyper parameter optimization. This can avoid many for-loops effectively, which are used when the grid search for hyper parameters is necessary.

Python : %run to import another folder's ipynb files

This post shows how to use %run command for importing Jupyter Notebook (ipynb) files from another folders. It is essentially to run the imported ipynb files before running a main file.