You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

763 lines
38 KiB

5 years ago
<!DOCTYPE HTML>
<html lang="" >
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>使用sklearn进行机器学习 · GitBook</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.3">
<link rel="stylesheet" href="gitbook/style.css">
5 years ago
<link rel="stylesheet" href="gitbook/gitbook-plugin-katex/katex.min.css">
5 years ago
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
<link rel="prev" href="cluster_metrics.html" />
</head>
<body>
<div class="book">
<div class="book-summary">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search" />
</div>
<nav role="navigation">
<ul class="summary">
<li class="chapter " data-level="1.1" data-path="./">
<a href="./">
简介
</a>
</li>
<li class="chapter " data-level="1.2" data-path="machine_learning.html">
<a href="machine_learning.html">
机器学习概述
</a>
</li>
<li class="chapter " data-level="1.3" data-path="algorithm.html">
<a href="algorithm.html">
常见机器学习算法
</a>
<ul class="articles">
<li class="chapter " data-level="1.3.1" data-path="kNN.html">
<a href="kNN.html">
近朱者赤近墨者黑-kNN
</a>
</li>
<li class="chapter " data-level="1.3.2" data-path="linear_regression.html">
<a href="linear_regression.html">
最简单的回归算法-线性回归
</a>
</li>
<li class="chapter " data-level="1.3.3" data-path="logistic_regression.html">
<a href="logistic_regression.html">
使用回归的思想进行分类-逻辑回归
</a>
</li>
<li class="chapter " data-level="1.3.4" data-path="decision_tree.html">
<a href="decision_tree.html">
最接近人类思维的算法-决策树
</a>
</li>
<li class="chapter " data-level="1.3.5" data-path="random_forest.html">
<a href="random_forest.html">
群众的力量是伟大的-随机森林
</a>
</li>
<li class="chapter " data-level="1.3.6" data-path="kMeans.html">
<a href="kMeans.html">
物以类聚人以群分-kMeans
</a>
</li>
<li class="chapter " data-level="1.3.7" data-path="AGNES.html">
<a href="AGNES.html">
以距离为尺-AGNES
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.4" data-path="metrics.html">
<a href="metrics.html">
模型评估指标
</a>
<ul class="articles">
<li class="chapter " data-level="1.4.1" data-path="classification_metrics.html">
<a href="classification_metrics.html">
分类性能评估指标
</a>
</li>
<li class="chapter " data-level="1.4.2" data-path="regression_metrics.html">
<a href="regression_metrics.html">
回归性能评估指标
</a>
</li>
<li class="chapter " data-level="1.4.3" data-path="cluster_metrics.html">
<a href="cluster_metrics.html">
聚类性能评估指标
</a>
</li>
</ul>
</li>
<li class="chapter active" data-level="1.5" data-path="sklearn.html">
<a href="sklearn.html">
使用sklearn进行机器学习
</a>
</li>
5 years ago
<li class="chapter " data-level="1.6" >
<span>
综合实战案例
</span>
<ul class="articles">
<li class="chapter " data-level="1.6.1" >
<span>
泰坦尼克生还预测
</span>
<ul class="articles">
<li class="chapter " data-level="1.6.1.1" data-path="titanic/introduction.html">
<a href="titanic/introduction.html">
简介
</a>
</li>
<li class="chapter " data-level="1.6.1.2" data-path="titanic/EDA.html">
<a href="titanic/EDA.html">
探索性数据分析(EDA)
</a>
</li>
<li class="chapter " data-level="1.6.1.3" data-path="titanic/feature engerning.html">
<a href="titanic/feature engerning.html">
特征工程
</a>
</li>
<li class="chapter " data-level="1.6.1.4" data-path="titanic/fit and predict.html">
<a href="titanic/fit and predict.html">
构建模型进行预测
</a>
</li>
<li class="chapter " data-level="1.6.1.5" data-path="titanic/tuning.html">
<a href="titanic/tuning.html">
调参
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.6.2" >
<span>
使用强化学习玩乒乓球游戏
</span>
<ul class="articles">
<li class="chapter " data-level="1.6.2.1" data-path="pingpong/what is reinforce learning.html">
<a href="pingpong/what is reinforce learning.html">
什么是强化学习
</a>
</li>
<li class="chapter " data-level="1.6.2.2" data-path="pingpong/Policy Gradient.html">
<a href="pingpong/Policy Gradient.html">
Policy Gradient原理
</a>
</li>
<li class="chapter " data-level="1.6.2.3" data-path="pingpong/coding.html">
<a href="pingpong/coding.html">
使用Policy Gradient玩乒乓球游戏
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="1.7" data-path="recommand.html">
<a href="recommand.html">
实训推荐
</a>
</li>
5 years ago
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="." >使用sklearn进行机器学习</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<h1 id="&#x4F7F;&#x7528;sklearn&#x8FDB;&#x884C;&#x673A;&#x5668;&#x5B66;&#x4E60;">&#x4F7F;&#x7528;sklearn&#x8FDB;&#x884C;&#x673A;&#x5668;&#x5B66;&#x4E60;</h1>
<h2 id="&#x5199;&#x5728;&#x524D;&#x9762;">&#x5199;&#x5728;&#x524D;&#x9762;</h2>
<p>&#x8FD9;&#x662F;&#x4E00;&#x4E2A; sklearn &#x7684; hello world &#x7EA7;&#x6559;&#x7A0B;&#xFF0C;&#x60F3;&#x8981;&#x66F4;&#x52A0;&#x7CFB;&#x7EDF;&#x66F4;&#x52A0;&#x5168;&#x9762;&#x7684;&#x5B66;&#x4E60; sklearn &#x5EFA;&#x8BAE;&#x67E5;&#x9605; sklearn &#x7684;<a href="https://scikit-learn.org/stable/" target="_blank">&#x5B98;&#x65B9;&#x7F51;&#x7AD9;</a>&#x3002;</p>
<h2 id="sklearn&#x7B80;&#x4ECB;">sklearn&#x7B80;&#x4ECB;</h2>
<p>scikit-learn(&#x7B80;&#x8BB0;sklearn)&#xFF0C;&#x662F;&#x7528; python &#x5B9E;&#x73B0;&#x7684;&#x673A;&#x5668;&#x5B66;&#x4E60;&#x7B97;&#x6CD5;&#x5E93;&#x3002;sklearn &#x53EF;&#x4EE5;&#x5B9E;&#x73B0;&#x6570;&#x636E;&#x9884;&#x5904;&#x7406;&#x3001;&#x5206;&#x7C7B;&#x3001;&#x56DE;&#x5F52;&#x3001;&#x964D;&#x7EF4;&#x3001;&#x6A21;&#x578B;&#x9009;&#x62E9;&#x7B49;&#x5E38;&#x7528;&#x7684;&#x673A;&#x5668;&#x5B66;&#x4E60;&#x7B97;&#x6CD5;&#x3002;&#x57FA;&#x672C;&#x4E0A;&#x53EA;&#x9700;&#x8981;&#x77E5;&#x9053;&#x4E00;&#x4E9B; python &#x7684;&#x57FA;&#x7840;&#x8BED;&#x6CD5;&#x77E5;&#x8BC6;&#x5C31;&#x80FD;&#x5B66;&#x4F1A;&#x600E;&#x6837;&#x4F7F;&#x7528; sklearn &#x4E86;&#xFF0C;&#x6240;&#x4EE5; sklearn &#x662F;&#x4E00;&#x6B3E;&#x975E;&#x5E38;&#x597D;&#x7528;&#x7684; python &#x673A;&#x5668;&#x5B66;&#x4E60;&#x5E93;&#x3002;</p>
<h2 id="sklearn&#x7684;&#x5B89;&#x88C5;">sklearn&#x7684;&#x5B89;&#x88C5;</h2>
<p>&#x548C;&#x5B89;&#x88C5;&#x5176;&#x4ED6;&#x7B2C;&#x4E09;&#x65B9;&#x5E93;&#x4E00;&#x6837;&#x7B80;&#x5355;&#xFF0C;&#x53EA;&#x9700;&#x8981;&#x5728;&#x547D;&#x4EE4;&#x884C;&#x4E2D;&#x8F93;&#x5165; <code>pip install scikit-learn</code> &#x5373;&#x53EF;&#x3002;</p>
<h2 id="sklearn&#x7684;&#x76EE;&#x5F55;&#x7ED3;&#x6784;">sklearn&#x7684;&#x76EE;&#x5F55;&#x7ED3;&#x6784;</h2>
<p>sklearn &#x63D0;&#x4F9B;&#x7684;&#x63A5;&#x53E3;&#x90FD;&#x5C01;&#x88C5;&#x5728;&#x4E0D;&#x540C;&#x7684;&#x76EE;&#x5F55;&#x4E0B;&#x7684;&#x4E0D;&#x540C;&#x7684; py &#x6587;&#x4EF6;&#x4E2D;&#xFF0C;&#x6240;&#x4EE5;&#x5BF9; sklearn &#x7684;&#x76EE;&#x5F55;&#x7ED3;&#x6784;&#x6709;&#x4E00;&#x4E2A;&#x5927;&#x81F4;&#x7684;&#x4E86;&#x89E3;&#xFF0C;&#x6709;&#x52A9;&#x4E8E;&#x6211;&#x4EEC;&#x66F4;&#x52A0;&#x6DF1;&#x523B;&#x5730;&#x7406;&#x89E3; sklearn &#x3002;&#x76EE;&#x5F55;&#x7ED3;&#x6784;&#x5982;&#x4E0B;&#xFF1A;</p>
<p><img src="img/29.jpg" alt=""></p>
<p>&#x5176;&#x5B9E;&#x4ECE;&#x76EE;&#x5F55;&#x540D;&#x5B57;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#x76EE;&#x5F55;&#x4E2D;&#x7684; py &#x6587;&#x4EF6;&#x662F;&#x5E72;&#x5565;&#x7684;&#x3002;&#x6BD4;&#x5982; cluster &#x76EE;&#x5F55;&#x4E0B;&#x90FD;&#x662F;&#x805A;&#x7C7B;&#x7B97;&#x6CD5;&#x63A5;&#x53E3;&#xFF0C; ensem &#x76EE;&#x5F55;&#x4E0B;&#x90FD;&#x662F;&#x96C6;&#x6210;&#x5B66;&#x4E60;&#x7B97;&#x6CD5;&#x7684;&#x63A5;&#x53E3;&#x3002;</p>
<h2 id="&#x4F7F;&#x7528;sklearn&#x8BC6;&#x522B;&#x624B;&#x5199;&#x6570;&#x5B57;">&#x4F7F;&#x7528;sklearn&#x8BC6;&#x522B;&#x624B;&#x5199;&#x6570;&#x5B57;</h2>
<p>&#x63A5;&#x4E0B;&#x6765;&#x4E0D;&#x5982;&#x901A;&#x8FC7;&#x4E00;&#x4E2A;&#x5B9E;&#x4F8B;&#x6765;&#x611F;&#x53D7;&#x4E00;&#x4E0B; sklearn &#x7684;&#x5F3A;&#x5927;&#x3002;</p>
<p>&#x60F3;&#x8981;&#x8BC6;&#x522B;&#x624B;&#x5199;&#x6570;&#x5B57;&#xFF0C;&#x9996;&#x5148;&#x9700;&#x8981;&#x6709;&#x6570;&#x636E;&#x3002;sklearn &#x4E2D;&#x5DF2;&#x7ECF;&#x4E3A;&#x6211;&#x4EEC;&#x51C6;&#x5907;&#x597D;&#x4E86;&#x4E00;&#x4E9B;&#x6BD4;&#x8F83;&#x7ECF;&#x5178;&#x4E14;&#x8D28;&#x91CF;&#x8F83;&#x9AD8;&#x7684;&#x6570;&#x636E;&#x96C6;&#xFF0C;&#x5176;&#x4E2D;&#x5C31;&#x5305;&#x62EC;&#x624B;&#x5199;&#x6570;&#x5B57;&#x6570;&#x636E;&#x96C6;&#x3002;&#x8BE5;&#x6570;&#x636E;&#x96C6;&#x6709; 1797 &#x4E2A;&#x6837;&#x672C;&#xFF0C;&#x6BCF;&#x4E2A;&#x6837;&#x672C;&#x5305;&#x62EC; 8*8 &#x50CF;&#x7D20;&#xFF08;&#x5B9E;&#x9645;&#x4E0A;&#x662F;&#x4E00;&#x6761;&#x6837;&#x672C;&#x6709; 64 &#x4E2A;&#x7279;&#x5F81;&#xFF0C;&#x6BCF;&#x4E2A;&#x50CF;&#x7D20;&#x770B;&#x6210;&#x662F;&#x4E00;&#x4E2A;&#x7279;&#x5F81;&#xFF0C;&#x6BCF;&#x4E2A;&#x7279;&#x5F81;&#x90FD;&#x662F; float &#x7C7B;&#x578B;&#x7684;&#x6570;&#x503C;&#xFF09;&#x7684;&#x56FE;&#x50CF;&#x548C;&#x4E00;&#x4E2A; [0, 9] &#x6574;&#x6570;&#x7684;&#x6807;&#x7B7E;&#x3002;&#x6BD4;&#x5982;&#x4E0B;&#x56FE;&#x7684;&#x6807;&#x7B7E;&#x662F; 2 &#xFF1A;</p>
<p><img src="img/31.jpg" alt=""></p>
<p>&#x60F3;&#x8981;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x6570;&#x636E;&#x5F88;&#x7B80;&#x5355;&#xFF0C;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> sklearn <span class="hljs-keyword">import</span> datasets
<span class="hljs-comment"># &#x52A0;&#x8F7D;&#x624B;&#x5199;&#x6570;&#x5B57;&#x6570;&#x636E;&#x96C6;</span>
digits = datasets.load_digits()
<span class="hljs-comment"># X&#x8868;&#x793A;&#x7279;&#x5F81;&#xFF0C;&#x5373;1797&#x884C;64&#x5217;&#x7684;&#x77E9;&#x9635;</span>
X = digits.data
<span class="hljs-comment"># Y&#x8868;&#x793A;&#x6807;&#x7B7E;&#xFF0C;&#x5373;1797&#x4E2A;&#x5143;&#x7D20;&#x7684;&#x4E00;&#x7EF4;&#x6570;&#x7EC4;</span>
y = digits.target
</code></pre>
<p>&#x5F97;&#x5230; X&#xFF0C;y &#x6570;&#x636E;&#x4E4B;&#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x8FD8;&#x9700;&#x8981;&#x5C06;&#x8FD9;&#x4E9B;&#x6570;&#x636E;&#x8FDB;&#x884C;&#x5212;&#x5206;&#xFF0C;&#x5212;&#x5206;&#x6210;&#x4E24;&#x4E2A;&#x90E8;&#x5206;&#xFF0C;&#x4E00;&#x90E8;&#x5206;&#x662F;&#x8BAD;&#x7EC3;&#x96C6;&#xFF0C;&#x53E6;&#x4E00;&#x90E8;&#x5206;&#x662F;&#x6D4B;&#x8BD5;&#x96C6;&#x3002;&#x56E0;&#x4E3A;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x6D4B;&#x8BD5;&#x96C6;&#x7684;&#x8BDD;&#xFF0C;&#x6211;&#x4EEC;&#x5E76;&#x4E0D;&#x77E5;&#x9053;&#x6211;&#x4EEC;&#x7684;&#x624B;&#x5199;&#x6570;&#x5B57;&#x8BC6;&#x522B;&#x7A0B;&#x5E8F;&#x8BC6;&#x522B;&#x5F97;&#x51C6;&#x4E0D;&#x51C6;&#x3002;&#x6570;&#x636E;&#x96C6;&#x5212;&#x5206;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># &#x5C06;X&#xFF0C;y&#x5212;&#x5206;&#x6210;&#x8BAD;&#x7EC3;&#x96C6;&#x548C;&#x6D4B;&#x8BD5;&#x96C6;&#xFF0C;&#x5176;&#x4E2D;&#x8BAD;&#x7EC3;&#x96C6;&#x7684;&#x6BD4;&#x4F8B;&#x4E3A;80%&#xFF0C;&#x6D4B;&#x8BD5;&#x96C6;&#x7684;&#x6BD4;&#x4F8B;&#x4E3A;20%</span>
<span class="hljs-comment"># X_train&#x8868;&#x793A;&#x8BAD;&#x7EC3;&#x96C6;&#x7684;&#x7279;&#x5F81;&#xFF0C;X_test&#x8868;&#x793A;&#x6D4B;&#x8BD5;&#x96C6;&#x7684;&#x7279;&#x5F81;&#xFF0C;y_train&#x8868;&#x793A;&#x8BAD;&#x7EC3;&#x96C6;&#x7684;&#x6807;&#x7B7E;&#xFF0C;y_test&#x8868;&#x793A;&#x6D4B;&#x8BD5;&#x96C6;&#x7684;&#x6807;&#x7B7E;</span>
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=<span class="hljs-number">0.2</span>)
</code></pre>
<p>&#x63A5;&#x4E0B;&#x6765;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x673A;&#x5668;&#x5B66;&#x4E60;&#x7B97;&#x6CD5;&#x6765;&#x5B9E;&#x73B0;&#x624B;&#x5199;&#x6570;&#x5B57;&#x8BC6;&#x522B;&#x4E86;&#xFF0C;&#x4F8B;&#x5982;&#x60F3;&#x8981;&#x4F7F;&#x7528;&#x968F;&#x673A;&#x68EE;&#x6797;&#x6765;&#x8FDB;&#x884C;&#x8BC6;&#x522B;&#xFF0C;&#x90A3;&#x4E48;&#x9996;&#x5148;&#x8981;&#x5BFC;&#x5165;&#x968F;&#x673A;&#x68EE;&#x6797;&#x7B97;&#x6CD5;&#x63A5;&#x53E3;&#x3002;</p>
<pre><code class="lang-python"><span class="hljs-comment"># &#x7531;&#x4E8E;&#x662F;&#x5206;&#x7C7B;&#x95EE;&#x9898;&#xFF0C;&#x6240;&#x4EE5;&#x5BFC;&#x5165;&#x7684;&#x662F;RandomForestClassifier</span>
<span class="hljs-keyword">from</span> sklearn.ensemble <span class="hljs-keyword">import</span> RandomForestClassifier
</code></pre>
<p>&#x5BFC;&#x5165;&#x597D;&#x63A5;&#x53E3;&#x540E;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x521B;&#x5EFA;&#x968F;&#x673A;&#x68EE;&#x6797;&#x5BF9;&#x8C61;&#x4E86;&#x3002;&#x968F;&#x673A;&#x68EE;&#x6797;&#x5BF9;&#x8C61;&#x6709;&#x7528;&#x6765;&#x8BAD;&#x7EC3;&#x7684;&#x51FD;&#x6570; <code>fit</code> &#x548C;&#x7528;&#x6765;&#x9884;&#x6D4B;&#x7684;&#x51FD;&#x6570; <code>predict</code>&#x3002;<code>fit</code>&#x51FD;&#x6570;&#x9700;&#x8981;&#x8BAD;&#x7EC3;&#x96C6;&#x7684;&#x7279;&#x5F81;&#x548C;&#x8BAD;&#x7EC3;&#x96C6;&#x7684;&#x6807;&#x7B7E;&#x4F5C;&#x4E3A;&#x8F93;&#x5165;&#xFF0C;<code>predict</code>&#x51FD;&#x6570;&#x9700;&#x8981;&#x6D4B;&#x8BD5;&#x96C6;&#x7684;&#x7279;&#x5F81;&#x4F5C;&#x4E3A;&#x8F93;&#x5165;&#x3002;&#x6240;&#x4EE5;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># &#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x6709;50&#x68F5;&#x51B3;&#x7B56;&#x6811;&#x7684;&#x968F;&#x673A;&#x68EE;&#x6797;, n_estimators&#x8868;&#x793A;&#x51B3;&#x7B56;&#x6811;&#x7684;&#x6570;&#x91CF;</span>
clf = RandomForestClassifier(n_estimators=<span class="hljs-number">50</span>)
<span class="hljs-comment"># &#x7528;&#x8BAD;&#x7EC3;&#x96C6;&#x8BAD;&#x7EC3;</span>
clf.fit(X_train, Y_train)
<span class="hljs-comment"># &#x7528;&#x6D4B;&#x8BD5;&#x96C6;&#x6D4B;&#x8BD5;&#xFF0C;result&#x4E3A;&#x9884;&#x6D4B;&#x7ED3;&#x679C;</span>
result = clf.predict(X_test)
</code></pre>
<p>&#x5F97;&#x5230;&#x9884;&#x6D4B;&#x7ED3;&#x679C;&#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5C06;&#x5176;&#x4E0E;&#x6D4B;&#x8BD5;&#x96C6;&#x7684;&#x771F;&#x5B9E;&#x7B54;&#x6848;&#x8FDB;&#x884C;&#x6BD4;&#x5BF9;&#xFF0C;&#x8BA1;&#x7B97;&#x51FA;&#x9884;&#x6D4B;&#x7684;&#x51C6;&#x786E;&#x7387;&#x3002;sklearn &#x5DF2;&#x7ECF;&#x4E3A;&#x6211;&#x4EEC;&#x63D0;&#x4F9B;&#x4E86;&#x8BA1;&#x7B97;&#x51C6;&#x786E;&#x7387;&#x7684;&#x63A5;&#x53E3;&#xFF0C;&#x4F7F;&#x7528;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># &#x5BFC;&#x5165;&#x8BA1;&#x7B97;&#x51C6;&#x786E;&#x7387;&#x7684;&#x63A5;&#x53E3;</span>
<span class="hljs-keyword">from</span> sklearn.metrics <span class="hljs-keyword">import</span> accuracy_score
<span class="hljs-comment"># &#x8BA1;&#x7B97;&#x9884;&#x6D4B;&#x51C6;&#x786E;&#x7387;</span>
acc = accuracy_score(y_test, result)
<span class="hljs-comment"># &#x6253;&#x5370;&#x51C6;&#x786E;&#x7387;</span>
print(acc)
</code></pre>
<p>&#x6B64;&#x65F6;&#x60A8;&#x4F1A;&#x53D1;&#x73B0;&#x6211;&#x4EEC;&#x77ED;&#x77ED;&#x7684;&#x51E0;&#x884C;&#x4EE3;&#x7801;&#x5B9E;&#x73B0;&#x7684;&#x624B;&#x5199;&#x6570;&#x5B57;&#x8BC6;&#x522B;&#x7A0B;&#x5E8F;&#x7684;&#x51C6;&#x786E;&#x7387;&#x9AD8;&#x4E8E; <strong>0.95</strong>&#x3002;</p>
<p>&#x800C;&#x4E14;&#x6211;&#x4EEC;&#x4E0D;&#x4EC5;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x968F;&#x673A;&#x68EE;&#x6797;&#x6765;&#x5B9E;&#x73B0;&#x624B;&#x5199;&#x6570;&#x5B57;&#x8BC6;&#x522B;&#xFF0C;&#x6211;&#x4EEC;&#x8FD8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x522B;&#x7684;&#x673A;&#x5668;&#x5B66;&#x4E60;&#x7B97;&#x6CD5;&#x5B9E;&#x73B0;&#xFF0C;&#x6BD4;&#x5982;&#x903B;&#x8F91;&#x56DE;&#x5F52;&#xFF0C;&#x4EE3;&#x7801;&#x5982;&#x4E0B;:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> sklearn.linear_model <span class="hljs-keyword">import</span> LogisticRegression
<span class="hljs-comment"># &#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x903B;&#x8F91;&#x56DE;&#x5F52;&#x5BF9;&#x8C61;</span>
clf = LogisticRegression()
<span class="hljs-comment"># &#x7528;&#x8BAD;&#x7EC3;&#x96C6;&#x8BAD;&#x7EC3;</span>
clf.fit(X_train, Y_train)
<span class="hljs-comment"># &#x7528;&#x6D4B;&#x8BD5;&#x96C6;&#x6D4B;&#x8BD5;&#xFF0C;result&#x4E3A;&#x9884;&#x6D4B;&#x7ED3;&#x679C;</span>
result = clf.predict(X_test)
</code></pre>
<p>&#x7EC6;&#x5FC3;&#x7684;&#x60A8;&#x53EF;&#x80FD;&#x5DF2;&#x7ECF;&#x53D1;&#x73B0;&#xFF0C;&#x4E0D;&#x7BA1;&#x4F7F;&#x7528;&#x54EA;&#x79CD;&#x5206;&#x7C7B;&#x7B97;&#x6CD5;&#x6765;&#x8FDB;&#x884C;&#x624B;&#x5199;&#x6570;&#x5B57;&#x8BC6;&#x522B;&#xFF0C;&#x4E0D;&#x540C;&#x7684;&#x53EA;&#x662F;&#x521B;&#x5EFA;&#x7684;&#x7B97;&#x6CD5;&#x5BF9;&#x8C61;&#x4E0D;&#x4E00;&#x6837;&#x800C;&#x5DF2;&#x3002;&#x6709;&#x4E86;&#x7B97;&#x6CD5;&#x5BF9;&#x8C61;&#x540E;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;<code>fit</code>&#xFF0C;<code>predict</code>&#x5927;&#x6CD5;&#x4E86;&#x3002;</p>
<p>&#x4E0B;&#x9762;&#x662F;&#x4F7F;&#x7528;&#x968F;&#x673A;&#x68EE;&#x6797;&#x8BC6;&#x522B;&#x624B;&#x5199;&#x6570;&#x5B57;&#x7684;&#x5B8C;&#x6574;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> sklearn <span class="hljs-keyword">import</span> datasets
<span class="hljs-comment"># &#x7531;&#x4E8E;&#x662F;&#x5206;&#x7C7B;&#x95EE;&#x9898;&#xFF0C;&#x6240;&#x4EE5;&#x5BFC;&#x5165;&#x7684;&#x662F;RandomForestClassifier</span>
<span class="hljs-keyword">from</span> sklearn.ensemble <span class="hljs-keyword">import</span> RandomForestClassifier
<span class="hljs-comment"># &#x5BFC;&#x5165;&#x8BA1;&#x7B97;&#x51C6;&#x786E;&#x7387;&#x7684;&#x63A5;&#x53E3;</span>
<span class="hljs-keyword">from</span> sklearn.metrics <span class="hljs-keyword">import</span> accuracy_score
<span class="hljs-comment"># &#x52A0;&#x8F7D;&#x624B;&#x5199;&#x6570;&#x5B57;&#x6570;&#x636E;&#x96C6;</span>
digits = datasets.load_digits()
<span class="hljs-comment"># X&#x8868;&#x793A;&#x7279;&#x5F81;&#xFF0C;&#x5373;1797&#x884C;64&#x5217;&#x7684;&#x77E9;&#x9635;</span>
X = digits.data
<span class="hljs-comment"># Y&#x8868;&#x793A;&#x6807;&#x7B7E;&#xFF0C;&#x5373;1797&#x4E2A;&#x5143;&#x7D20;&#x7684;&#x4E00;&#x7EF4;&#x6570;&#x7EC4;</span>
y = digits.target
<span class="hljs-comment"># &#x5C06;X&#xFF0C;y&#x5212;&#x5206;&#x6210;&#x8BAD;&#x7EC3;&#x96C6;&#x548C;&#x6D4B;&#x8BD5;&#x96C6;&#xFF0C;&#x5176;&#x4E2D;&#x8BAD;&#x7EC3;&#x96C6;&#x7684;&#x6BD4;&#x4F8B;&#x4E3A;80%&#xFF0C;&#x6D4B;&#x8BD5;&#x96C6;&#x7684;&#x6BD4;&#x4F8B;&#x4E3A;20%</span>
<span class="hljs-comment"># X_train&#x8868;&#x793A;&#x8BAD;&#x7EC3;&#x96C6;&#x7684;&#x7279;&#x5F81;&#xFF0C;X_test&#x8868;&#x793A;&#x6D4B;&#x8BD5;&#x96C6;&#x7684;&#x7279;&#x5F81;&#xFF0C;y_train&#x8868;&#x793A;&#x8BAD;&#x7EC3;&#x96C6;&#x7684;&#x6807;&#x7B7E;&#xFF0C;y_test&#x8868;&#x793A;&#x6D4B;&#x8BD5;&#x96C6;&#x7684;&#x6807;&#x7B7E;</span>
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=<span class="hljs-number">0.2</span>)
<span class="hljs-comment"># &#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x6709;50&#x68F5;&#x51B3;&#x7B56;&#x6811;&#x7684;&#x968F;&#x673A;&#x68EE;&#x6797;, n_estimators&#x8868;&#x793A;&#x51B3;&#x7B56;&#x6811;&#x7684;&#x6570;&#x91CF;</span>
clf = RandomForestClassifier(n_estimators=<span class="hljs-number">50</span>)
<span class="hljs-comment"># &#x7528;&#x8BAD;&#x7EC3;&#x96C6;&#x8BAD;&#x7EC3;</span>
clf.fit(X_train, Y_train)
<span class="hljs-comment"># &#x7528;&#x6D4B;&#x8BD5;&#x96C6;&#x6D4B;&#x8BD5;&#xFF0C;result&#x4E3A;&#x9884;&#x6D4B;&#x7ED3;&#x679C;</span>
result = clf.predict(X_test)
<span class="hljs-comment"># &#x8BA1;&#x7B97;&#x9884;&#x6D4B;&#x51C6;&#x786E;&#x7387;</span>
acc = accuracy_score(y_test, result)
<span class="hljs-comment"># &#x6253;&#x5370;&#x51C6;&#x786E;&#x7387;</span>
print(acc)
</code></pre>
<h2 id="&#x66F4;&#x597D;&#x5730;&#x9A8C;&#x8BC1;&#x7B97;&#x6CD5;&#x6027;&#x80FD;">&#x66F4;&#x597D;&#x5730;&#x9A8C;&#x8BC1;&#x7B97;&#x6CD5;&#x6027;&#x80FD;</h2>
<p>&#x5728;&#x5212;&#x5206;&#x8BAD;&#x7EC3;&#x96C6;&#x4E0E;&#x6D4B;&#x8BD5;&#x96C6;&#x65F6;&#x4F1A;&#x6709;&#x8FD9;&#x6837;&#x7684;&#x60C5;&#x51B5;&#xFF0C;&#x53EF;&#x80FD;&#x6A21;&#x578B;&#x5BF9;&#x4E8E;&#x6570;&#x5B57; 1 &#x7684;&#x8BC6;&#x522B;&#x51C6;&#x786E;&#x7387;&#x6BD4;&#x8F83;&#x4F4E; &#xFF0C;&#x800C;&#x6D4B;&#x8BD5;&#x96C6;&#x4E2D;&#x6CA1;&#x591A;&#x5C11;&#x4E2A;&#x6570;&#x5B57;&#x4E3A; 1 &#x7684;&#x6837;&#x672C;&#xFF0C;&#x7136;&#x540E;&#x7528;&#x6D4B;&#x8BD5;&#x96C6;&#x6D4B;&#x8BD5;&#x5B8C;&#x540E;&#x5F97;&#x5230;&#x7684;&#x51C6;&#x786E;&#x7387;&#x4E3A; 0.96 &#x3002;&#x7136;&#x540E;&#x60A8;&#x53EF;&#x80FD;&#x89C9;&#x5F97;&#x54CE;&#x5440;&#xFF0C;&#x6211;&#x7684;&#x6A21;&#x578B;&#x5F88;&#x5389;&#x5BB3;&#x4E86;&#xFF0C;&#x4F46;&#x5176;&#x5B9E;&#x5E76;&#x4E0D;&#x7136;&#xFF0C;&#x56E0;&#x4E3A;&#x8FD9;&#x6837;&#x7684;&#x6D4B;&#x8BD5;&#x96C6;&#x8BA9;&#x60A8;&#x7684;&#x6A21;&#x578B;&#x7684;&#x6027;&#x80FD;&#x6709;&#x4E86;&#x8BEF;&#x89E3;&#x3002;&#x90A3;&#x6709;&#x6CA1;&#x6709;&#x66F4;&#x52A0;&#x516C;&#x6B63;&#x7684;&#x9A8C;&#x8BC1;&#x7B97;&#x6CD5;&#x6027;&#x80FD;&#x7684;&#x65B9;&#x6CD5;&#x5462;&#xFF1F;&#x6709;&#xFF0C;&#x90A3;&#x5C31;&#x662F;<strong>k-&#x6298;&#x9A8C;&#x8BC1;</strong>&#xFF01;</p>
<p><strong>k-&#x6298;&#x9A8C;&#x8BC1;</strong>&#x7684;&#x5927;&#x4F53;&#x601D;&#x8DEF;&#x662F;&#x5C06;&#x6574;&#x4E2A;&#x6570;&#x636E;&#x96C6;&#x5206;&#x6210; k &#x4EFD;&#xFF0C;&#x7136;&#x540E;&#x8BD5;&#x56FE;&#x8BA9;&#x6BCF;&#x4E00;&#x4EFD;&#x5B50;&#x96C6;&#x90FD;&#x80FD;&#x6210;&#x4E3A;&#x6D4B;&#x8BD5;&#x96C6;&#xFF0C;&#x5E76;&#x5FAA;&#x73AF; k &#x6B21;&#xFF0C;&#x603B;&#x540E;&#x8BA1;&#x7B97; k &#x6B21;&#x6A21;&#x578B;&#x7684;&#x6027;&#x80FD;&#x7684;&#x5E73;&#x5747;&#x503C;&#x4F5C;&#x4E3A;&#x6027;&#x80FD;&#x7684;&#x4F30;&#x8BA1;&#x3002;&#x4E00;&#x822C;&#x6765;&#x8BF4; k &#x7684;&#x503C;&#x4E3A; 5 &#x6216;&#x8005; 10&#x3002;</p>
<p><strong>k-&#x6298;&#x9A8C;&#x8BC1;</strong>&#x7684;&#x6D41;&#x7A0B;&#x5982;&#x4E0B;&#xFF1A;</p>
<ol>
<li>&#x4E0D;&#x91CD;&#x590D;&#x62BD;&#x6837;&#x5C06;&#x6574;&#x4E2A;&#x6570;&#x636E;&#x96C6;&#x968F;&#x673A;&#x62C6;&#x5206;&#x6210; k &#x4EFD;</li>
<li>&#x6BCF;&#x4E00;&#x6B21;&#x6311;&#x9009;&#x5176;&#x4E2D; 1 &#x4EFD;&#x4F5C;&#x4E3A;&#x6D4B;&#x8BD5;&#x96C6;&#xFF0C;&#x5269;&#x4E0B;&#x7684; k-1 &#x4EFD;&#x4F5C;&#x4E3A;&#x8BAD;&#x7EC3;&#x96C6;
2.1. &#x5728;&#x6BCF;&#x4E2A;&#x8BAD;&#x7EC3;&#x96C6;&#x4E0A;&#x8BAD;&#x7EC3;&#x540E;&#x5F97;&#x5230;&#x4E00;&#x4E2A;&#x6A21;&#x578B;
2.2. &#x7528;&#x8FD9;&#x4E2A;&#x6A21;&#x578B;&#x5728;&#x76F8;&#x5E94;&#x7684;&#x6D4B;&#x8BD5;&#x96C6;&#x4E0A;&#x6D4B;&#x8BD5;&#xFF0C;&#x8BA1;&#x7B97;&#x5E76;&#x4FDD;&#x5B58;&#x6A21;&#x578B;&#x7684;&#x8BC4;&#x4F30;&#x6307;&#x6807;</li>
<li>&#x91CD;&#x590D;&#x7B2C; 2 &#x6B65; k &#x6B21;&#xFF0C;&#x8FD9;&#x6837;&#x6BCF;&#x4EFD;&#x90FD;&#x6709;&#x4E00;&#x6B21;&#x673A;&#x4F1A;&#x4F5C;&#x4E3A;&#x6D4B;&#x8BD5;&#x96C6;&#xFF0C;&#x5176;&#x4ED6;&#x673A;&#x4F1A;&#x4F5C;&#x4E3A;&#x8BAD;&#x7EC3;&#x96C6;</li>
<li>&#x8BA1;&#x7B97; k &#x7EC4;&#x6D4B;&#x8BD5;&#x7ED3;&#x679C;&#x7684;&#x5E73;&#x5747;&#x503C;&#x4F5C;&#x4E3A;&#x7B97;&#x6CD5;&#x6027;&#x80FD;&#x7684;&#x4F30;&#x8BA1;&#x3002;</li>
</ol>
<p>sklearn &#x4E3A;&#x6211;&#x4EEC;&#x63D0;&#x4F9B;&#x4E86;&#x5C06;&#x6570;&#x636E;&#x5212;&#x5206;&#x6210; k &#x4EFD;&#x7C7B; KFold &#xFF0C;&#x4F7F;&#x7528;&#x793A;&#x4F8B;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># &#x5BFC;&#x5165;KFold</span>
<span class="hljs-keyword">from</span> sklearn.model_selection <span class="hljs-keyword">import</span> KFold
<span class="hljs-keyword">from</span> sklearn.ensemble <span class="hljs-keyword">import</span> RandomForestClassifier
<span class="hljs-keyword">from</span> sklearn.metrics <span class="hljs-keyword">import</span> accuracy_score
<span class="hljs-comment"># &#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x5C06;&#x6570;&#x636E;&#x96C6;&#x968F;&#x673A;&#x5212;&#x5206;&#x6210;5&#x4EFD;</span>
kf = KFold(n_splits = <span class="hljs-number">5</span>)
mean_acc = <span class="hljs-number">0</span>
<span class="hljs-comment"># &#x5C06;&#x6574;&#x4E2A;&#x6570;&#x636E;&#x96C6;&#x5212;&#x5206;&#x6210;5&#x4EFD;</span>
<span class="hljs-comment"># train_index&#x8868;&#x793A;&#x4ECE;5&#x4EFD;&#x4E2D;&#x6311;&#x51FA;&#x6765;4&#x4EFD;&#x6240;&#x62FC;&#x51FA;&#x6765;&#x7684;&#x8BAD;&#x7EC3;&#x96C6;&#x7684;&#x7D22;&#x5F15;</span>
<span class="hljs-comment"># test_index&#x8868;&#x793A;&#x5269;&#x4E0B;&#x7684;&#x4E00;&#x4EFD;&#x4F5C;&#x4E3A;&#x6D4B;&#x8BD5;&#x96C6;&#x7684;&#x7D22;&#x5F15;</span>
<span class="hljs-keyword">for</span> train_index, test_index <span class="hljs-keyword">in</span> kf.split(X):
X_train, y_train = X[train_index], y[train_index]
X_test, y_test = X[test_index], y[test_index]
rf = RandomForestClassifier()
rf.fit(X_train, y_train)
result = rf.predict(X_test)
mean_acc = accuracy_score(y_test, result)
<span class="hljs-comment"># &#x6253;&#x5370;5&#x6298;&#x9A8C;&#x8BC1;&#x7684;&#x5E73;&#x5747;&#x51C6;&#x786E;&#x7387;</span>
print(mean_acc/<span class="hljs-number">5</span>)
</code></pre>
<p>&#x5B8C;&#x6574;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> sklearn <span class="hljs-keyword">import</span> datasets
<span class="hljs-comment"># &#x7531;&#x4E8E;&#x662F;&#x5206;&#x7C7B;&#x95EE;&#x9898;&#xFF0C;&#x6240;&#x4EE5;&#x5BFC;&#x5165;&#x7684;&#x662F;RandomForestClassifier</span>
<span class="hljs-keyword">from</span> sklearn.ensemble <span class="hljs-keyword">import</span> RandomForestClassifier
<span class="hljs-comment"># &#x5BFC;&#x5165;&#x8BA1;&#x7B97;&#x51C6;&#x786E;&#x7387;&#x7684;&#x63A5;&#x53E3;</span>
<span class="hljs-keyword">from</span> sklearn.metrics <span class="hljs-keyword">import</span> accuracy_score
<span class="hljs-keyword">from</span> sklearn.model_selection <span class="hljs-keyword">import</span> KFold
<span class="hljs-comment"># &#x52A0;&#x8F7D;&#x624B;&#x5199;&#x6570;&#x5B57;&#x6570;&#x636E;&#x96C6;</span>
digits = datasets.load_digits()
<span class="hljs-comment"># X&#x8868;&#x793A;&#x7279;&#x5F81;&#xFF0C;&#x5373;1797&#x884C;64&#x5217;&#x7684;&#x77E9;&#x9635;</span>
X = digits.data
<span class="hljs-comment"># Y&#x8868;&#x793A;&#x6807;&#x7B7E;&#xFF0C;&#x5373;1797&#x4E2A;&#x5143;&#x7D20;&#x7684;&#x4E00;&#x7EF4;&#x6570;&#x7EC4;</span>
y = digits.target
<span class="hljs-comment"># &#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x5C06;&#x6570;&#x636E;&#x96C6;&#x968F;&#x673A;&#x5212;&#x5206;&#x6210;5&#x4EFD;</span>
kf = KFold(n_splits = <span class="hljs-number">5</span>)
mean_acc = <span class="hljs-number">0</span>
<span class="hljs-comment"># &#x5C06;&#x6574;&#x4E2A;&#x6570;&#x636E;&#x96C6;&#x5212;&#x5206;&#x6210;5&#x4EFD;</span>
<span class="hljs-comment"># train_index&#x8868;&#x793A;&#x4ECE;5&#x4EFD;&#x4E2D;&#x6311;&#x51FA;&#x6765;4&#x4EFD;&#x6240;&#x62FC;&#x51FA;&#x6765;&#x7684;&#x8BAD;&#x7EC3;&#x96C6;&#x7684;&#x7D22;&#x5F15;</span>
<span class="hljs-comment"># test_index&#x8868;&#x793A;&#x5269;&#x4E0B;&#x7684;&#x4E00;&#x4EFD;&#x4F5C;&#x4E3A;&#x6D4B;&#x8BD5;&#x96C6;&#x7684;&#x7D22;&#x5F15;</span>
<span class="hljs-keyword">for</span> train_index, test_index <span class="hljs-keyword">in</span> kf.split(X):
X_train, y_train = X[train_index], y[train_index]
X_test, y_test = X[test_index], y[test_index]
rf = RandomForestClassifier()
rf.fit(X_train, y_train)
result = rf.predict(X_test)
mean_acc = accuracy_score(y_test, result)
<span class="hljs-comment"># &#x6253;&#x5370;5&#x6298;&#x9A8C;&#x8BC1;&#x7684;&#x5E73;&#x5747;&#x51C6;&#x786E;&#x7387;</span>
print(mean_acc/<span class="hljs-number">5</span>)
</code></pre>
</section>
</div>
<div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
</div>
<a href="cluster_metrics.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: 聚类性能评估指标">
<i class="fa fa-angle-left"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
5 years ago
gitbook.page.hasChanged({"page":{"title":"使用sklearn进行机器学习","level":"1.5","depth":1,"next":{"title":"综合实战案例","level":"1.6","depth":1,"ref":"","articles":[{"title":"泰坦尼克生还预测","level":"1.6.1","depth":2,"ref":"","articles":[{"title":"简介","level":"1.6.1.1","depth":3,"path":"titanic/introduction.md","ref":"./titanic/introduction.md","articles":[]},{"title":"探索性数据分析(EDA)","level":"1.6.1.2","depth":3,"path":"titanic/EDA.md","ref":"./titanic/EDA.md","articles":[]},{"title":"特征工程","level":"1.6.1.3","depth":3,"path":"titanic/feature engerning.md","ref":"./titanic/feature engerning.md","articles":[]},{"title":"构建模型进行预测","level":"1.6.1.4","depth":3,"path":"titanic/fit and predict.md","ref":"./titanic/fit and predict.md","articles":[]},{"title":"调参","level":"1.6.1.5","depth":3,"path":"titanic/tuning.md","ref":"./titanic/tuning.md","articles":[]}]},{"title":"使用强化学习玩乒乓球游戏","level":"1.6.2","depth":2,"ref":"","articles":[{"title":"什么是强化学习","level":"1.6.2.1","depth":3,"path":"pingpong/what is reinforce learning.md","ref":"./pingpong/what is reinforce learning.md","articles":[]},{"title":"Policy Gradient原理","level":"1.6.2.2","depth":3,"path":"pingpong/Policy Gradient.md","ref":"./pingpong/Policy Gradient.md","articles":[]},{"title":"使用Policy Gradient玩乒乓球游戏","level":"1.6.2.3","depth":3,"path":"pingpong/coding.md","ref":"./pingpong/coding.md","articles":[]}]}]},"previous":{"title":"聚类性能评估指标","level":"1.4.3","depth":2,"path":"cluster_metrics.md","ref":"cluster_metrics.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["katex"],"pluginsConfig":{"katex":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"sklearn.md","mtime":"2019-07-04T06:39:44.002Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-07-06T07:31:21.537Z"},"basePath":".","book":{"language":""}});
5 years ago
});
</script>
</div>
<script src="gitbook/gitbook.js"></script>
<script src="gitbook/theme.js"></script>
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
<script src="gitbook/gitbook-plugin-search/search.js"></script>
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
</body>
</html>