Yumi's Blog

Multidimensional indexing with tensorflow

In this blog post, I present how to use multi-dimensional index arrays for indexing tensors.

First, I will show multi-dimensional array indexing with numpy. Then I will show two approaches in tensorflow:

  • tf.while_loop
  • tf.gather_nd

I will conclude that tf.gather_nd is much more effective than tf.while_loop.

Reference

numpy indexing

Classification with Mahalanobis distance + full covariance using tensorflow

This blog discusses how to calculate Mahalanobis distance using tensorflow. I will consider full variance approach, i.e., each cluster has its own general covariance matrix, so I do not assume common variance accross clusters unlike the previous post. Calculation of Mahalanobis distance is important for classification when each cluster has different covariance structure. Let's take a lookt at this situation using toy data.

Calculate Mahalanobis distance with tensorflow 2.0

I noticed that tensorflow does not have functions to compute Mahalanobis distance between two groups of samples. So here I go and provide the code with explanation. The blog is organized and explain the following topics

  • Euclidean distance with Scipy
  • Euclidean distance with Tensorflow v2
  • Mahalanobis distance with Scipy
  • Mahalanobis distance with Tensorflow v2

Learn the Carlini and Wagner's adversarial attack - MNIST

c1000

Deep neural networks (DNN) have become increasingly effective at many difficult machine-learning tasks. However, DNNs are vulnerable to adversarial examples that are maliciously made to misguide the DNN's performance. The vulnerability may make it difficult to apply the DNNs to security sensitive usecases. In this blog, we learn one of the most successful adversarial attack proposed in the paper "Toward Evaluating the Robustness of Neural Network".

Visualization of deep learning classification model using keras-vis

In the next few blog posts, I will review visualization techiniques.

Create condo environment

conda create -n explainableAI python=3.5
source activate explainableAI
conda install tensorflow
conda install keras
conda install jupyter
pip install git+https://github.com/raghakot/keras-vis.git --upgrade --no-deps
pip install opencv-python==3.3.0.10
$CONDA_PREFIX/bin/jupyter notebook --no-browser

Download a json file containing ImageNet class names.