Plotting points that lie on the intersection of the given curves using gradient descent.

Overview

Plotting intersection of curves using gradient descent

Webapp Link ---> Streamlit App

What's the app about Why this app
Plotting functions and their intersection. An interesting application of gradient descent.
I'm a fan of plotting graphs (and visualizations in general).

Let's say you are giving equations of curves and you need to plot the intersection of these curves. As an example, say you have 2 spheres (3D), how would you plot the intersection of the given spheres?

... x, a & b are vectors of size 3.

My first approach to this problem was finding the equation of intersection of these 2 functions by equating them i.e. F_1(x) = F_2(x). Then trying to simplify the equation and use that equation to plot the points. This approach is not feasible for 2 reasons:

  1. Equating the 2 functions won't necessarily give you the equation of intersection. For instance, equating 2 equations of spheres will give you intersection plane of the spheres and not the equation of intersecting circle (if any).
  2. Even if you had an equation, the question still remains, how to plot points from a given equation?

If you observe, points that lie on the intersection of the curves should satisfy all the functions separately i.e.

So, another approach (highly ineffective) would be to generate points randomly everytime and see if they satisfy all the given equations. If it does, it is a valid 'point'. Else, generate another random point and repeat untill you have sufficient points. Downsides of this approach:

  1. The search space is too big. Even bigger for N-dimensional points.
  2. Highly ineffective approach. Might take forever to stumble upon such valid points.

Gradient Descent to the rescue

Can we modify the previous approach- Instead of discarding an invalid randomly generated point, can we update it iteratively so that it approaches a valid solution? If so, what would it mean to be a valid solution and when should we stop updating the sample?

What should be the criteria for a point x to be a valid solution?

If the point lies on the intersection of the curves, it should satisfy for all i i.e.

; &

We can define a function as the summation of the given functions to hold the above condition.

So, we can say that a point will be valid when it satisfies G(x) = 0, since it will only hold when all the F_i(x) are zero. This will be our criterion for checking if the point is a valid solution.

However, we are not yet done. The range of G(x) can be from . This means, the minimum value of G(x) is not necessarily 0. This is a problem because if we keep minimizing G(x) iteratively by updating x, the value of G(x) will cross 0 and approach a negative value (it's minima).

This could be solved if the minima of G(x) is 0 itself. This way we can keep updating x until G(x) approaches the minima (0 in this case). So, we need to do slight modification in G(x) such that its minimum value is 0.

My first instict was to define G(x) as the sum of absolute F_i(x) i.e.

The minimum value of this function will be 0 and will hold all the conditions discussed above. However, if we are trying to use Gradient Descent, using modulus operation can be problematic because the function may not remain smooth anymore.

So, what's an easy alternative for modulus operator which also holds the smoothness property? - Use squares!

This function can now be minimised to get the points of intersection of the curves.

  1. The function will be smooth and continuos. Provided F(x) are themselves smooth and continuous.
  2. The minimum value of G(x) is zero.
  3. The minimum value of G(x) represents the interesection of all F_i(x)
 Generate a random point x
 While G(x) != 0:
    x = x - lr * gradient(G(x))
    
 Repeat for N points.


Assumptions:

  1. Curves do intersect somewhere.
  2. The individual curves are themselves differentiable.
3D ResNets for Action Recognition (CVPR 2018)

3D ResNets for Action Recognition Update (2020/4/13) We published a paper on arXiv. Hirokatsu Kataoka, Tenga Wakamiya, Kensho Hara, and Yutaka Satoh,

Kensho Hara 3.5k Jan 06, 2023
Multiple style transfer via variational autoencoder

ST-VAE Multiple style transfer via variational autoencoder By Zhi-Song Liu, Vicky Kalogeiton and Marie-Paule Cani This repo only provides simple testi

13 Oct 29, 2022
Some methods for comparing network representations in deep learning and neuroscience.

Generalized Shape Metrics on Neural Representations In neuroscience and in deep learning, quantifying the (dis)similarity of neural representations ac

Alex Williams 45 Dec 27, 2022
🎁 3,000,000+ Unsplash images made available for research and machine learning

The Unsplash Dataset The Unsplash Dataset is made up of over 250,000+ contributing global photographers and data sourced from hundreds of millions of

Unsplash 2k Jan 03, 2023
A quick recipe to learn all about Transformers

Transformers have accelerated the development of new techniques and models for natural language processing (NLP) tasks.

DAIR.AI 772 Dec 31, 2022
The self-supervised goal reaching benchmark introduced in Discovering and Achieving Goals via World Models

Lexa-Benchmark Codebase for the self-supervised goal reaching benchmark introduced in 'Discovering and Achieving Goals via World Models'. Setup Create

1 Oct 14, 2021
Proximal Backpropagation - a neural network training algorithm that takes implicit instead of explicit gradient steps

Proximal Backpropagation Proximal Backpropagation (ProxProp) is a neural network training algorithm that takes implicit instead of explicit gradient s

Thomas Frerix 40 Dec 17, 2022
A library for answering questions using data you cannot see

A library for computing on data you do not own and cannot see PySyft is a Python library for secure and private Deep Learning. PySyft decouples privat

OpenMined 8.5k Jan 02, 2023
Code To Tune or Not To Tune? Zero-shot Models for Legal Case Entailment.

COLIEE 2021 - task 2: Legal Case Entailment This repository contains the code to reproduce NeuralMind's submissions to COLIEE 2021 presented in the pa

NeuralMind 13 Dec 16, 2022
Drone-based Joint Density Map Estimation, Localization and Tracking with Space-Time Multi-Scale Attention Network

DroneCrowd Paper Detection, Tracking, and Counting Meets Drones in Crowds: A Benchmark. Introduction This paper proposes a space-time multi-scale atte

VisDrone 98 Nov 16, 2022
VOLO: Vision Outlooker for Visual Recognition

VOLO: Vision Outlooker for Visual Recognition, arxiv This is a PyTorch implementation of our paper. We present Vision Outlooker (VOLO). We show that o

Sea AI Lab 876 Dec 09, 2022
Pytorch Implementation of rpautrat/SuperPoint

SuperPoint-Pytorch (A Pure Pytorch Implementation) SuperPoint: Self-Supervised Interest Point Detection and Description Thanks This work is based on:

76 Dec 27, 2022
A Keras implementation of CapsNet in the paper: Sara Sabour, Nicholas Frosst, Geoffrey E Hinton. Dynamic Routing Between Capsules

NOTE This implementation is fork of https://github.com/XifengGuo/CapsNet-Keras , applied to IMDB texts reviews dataset. CapsNet-Keras A Keras implemen

Lauro Moraes 5 Oct 23, 2022
The Medical Detection Toolkit contains 2D + 3D implementations of prevalent object detectors such as Mask R-CNN, Retina Net, Retina U-Net, as well as a training and inference framework focused on dealing with medical images.

The Medical Detection Toolkit contains 2D + 3D implementations of prevalent object detectors such as Mask R-CNN, Retina Net, Retina U-Net, as well as a training and inference framework focused on dea

MIC-DKFZ 1.2k Jan 04, 2023
Combining Latent Space and Structured Kernels for Bayesian Optimization over Combinatorial Spaces

This repository contains source code for the paper Combining Latent Space and Structured Kernels for Bayesian Optimization over Combinatorial Spaces a

9 Nov 21, 2022
An efficient 3D semantic segmentation framework for Urban-scale point clouds like SensatUrban, Campus3D, etc.

An efficient 3D semantic segmentation framework for Urban-scale point clouds like SensatUrban, Campus3D, etc.

Zou 33 Jan 03, 2023
ShapeGlot: Learning Language for Shape Differentiation

ShapeGlot: Learning Language for Shape Differentiation Created by Panos Achlioptas, Judy Fan, Robert X.D. Hawkins, Noah D. Goodman, Leonidas J. Guibas

Panos 32 Dec 23, 2022
Kalidokit is a blendshape and kinematics solver for Mediapipe/Tensorflow.js face, eyes, pose, and hand tracking models

Blendshape and kinematics solver for Mediapipe/Tensorflow.js face, eyes, pose, and hand tracking models.

Rich 4.5k Jan 07, 2023
CrossNorm and SelfNorm for Generalization under Distribution Shifts (ICCV 2021)

CrossNorm (CN) and SelfNorm (SN) (Accepted at ICCV 2021) This is the official PyTorch implementation of our CNSN paper, in which we propose CrossNorm

100 Dec 28, 2022
A TikTok-like recommender system for GitHub repositories based on Gorse

GitRec GitRec is the missing recommender system for GitHub repositories based on Gorse. Architecture The trending crawler crawls trending repositories

337 Jan 04, 2023