Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Sunday, March 17, 2019

Face anonymizer with Python

Abstract

On this article, I’ll introduce how to anonymize human’s face and the code for that with Python.
Although I’m not 100% sure, when we compare with before, I think the face detection has been reaching certain level of accuracy. If the picture is not so complex, with some accuracy, the faces are detected. With this face detection, relatively easily, we can anonymize human’s face.

Sunday, December 9, 2018

Kuzushiji-MNIST exploring

Kuzushiji-MNIST exploring

Overview

Kuzushiji-MNIST is MNIST like data set based on classical Japanese letters.
The following image is part of the data set. As you can see, this is composed of visually complex letters.

sample_images

On this article, I’ll do simple introduction of Kuzushiji-MNIST and classification with Keras model.


Saturday, November 3, 2018

Data Science with Functional Programming on Python

Data Science with Functional Programming

Overview

On this article, I’ll show some functional programming approach to data science with Python. With functional approach, some pre-processing can be concise. Especially when you are reluctant to use pandas library on some situation, this kind of approach can lead to code-readability.


Monday, July 9, 2018

How to write Residual module: understanding and coding with Keras

Abstract

This article covers basic understanding and coding of Residual module. If you have experience of using fine tuning or frequently tackle with image recognition tasks, probably you have heard the network name, ResNet. ResNet is composed of Residual module, whose structure is expressed as below.


The image above is from https://arxiv.org/abs/1512.03385.
Basically, deeper neural network contributes to the better outcome. If you have enough computational resource(unfortunately, I don't have), for difficult task, you can approach it with really deep neural network. However, with deeper neural network, the problem of degradation comes, which makes it difficult to train the model. Residual module offers one of the solutions to this problem, meaning that with this, we can make deeper neural network by softening the difficulty of training.
For precise and better understanding, I recommend that you read the paper below. Here, I'll just show summary for simple and concise understanding and coding with Keras.
If there are strange or wrong points, please let me know by comment or message.

Sunday, June 10, 2018

How to write Inception module: understanding and coding with Keras

Abstract

This article covers the basic understanding and coding of Inception module.
GoogLeNet, which is composed by stacking Inception modules, achieved the state-of-the-art in ILSVRC 2014. And probably, many people already touched the models which have the name “Inception” by fine-tuning. Here, on this article, I'll deal with the Inception module.
To write the model, I'll use Keras with Python.
To deepen your knowledge, you can use the following paper.

Tuesday, February 20, 2018

Simple Bayesian Modeling on Edward by Hamiltonian Monte Carlo

Overview

On this article, I'll re-write by Edward the simple bayesian model that was written on Stan.
This time, my target is from the following article.
Actually, I already wrote the article, Simple regression by Edward: variational inference. There, I re-wrote the model on Edward. But at that time, I used variational bayesian method for inference.
Stan uses Hamiltonian Monte Carlo. So, this time, I'll use Hamiltonian Monte Carlo on Edward and re-write the model.

Monday, February 19, 2018

Bayesian prediction interval from pystan output

On this article, I’ll leave the simple memo to get bayesian prediction interval from the sampled points of PyStan output and visualize it.
Basically, I’ll use the code from the article, Simple Bayesian modeling by Stan.


Tuesday, January 30, 2018

How to make the local level model with seasonal effect

Overview

On time-series analytics, we frequently need to think about a recurring pattern. In the context of time-series analytics, a recurring pattern is referred to as a seasonal effect.

For example, please see the image below. This image is the plotting of a time series data. As you can see, it has recurrent pattern.

enter image description here
On this article, I'll make the local level model with seasonal effects on Stan.

Sunday, January 28, 2018

How to check autocorrelation on Python

To time series data, we usually check autocorrelation. As a memo, I’ll write down how to get the autocorrelation and the plot of it on Python.

Saturday, January 20, 2018

Summary of local level model and local linear trend model to time series data

Overview

On this article, I’ll leave the summary about local level model and local linear trend model.
The both models are for time series analysis. Those are too simple to adapt for real data as they are. But those are very fundamental in many cases and by adding some other factors, those can become practical. So, here, I’ll leave rough memos about those.
As a text book, I’m using the following book. This article responds to chapters two and three.




Tuesday, January 16, 2018

Local Linear Trend Model for time series analysis on Stan

Overview

On this article, I’ll make the local linear trend model to artificial time series data by Stan. Before, I made a local level model on Stan on the article, Local level model to time series data on Stan.
By adding the slope variable to that model, I’ll make the local linear trend model.
I used this book as reference.

Thursday, December 7, 2017

How to use TensorBoard through arithmetic calculation on TensorFlow

Overview

Through basic arithmetic operations, let’s check how those are expressed on TensorBoard.

It has two main points.
One, check the main calculation function on TensorFlow.
Two, check how it is expressed on TensorBoard.

TensorFlow deals with Tensor, leading us to use TensorFlow’s methods for mathematical operations. Simply, here, I’ll use some of them. And, TensorBoard is the tool to check the graph and other information graphically. As a simple check, I’ll show how those operations are expressed visually on that.


Friday, November 10, 2017

Simple regression by Edward: variational inference

Overview

Edward is one of the PPL(probabilistic programming language). This enables us to use variational inference, Gibbs sampling and Monte Carlo method relatively easily. But it doesn’t look so easy. So step by step, I’ll try this.

On this article, simple regression, tried on the article Simple Bayesian modeling by Stan, can be the nice example. So I did same things by Edward, using variational inference.


Monday, October 23, 2017

How to complement missing values in data on Python

As data pre-processing, we frequently need to deal with missing values. There are some ways to deal with those and one of them is to complement those by representative values.

On Python, by scikit-learn, we can do it.
I'll use air quality data to try it.

To prepare the data, on R console, execute the following code on your working directory.

write.csv(airquality, "airquality.csv", row.names=FALSE)


Sunday, October 1, 2017

Perceptron by scikit-learn

Overview

I sometimes use Perceptron, one of the machine learning algorithms, as practice of algorithm writing from scratch.

But in many cases, it is highly recommended to use machine learning library. Although there are not many cases in practice that we use Perceptron, it is not wasted to know how to write Perceptron by the library, concretely scikit-learn.

On this article, I’ll show how to write Perceptron by scikit-learn.