Showing posts with label MachineLearning. Show all posts
Showing posts with label MachineLearning. Show all posts

Saturday, August 5, 2017

Perceptron by Golang from scratch

Overview

I tried perceptron, almost “Hello world” in machine learning, by Golang.
Go has matrix calculation library like numpy on Python. But this time I just used default types.

Usually on machine leaning, R and Python are frequently used and almost all from-scratch code of machine learning is shown by those or by C++. So I just tried this “Hello world”.



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.


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)

Friday, June 16, 2017

Basic classification example by logistic regression

Basic classification example

Overview

I make classification model of free wine data, following how to deal with it step by step.