# python

## Learn Hands-On Machine Learning with Scikit-Learn and TensorFlow-Chapter 10

LTU(Linear Threshold Unit) $$\vec{w}=\{w_1,w_2,…,w_n\}$$ is the weight vector, $$\vec{x}=\{x_1,x_2,…,x_n\}$$ is an input feature vector. step(z) can be a heaviside step function which outputs 1 for z>=0, and outputs 0 for […]

## understand tensorflow graph

To understand tensorflow computation graph, you need to know how to print or plot it. If you can visualize the computation graph, it would be easy to understand it. The […]

## Learn Hands-On Machine Learning with Scikit-Learn and TensorFlow-Chapter 8

np.random.seed(4) m = 60 w1, w2 = 0.1, 0.3 noise = 0.1 angles = np.random.rand(m) * 3 * np.pi / 2 – 0.5 X = np.empty((m, 3)) X = np.empty((m, […]

## Learn Hands-On Machine Learning with Scikit-Learn and TensorFlow-Chapter 4

import numpy as np X=2*np.random.rand(100,1) y=4+3*X+np.random.randn(100,1) X_b=np.c_[np.ones((100,1)),X]# add x0 = 1 to each instance theta_best=np.linalg.inv(X_b.T.dot(X_b)).dot(X_b.T).dot(y) numpy.rand(100,1) generates a 100*1 array, whose elements are random number ranging from 0 to 1. numpy.randn(100,1) generates a 100*1 array whose elements […]

## sklearn StratifiedKFold

We’ve learnt sklearn KFold. KFold splits an array into several groups. If the elements in the array are associated with a label/class, there would raise a problem. The ration of […]

## sklearn kfold

KFold is a class in the model_selection module of sklearn package. The usage of KFold is simple: kfold=KFold(n_splits,shuffle, random_state) Now, a KFold object is ready. Notice that the data to […]

## python iterable and iterator

An object is called an iterable object if it has an __iter__ method. List, tuple, dict are all iterable objects[reference]: The __iter__ method returns an iterator object. An object is […]

## Learn Hands-On Machine Learning with Scikit-Learn and TensorFlow-Chapter 3

In the chapter 3 of the book “Hands-On Machine Learning with Scikit-Learn and TensorFlow”, the author plays a big joke with the readers. The fetch_mldata function in the python module […]

## How to run jupyter?

If you are learning machine learning on your computer. The first thing would be running the jupyter app to do some hands-on. Running this program is not similar to running […]

## Learn Hands-On Machine Learning with Scikit-Learn and TensorFlow

The chapter 2 of this book is a little difficult to learn because it is a hands-on project using python. It is not a simple hello world python program, but […]