我的代码-unsupervised learning
# coding: utf-8
# In[1]:
import pandas as pd
import numpy as np
from sklearn import tree
from sklearn.svm import SVC
from sklearn.grid_search import GridSearchCV
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report, confusion_matrix
from sklearn.preprocessing import binarize
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import OneHotEncoder
from sklearn.preprocessing import Normalizer
from sklearn.metrics import f1_score
from sklearn.metrics import accuracy_score,recall_score,average_precision_score,auc
# In[2]:
data = pd.read_csv("D:/Users/SGG91044/Desktop/MEP_no_defect_data_pivot_test.csv")
# In[3]:
data.head()
# In[4]:
data.drop(columns=["lotid","waferid","defect_count","eqpid","Chamber","Step","Recipie_Name"],inplace=True)
data
# In[5]:
data.iloc[:,0:17] = data.iloc[:,0:17].apply(pd.to_numeric,errors='coerce')
# In[6]:
for i in range(0,17):
med = np.median(data.iloc[:,i][data.iloc[:,i].isna() == False])
data.iloc[:,i] = data.iloc[:,i].fillna(med)
# In[10]:
nz = Normalizer()
X=data.iloc[:,0:19]=pd.DataFrame(nz.fit_transform(data.iloc[:,0:17]),columns=data.iloc[:,0:17].columns)
# In[11]:
X
# In[12]:
X_train, X_test = train_test_split(
X, test_size=0.3, random_state=8)
# In[30]:
# fit the model
clf = IsolationForest( max_samples=10000,random_state=10 )
clf.fit(X_train)
y_pred_train = clf.predict(X_train)
y_pred_test = clf.predict(X_test)
# In[35]:
scores_pred = clf.decision_function(X_train.values)
scores_pred
# In[36]:
clf.decision_function(X_test)
我的代码-unsupervised learning的更多相关文章
- Machine Learning Algorithms Study Notes(4)—无监督学习(unsupervised learning)
1 Unsupervised Learning 1.1 k-means clustering algorithm 1.1.1 算法思想 1.1.2 k-means的不足之处 1 ...
- Unsupervised Learning: Use Cases
Unsupervised Learning: Use Cases Contents Visualization K-Means Clustering Transfer Learning K-Neare ...
- Unsupervised Learning and Text Mining of Emotion Terms Using R
Unsupervised learning refers to data science approaches that involve learning without a prior knowle ...
- Supervised Learning and Unsupervised Learning
Supervised Learning In supervised learning, we are given a data set and already know what our correc ...
- Unsupervised learning无监督学习
Unsupervised learning allows us to approach problems with little or no idea what our results should ...
- PredNet --- Deep Predictive coding networks for video prediction and unsupervised learning --- 论文笔记
PredNet --- Deep Predictive coding networks for video prediction and unsupervised learning ICLR 20 ...
- 131.005 Unsupervised Learning - Cluster | 非监督学习 - 聚类
@(131 - Machine Learning | 机器学习) 零. Goal How Unsupervised Learning fills in that model gap from the ...
- Unsupervised learning, attention, and other mysteries
Unsupervised learning, attention, and other mysteries Get notified when our free report “Future of M ...
- Coursera 机器学习 第8章(上) Unsupervised Learning 学习笔记
8 Unsupervised Learning8.1 Clustering8.1.1 Unsupervised Learning: Introduction集群(聚类)的概念.什么是无监督学习:对于无 ...
随机推荐
- 微信小程序 遇到的问题(新)
1.调用wx.chooseImage(),调用系统相册,此时相册中的动图被转化成静态图,上传后也是静态图. 2.刚进微信小程序,onShow在安卓机下会调用两遍,iPhone下正常
- 关于node_js的比较
node_js的比较是我自己初学遇到的第一个绕脑的事情. 在比较的函数多了之后,一些函数的调用和变量提升, 搞得自己头晕,有时候函数是没有返回值的,自己还在 用变量值去比较,实际上却是undefine ...
- es6(二)
三 . 正则扩展: 1.构造函数的扩展 let regex = new Regex('xyz','i'); let regex2 = new Regex(/xyz/i);//test() 方法用于检测 ...
- Lumen框架使用Redis与框架Cache压测比较
使用命令 ab -c 20000 -n 100000 'http://127.0.0.1:9050/v1/api.store.xxx'进行压测,并同时进行了交叉测试,结果如下: 高并发情况下数据目前没 ...
- IntelliJ IDEA入门系列
1.Java Web之Helloworld配置 2.Java Web之Maven搭建Helloworld 3.Java Web之Spring MVC简单管理系统
- Ubuntu17.04 安装搜狗中文输入法
http://blog.csdn.net/ydyang1126/article/details/76223656
- 正则表达式判断QQ号格式是否正确
#正在表达式匹配QQ号格式是否正确#QQ号假如长度为5-11位,纯为数字 import rewhile 1: qq=input("请输入QQ号:") result=re.finda ...
- 几个常用内核函数(《Windows内核情景分析》)
参考:<Windows内核情景分析> 0x01 ObReferenceObjectByHandle 这个函数从句柄得到对应的内核对象,并递增其引用计数. NTSTATUS ObRefer ...
- JVM CUP占用率过高排除方法,windows环境
jdk自带的jvisualvm可以看到程序CPU使用率,但是无法确定具体的线程,想要确定到具体的线程需要借用到微软的Process Explorer 具体排除方法: 一:打开资源管理器,找到cup占用 ...
- ESP系列MQTT数据通信
1.使用一个深圳四博智联科技有限公司的NODEMCU开发板. 2.下载MQTT的SDK压缩包,请查看附件. 3.用官方提供的Eclipse打开MQTT的sdk开发包. 4.打开include文件夹中的 ...