Basics 1. Machine Learning

1.1 IDE configuration and installation and testing

  We must first of its profits. For machine learning python is a good choice. This series of blog uses python 3.6.0 + pycharm, and then assisted a number of machine learning libraries, such as numpy, matplotlib, these readers to install Google.

  After installing you can run the following code to detect the effect of the installation.

import numpy as np
from numpy import *
import matplotlib.pyplot as plt

# 测试数据集
dataSet = [[-0.017612,14.053064],[-1.395634    ,4.662541],[-0.752157    ,6.538620],[-1.322371    ,7.152853],
[0.423363    ,11.054677],[0.406704    ,7.067335],[0.667394    ,12.741452],[-2.460150    ,6.866805],
[0.569411    ,9.548755],[-0.026632    ,10.427743],[0.850433    ,6.920334],[1.347183    ,13.175500],
[1.176813    ,3.167020],[-1.781871    ,9.097953]]

# print(mat(dataSet))
dataMat = mat(dataSet).T
# print(dataMat)
# plt.scatter(dataMat[0],dataMat[1],c='red',marker='o')
plt.scatter(dataMat[0].tolist(),dataMat[1].tolist(),c='red',marker='o')

x= np.linspace(-2,2,100)
y = 2.8*x+9

plt.plot(x,y)
plt.show()

Run shot:

The emergence of running state indicates that the main module installation was successful.

1.2 objects, matrix and vector programming

  For most object-oriented programmers, it should not be a foreign concept. So in machine learning objects What are they? It refers to a row vector containing a set of features. Row vector is similar to a row of tables in our lives, as follows:

   Columns of the first row of the table indicates the name of the feature. All features are grouped together constitute a set of row vectors, also called a feature vector.


 

Guess you like

Origin www.cnblogs.com/xiaochi/p/10945329.html