吴恩达 机器学习作业 python实现
简介?包括但不限于线性回归,逻辑回归,神经网络,聚类,PCA,支持向量机,异常检测,推荐系统算法
JiYH
本科在读
展开
-
吴恩达机器学习作业(八)——异常检测和推荐系统
异常检测参考资料:https://github.com/fengdu78/Coursera-ML-AndrewNg-Notes先看数据:import numpy as npimport matplotlib.pyplot as pltfrom scipy import statsfrom scipy.io import loadmatimport mathdata = loadmat('data/ex8data1.mat') # Xval,yval,XX = data['X']Xval原创 2021-08-08 17:24:16 · 768 阅读 · 2 评论 -
吴恩达机器学习作业(七)K-means && PCA ———python实现
K-means参考资料:https://github.com/fengdu78/Coursera-ML-AndrewNg-Notes先看数据:import numpy as npimport pandas as pdimport matplotlib.pyplot as pltimport seaborn as sbfrom scipy.io import loadmatdata = loadmat('data/ex7data2.mat')data2 = pd.DataFrame(data原创 2021-07-28 16:44:00 · 1414 阅读 · 1 评论 -
吴恩达机器学习作业(六)SVM--支持向量机
一先看下数据的样子import pandas as pdimport matplotlib.pyplot as pltfrom scipy.io import loadmatfrom sklearn import svmraw_data = loadmat('data/ex6data1.mat')data = pd.DataFrame(raw_data['X'], columns=['X1', 'X2'])data['y'] = raw_data['y']positive = data[原创 2021-07-27 16:41:56 · 1326 阅读 · 5 评论 -
吴恩达机器学习作业(五)偏差与方差-python实现
学习目标理解偏差与方差学会运用学习曲线找到最好的模型1,拟合数据首先,我们将所有的数据分成三部分,训练集(60%),测试集(20%)和交叉验证集(20%)。import scipy.io as scioimport numpy as npimport scipy.optimize as optimport matplotlib.pyplot as pltdata = scio.loadmat('ex5data1.mat')X = data['X']y = data['y']y = y原创 2021-07-16 22:39:36 · 510 阅读 · 2 评论 -
吴恩达机器学习作业(四)——BP神经网络--Python实现
BP神经网络,即使用反向传播算法(BackPropagation algorithm)的神经网络该模型输入层有(100+1)中间层(25+1)输出层(10)以下为python语言实现的反向传播算法import numpy as npfrom scipy.io import loadmatfrom scipy.optimize import minimizefrom sklearn.preprocessing import OneHotEncoderimport scipy.io as s原创 2021-07-12 21:39:01 · 900 阅读 · 2 评论 -
吴恩达机器学习作业(三)手写字体识别neural network _python实现
手写字体识别:import matplotlib.pyplot as pltimport numpy as npimport scipy.io as scioimport matplotlibimport scipy.optimize as optpath = 'ex3data1.mat'def sigmoid(z): return 1 / (1 + np.exp(-z))def cost(theta, X, y, learningRate): theta = np.原创 2021-06-26 10:56:02 · 573 阅读 · 2 评论 -
吴恩达机器学习作业(二)逻辑回归_python实现
一,必做部分import pandas as pdimport numpy as npimport scipy.optimize as optimport matplotlib.pyplot as pltfrom sklearn.metrics import classification_report#这个包是评价报告def get_X(df):#读取特征 ones = pd.DataFrame({'ones': np.ones(len(df))})#ones是m行1列的datafr原创 2021-06-04 19:23:14 · 2572 阅读 · 19 评论 -
吴恩达机器学习作业(一)线性回归_python实现
必做部分:(主要参考了黄海广老师的文档)import numpy as npimport matplotlib.pyplot as pltimport pandas as pddf = pd.read_csv('ex1data1.txt', names=['population', 'profit'])data = df#def normalize_feature(df): #return df.apply(lambda column: (column - column.mean()原创 2021-05-07 19:17:20 · 6937 阅读 · 26 评论