python机器学习-乳腺癌细胞挖掘(博主亲自录制视频)html
author: Toby,项目合做QQ:231469242
https://www.youtube.com/watch?v=lAaCeiqE6CE&list=PLXO45tsB95cJ0U2DKySDmhRqQI9IaGxck算法
图片识别,语音识别,药物发现网络
神经网络原理:hidden layer是经过函数传递值dom
了解神经网络,必须了解线性代数机器学习
神经网络对数字识别是一层层分解函数
https://blog.csdn.net/gamer_gyt/article/details/51255448学习
scikit-learn博主使用的是0.17版本,是稳定版,固然如今有0.18发行版,二者仍是有区别的,感兴趣的能够本身官网上查看测试
scikit-learn0.17(and 以前)上对于Neural Network算法 的支持仅限于 BernoulliRBM大数据
scikit-learn0.18上对于Neural Network算法有三个 neural_network.BernoulliRBM ,neural_network.MLPClassifier,neural_network.MLPRgression
MLP是一个监督学习算法,图1是带一个隐藏层的MLP模型
具体可参考:点击阅读
1:神经网络算法简介
2:Backpropagation算法详细介绍
3:非线性转化方程举例
4:本身实现神经网络算法NeuralNetwork
5:基于NeuralNetwork的XOR实例
6:基于NeuralNetwork的手写数字识别实例
7:scikit-learn中BernoulliRBM使用实例
8:scikit-learn中的手写数字识别实例
以人脑神经网络为启发,历史上出现过不少版本,但最著名的是backpropagation
多层向前神经网络组成部分
输入层(input layer),隐藏层(hiddenlayer),输出层(output layer)
神经网络优势和缺点
优势:大数据高效,处理复杂模型,处理多维度数据,灵活快速
缺点:数据须要预处理
代替:TensorFlow,Keras
python sklearn建模处理乳腺癌细胞分类器
# -*- coding: utf-8 -*- """ Created on Sun Apr 1 11:49:50 2018 @author: Toby,项目合做QQ:231469242 神经网络 """ #Multi-layer Perceptron 多层感知机 from sklearn.neural_network import MLPClassifier #标准化数据,不然神经网络结果不许确,和SVM相似 from sklearn.preprocessing import StandardScaler from sklearn.datasets import load_breast_cancer from sklearn.model_selection import train_test_split import mglearn import matplotlib.pyplot as plt mglearn.plots.plot_logistic_regression_graph() mglearn.plots.plot_single_hidden_layer_graph() cancer=load_breast_cancer() x_train,x_test,y_train,y_test=train_test_split(cancer.data,cancer.target,stratify=cancer.target,random_state=42) mlp=MLPClassifier(random_state=42) mlp.fit(x_train,y_train) print("neural network:") print("accuracy on the training subset:{:.3f}".format(mlp.score(x_train,y_train))) print("accuracy on the test subset:{:.3f}".format(mlp.score(x_test,y_test))) scaler=StandardScaler() x_train_scaled=scaler.fit(x_train).transform(x_train) x_test_scaled=scaler.fit(x_test).transform(x_test) mlp_scaled=MLPClassifier(max_iter=1000,random_state=42) mlp_scaled.fit(x_train_scaled,y_train) print("neural network after scaled:") print("accuracy on the training subset:{:.3f}".format(mlp_scaled.score(x_train_scaled,y_train))) print("accuracy on the test subset:{:.3f}".format(mlp_scaled.score(x_test_scaled,y_test))) mlp_scaled2=MLPClassifier(max_iter=1000,alpha=1,random_state=42) mlp_scaled.fit(x_train_scaled,y_train) print("neural network after scaled and alpha change to 1:") print("accuracy on the training subset:{:.3f}".format(mlp_scaled.score(x_train_scaled,y_train))) print("accuracy on the test subset:{:.3f}".format(mlp_scaled.score(x_test_scaled,y_test))) plt.figure(figsize=(20,5)) plt.imshow(mlp.coefs_[0],interpolation="None",cmap="GnBu") plt.yticks(range(30),cancer.feature_names) plt.xlabel("columns in weight matrix") plt.ylabel("input feature") plt.colorbar()
python信用评分卡建模(附代码,博主录制)