Skip to content

Instantly share code, notes, and snippets.

View ucalyptus's full-sized avatar
🦙
Training

Sayantan Das ucalyptus

🦙
Training
View GitHub Profile
import numpy as np
from sklearn import metrics, preprocessing
from sklearn.preprocessing import MinMaxScaler
from sklearn.decomposition import PCA
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix, accuracy_score, classification_report, cohen_kappa_score
from operator import truediv
from plotly.offline import init_notebook_mode
import matplotlib.pyplot as plt
import scipy.io as sio
class PAM(Layer):
def __init__(self,
gamma_initializer=tf.zeros_initializer(),
gamma_regularizer=None,
gamma_constraint=None,
**kwargs):
super(PAM, self).__init__(**kwargs)
self.gamma_initializer = gamma_initializer
self.gamma_regularizer = gamma_regularizer
self.gamma_constraint = gamma_constraint
@ucalyptus
ucalyptus / install.md
Last active February 5, 2020 11:01
Ctags and Vim Installation

sudo apt-get update

sudo apt-get install vim

sudo apt-get install exuberant-ctags

@ucalyptus
ucalyptus / MSD.py
Created February 4, 2020 07:09
Original Implementation of Mean Spectral Divergence
def cal_mean_spectral_divergence(band_subset):
    """
    Spectral Divergence is defined as the symmetrical KL divergence (D_KLS) of two bands probability distribution.
    We use Mean SD (MSD) to quantify the redundancy among a band set.
    B_i and B_j should be a gray histagram.
    SD = D_KL(B_i||B_j) + D_KL(B_j||B_i)
    MSD = 2/n*(n-1) * sum(ID_ij)
    Ref:
@ucalyptus
ucalyptus / first-cell.txt
Created January 31, 2020 10:13
Inputs for julia-base.ipynb first cell for installation of Julia,IJulia,Flux
!curl -sSL "https://julialang-s3.julialang.org/bin/linux/x64/1.3/julia-1.3.1-linux-x86_64.tar.gz" -o julia.tar.gz
!tar -xzf julia.tar.gz -C /usr --strip-components 1
!rm -rf julia.tar.gz*
!julia -e 'using Pkg; pkg"add IJulia; add Flux; precompile"'
@ucalyptus
ucalyptus / julia-base.ipynb
Created January 31, 2020 09:59
Upload this at colab.research.google.com/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ucalyptus
ucalyptus / julia-base.ipynb
Created January 31, 2020 09:59
Upload this at colab.research.google.com/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ucalyptus
ucalyptus / GMTI.md
Last active November 11, 2023 07:00
Ground Moving Target Indication in SAR Images using Symmetric Defocusing

SAR is not compensating for the doppler of moving targets. It only compensates for the doppler shift of stationary targets as it assumes that all targets are stationary on Earth. SAR has side lobes because of which when those capture doppler, they might not suffice Nyquist criterion.

GMTI using Symmetric Defocusing

Abstract

Two filters,which differ only in the signs of the phase responses, are used to defocus the complex image respectively. In the two defocused images,each stationary target is blurred to the same extent,but each moving target is blurred to different extents. Therefore, moving targets can be indicated by patch-by-patch sharpness comparison of the two defocused images.

@ucalyptus
ucalyptus / RMSE_iteratively.md
Last active July 26, 2019 06:28
NEVER store RMSE again

RMSE(t) = sqrt((t/t-1)RMSE(t-1)^2 + (1/t)(y_true(t) - y_pred(t))^2)

where t is the number of observations

Courtesy

Modification

Treat (1/t) as alpha

@ucalyptus
ucalyptus / FAQ.md
Created July 10, 2019 11:02
Some questions I believe I should have their answers documented.

Which is better rMSE or MAE?

This depends on your loss function. In many circumstances it makes sense to give more weight to points further away from the mean--that is, being off by 10 is more than twice as bad as being off by 5. In such cases RMSE is a more appropriate measure of error. If being off by ten is just twice as bad as being off by 5, then MAE is more appropriate. In any case, it doesn't make sense to compare RMSE and MAE to each other