Monday, July 31, 2017

How to use gonum/matrix (Golang package)

When I started to learn about Golang, the first obstacle to use that for machine learning was matrix data manipulation. On Python, you can use numpy, pandas. On Go, on some machine learning package uses gonum/matrix. So I just checked how to use.

Overview

I make a summary about gonum/matrix’s basic usage.

Monday, July 24, 2017

Understand how to use keras's functional API

Overview


keras is awesome tool to make neural network. Being compared with Tensorflow, the code can be shorter and more concise. If you want to enter the gate to neural network, deep learning but feel scary about that, I strongly recommend you use keras.

keras has two types of writing ways. Here I introduce one of them, functional API.



Sunday, July 16, 2017

How Dropout works on Neural Network

Overview

Dropout is one of the good techniques to make good neural network model. The system of it is very simple.

Wednesday, July 5, 2017

Perceptron from scratch

Overview


There are good libraries to make machine learning model and usually, it’s enough to use those to attain the goal you set on the model.

It’s not necessary to write algorithm by yourself. To say precisely, to write and use your full-scratch written model makes more bugs than prevalent library’s one. So you should use prevalent libraries except for the time that those don’t fulfill what you want to get.

But to deepen your understandings and knowledge to machine leaning, writing existing algorithm by yourself is very good trial.
Here, I show how to write perceptron algorithm.

Saturday, July 1, 2017

Practical hack to make deep learning model

Overview

Neural network has a lot of flexibility in its design. You can choose and set many components and options. Because of that, to make more optimized network, you need to know and care about the procedures to adjust those to update your network efficiently.
Here, I arranged neural network’s components and in which procedure those should be adjusted.

Thursday, June 29, 2017

Re-try CNN + KNN model

Overview

When I tried CNN + KNN model before, the training epoch was not enough(50) to check the characteristics. This time I trained 200 epoch on the CNN phase.

Wednesday, June 28, 2017

Simple guide to Neural Network

What is Neural network?

Neural network is an algorithm which make input go through at least one hidden and output layers to output.
Graphically it is like below.


Tuesday, June 27, 2017

CNN + KNN model accuracy

Overview

On the contest site like Kaggle, we can see many trials and good scores by the combination of some methods.
For example, you can get scores by logistic regression and lasso regression. You can make xgboost model by using those scores.
This time, about cifar-10, I make CNN model. And by using the score, I check KNN scores.

Sunday, June 25, 2017

The pragmatic procedure of making CNN model

Overview


On the image classification modeling, you need to understand how good your model is, meaning not absolute accuracy itself but relative meaning of the accuracy.

This is the example. Your first trial model's validation accuracy is 0.6. How do you think about it?
Without knowing the unique label number, ratio, and the data's difficulty, only answer you can return is "I don't know".
To evaluate the model, not only the absolute accuracy but also the base score to compare with are necessary.

If the modeling trial and error don't take much time, you can feel the scale of goodness and accuracy by many trial samples. But usually image classification model takes much time to make themselves.
How do we do the shortcut?

How to write diverged type neural network by keras

How to write Diverged neural network

Overview


Simple style neural network as below is easy to write by deep learning frame work. 


This time, I make diverged neural network whose route to output is diverged and merged. The image of this is like below.



The purpose of this article is following two points.
  • see how to write diverged type neural network
  • see how accurate and good this type of model is
I used keras to write. Although it is bit annoying to write this kind of neural network compared with simple type, keras makes diverged type of model in relatively easy manner.
About the model's characteristics and accuracy, it’s difficult to judge, because there is no simple model which is relevant to the diverged model. So, we can just check roughly.

Friday, June 23, 2017

Sigmoid function

sigmoid function

Sigmoid function is frequently used in machine learning, because it can approximates discontinuous function like step function.
This function is very simple as you can see.

In the code, you can write like this.
import numpy as np

def sig(x):
    return 1 / (1 + np.exp(-x))
And by plotting.
import matplotlib.pyplot as plt

x = list(range(-100, 100))
y = [sig(i) for i in x]
plt.plot(x, y)
plt.show()



On this plot, the inclination looks too strong.
By focusing on small range, we check this.
x = list(range(-10, 10))
y = [sig(i) for i in x]
plt.plot(x, y)
plt.show()


By this, we can see how it changes.
Sigmoid function has following characteristics.
  • When the input is equal to 0, the output is 1/2.
  • This function is monotonically increasing.
  • This function is point symmetry at (0, 1/2)

Googles's Tensorflow Object Detection API trial

Try Google’s TensorFlow Object Detection API

Overview

Google sent to the world awesome object detector.
When I tried object detection before by myself, I strongly felt it was hard job and even small trial took much time.
Not to be late to the growing technology about image detection, I tried object detection tutorial today.

Thursday, June 22, 2017

Method for efficient neural network

Overview

Usually, neural network’s training takes much time and doesn’t go well. There are some ways to make that efficiently go.
Here, I list up those and summarize.
By using those method, the training go well and good model can be made.