我的代码-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集群(聚类)的概念.什么是无监督学习:对于无 ...
随机推荐
- go报错unimplemented: 64-bit mode not compiled in与mingw 64位安装报错ERROR res已解决
问题一:cc1.exe: sorry, unimplemented: 64-bit mode not compiled in 参考:https://www.cnblogs.com/lesroad/p/ ...
- 如何理解JavaScript中的原型和原型链
首先是一张关系图,避免抽象化理解时产生的困难 Function对象 函数对象是JavaScript学习中不可避免的一部分,而且这一部分相对重要且抽象 函数的创建方式有2种: 字面量创建 var foo ...
- mybatis源码解析之Configuration加载(二)
概述 上一篇我们讲了configuation.xml中几个标签的解析,例如<properties>,<typeAlises>,<settings>等,今天我们来介绍 ...
- Java线程面试题Top50
不管你是新程序员还是老手,你一定在面试中遇到过有关线程的问题.Java 语言一个重要的特点就是内置了对并发的支持,让 Java 大受企业和程序员的欢迎.大多数待遇丰厚的 Java 开发职位都要求开发者 ...
- 手把手教你如何使用Cocos2d Console 进行html5项目发布
手把手教你如何使用Cocos2d Console 进行html5项目发布 1.首先需要先安装Cocos2d Console运行需要的工具. 详情参见 这篇文章 http://www.cocoach ...
- ps文件解析(纯c解析代码)
参考链接:1. PS流的格式和解析总结 http://www.cnblogs.com/lihaiping/p/4181607.html 2. TS科普5 PES包解析 https://blog.cs ...
- GridControl 主从模式(Master-detail)子表格获取行数据
今天遇到一个问题,gridcontrol使用主从表的时候,在子表中获取子表的行数据时居然获取不到,郁闷了很久.然后在网上找到方法(出处在这里:https://q.cnblogs.com/q/83412 ...
- Adversarial Examples for Semantic Segmentation and Object Detection 阅读笔记
Adversarial Examples for Semantic Segmentation and Object Detection (语义分割和目标检测中的对抗样本) 作者:Cihang Xie, ...
- 二、Memcached缓存穿透、缓存雪崩
二.Memcached缓存穿透.缓存雪崩 1. 缓存雪崩 可能是数据魏加载到缓存中,或者缓存同一时间大面积失效,导致大量请求去数据库查询的过程,数据库过载,崩溃. 解决方法: 1 采用加锁计数,使用合 ...
- Python PIL
Python PIL PIL (Python Image Library) 库是Python 语言的一个第三方库,PIL库支持图像存储.显示和处理,能够处理几乎所有格式的图片. 一.PIL库简介 1. ...