Let a:T→H be a continuous function from a compact set T⊂Rd to the Hilbert space H, e.g. L2(Ω). An observation vector b∈H is said to be a sparse spike convolution of the discrete measure x=∑i=1nβiδti if b=i=1∑nβia(ti)=∫t∈Ta(t)dx(t)=:Ax
Here δt denotes a spike (a.k.a. Dirac mass) located at t∈T. We may think of x as a light sources with true location ti and amplitude βi, and b=Ax as an acquisition image via a convolution kernel a.
The following web application provides a visualization of above sparse spike convolution model. Click on the symbol > on the top left corner to modify the parameters. Here we consider T=[0,1]2⊂R2 and H=L2(T) and a(t)(z)=2−∣∣z−t∣∣2/w2 for all z,t∈T, i.e. the kernel a is a shifted Gaussian-like function.
Now assume that you already have a wonderful classification model and you want to share your model with other people. How to do that?
I propose in this post a solution using Heroku. Heroku is a container-based cloud Platform as a Service. Developers use Heroku to deploy, manage, and scale their apps.
First upload your code to Github
Second, go to Heroku and deploy your model
That all!
Here is the FIRST EXAMPLE, a Machine Learning (ML) web app of classifying penguins using the Penguin dataset. Other ML models will be online soon.
I copy/learn this web app from this video tutorial. The documents is available here.
Google Colab (or Colaboratory or Colab) is an online notebook running on Google Cloud which allows you write and execute Python on browser without using resources of your computer. It can be considered as an online Jupyter Notebook, i.e. it allows multi programming languages: Markdown, HTML, Latex, Python, R, … . You may visit the origin of this post in Colab by simply clicking on the badge Open in Colab at the begining of the post. Hope you enjoy it!
You may type maths expression ∫01xdx or run your Python code
2+2
4
You may plot
import numpy as np
from matplotlib import pyplot as plt
ys =200+ np.random.randn(100)
x =[x for x inrange(len(ys))]
plt.plot(x, ys,'-')
plt.fill_between(x, ys,195, where=(ys >195), facecolor='g', alpha=0.6)
plt.title("Sample Visualization")
plt.show()
You may import probably all kinds of packages, e.g. torch. However, in Binder you sometimes can't even import numpy.
import torch
print("import torch successfully")
import torch successfully
How to bring your notebook to blog post?
The naive idea is to use Jupyter Notebook opens your notebook and export it as .html file. However, you will encounter the size-inconsistency between the post and your website. How to fix it?
Solution 1.
The following is a temporary solution, it's not very elegant, but at least it works. If you already have a notebook go straightforward to step 2. The strategy is to convert your notebook being an .ipynb to .md and then to .html a format suitable for our blog post.
Go to this Google Colab change the contents and the codes as you want. In the tab File, download it as an .ipynb file.
Go to Github and upload it to your publish repository.
Go to Binder, past the link of your repository and the press the launch button. Open the .ipynb file. A Jupyter interface will be appear. In tab File, download it as a .md file.
Copy the content of the .md file (you may copy it by uploading and then opening it using Google Drive).
Go to StackEdit and past its content to a new file created in StackEdit. Export the file as an .html file.
Go to Blogger, copy the content of your .html file and past it to your Blog post. Note that you have to manage the images by hand.
I know that it is quite complicated as it requires a lot of steps as Colab does not support export .md and .html files. Of course, we can make the steps shorter by creating a notebook in Jupyter directly and then export it to a .md. Above general process is useful in some cases, e.g. cannot import torch in Jupyter. I hope I will find a simpler method in the comming time.