├── Machine Learning in R
├── plots
│ ├── plot1.png
│ ├── plot2.png
│ ├── plot3.png
│ ├── plot4.png
│ ├── plot5.png
│ ├── plot6.png
│ ├── plot7.png
│ └── plot8.png
└── machine_learning.Rmd
├── Scikit-Learn Tutorial Python Machine Learning
└── Traditional Chinese Translation
│ └── scikit-learn-tutorial-TC_files
│ ├── bootstrap-3.3.5
│ ├── css
│ │ ├── fonts
│ │ │ ├── Lato.ttf
│ │ │ ├── Raleway.ttf
│ │ │ ├── Roboto.ttf
│ │ │ ├── Ubuntu.ttf
│ │ │ ├── LatoBold.ttf
│ │ │ ├── LatoItalic.ttf
│ │ │ ├── NewsCycle.ttf
│ │ │ ├── OpenSans.ttf
│ │ │ ├── RobotoBold.ttf
│ │ │ ├── OpenSansBold.ttf
│ │ │ ├── RalewayBold.ttf
│ │ │ ├── RobotoLight.ttf
│ │ │ ├── RobotoMedium.ttf
│ │ │ ├── NewsCycleBold.ttf
│ │ │ ├── OpenSansItalic.ttf
│ │ │ ├── OpenSansLight.ttf
│ │ │ ├── SourceSansPro.ttf
│ │ │ ├── SourceSansProBold.ttf
│ │ │ ├── OpenSansBoldItalic.ttf
│ │ │ ├── OpenSansLightItalic.ttf
│ │ │ ├── SourceSansProItalic.ttf
│ │ │ └── SourceSansProLight.ttf
│ │ ├── bootstrap-theme.min.css
│ │ ├── bootstrap-theme.css
│ │ └── bootstrap-theme.css.map
│ ├── fonts
│ │ ├── glyphicons-halflings-regular.eot
│ │ ├── glyphicons-halflings-regular.ttf
│ │ ├── glyphicons-halflings-regular.woff
│ │ └── glyphicons-halflings-regular.woff2
│ ├── js
│ │ ├── npm.js
│ │ └── bootstrap.min.js
│ └── shim
│ │ ├── html5shiv.min.js
│ │ └── respond.min.js
│ ├── navigation-1.1
│ ├── sourceembed.js
│ ├── codefolding.js
│ ├── tabsets.js
│ └── FileSaver.min.js
│ └── highlightjs-1.1
│ ├── default.css
│ ├── textmate.css
│ └── highlight.js
├── LICENSE
└── README.md
/Machine Learning in R/plots/plot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Machine Learning in R/plots/plot1.png
--------------------------------------------------------------------------------
/Machine Learning in R/plots/plot2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Machine Learning in R/plots/plot2.png
--------------------------------------------------------------------------------
/Machine Learning in R/plots/plot3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Machine Learning in R/plots/plot3.png
--------------------------------------------------------------------------------
/Machine Learning in R/plots/plot4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Machine Learning in R/plots/plot4.png
--------------------------------------------------------------------------------
/Machine Learning in R/plots/plot5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Machine Learning in R/plots/plot5.png
--------------------------------------------------------------------------------
/Machine Learning in R/plots/plot6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Machine Learning in R/plots/plot6.png
--------------------------------------------------------------------------------
/Machine Learning in R/plots/plot7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Machine Learning in R/plots/plot7.png
--------------------------------------------------------------------------------
/Machine Learning in R/plots/plot8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Machine Learning in R/plots/plot8.png
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/Lato.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/Lato.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/Raleway.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/Raleway.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/Roboto.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/Roboto.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/Ubuntu.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/Ubuntu.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/LatoBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/LatoBold.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/LatoItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/LatoItalic.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/NewsCycle.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/NewsCycle.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/OpenSans.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/OpenSans.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/RobotoBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/RobotoBold.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/OpenSansBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/OpenSansBold.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/RalewayBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/RalewayBold.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/RobotoLight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/RobotoLight.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/RobotoMedium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/RobotoMedium.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/NewsCycleBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/NewsCycleBold.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/OpenSansItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/OpenSansItalic.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/OpenSansLight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/OpenSansLight.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/SourceSansPro.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/SourceSansPro.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/SourceSansProBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/SourceSansProBold.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/OpenSansBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/OpenSansBoldItalic.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/OpenSansLightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/OpenSansLightItalic.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/SourceSansProItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/SourceSansProItalic.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/SourceSansProLight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/fonts/SourceSansProLight.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datacamp/datacamp-community-tutorials/master/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/navigation-1.1/sourceembed.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | window.initializeSourceEmbed = function(filename) {
4 | $("#rmd-download-source").click(function() {
5 | var src = window.atob($("#rmd-source-code").html());
6 | var blob = new Blob([src], {type: "text/x-r-markdown"});
7 | saveAs(blob, filename);
8 | });
9 | };
10 |
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/highlightjs-1.1/default.css:
--------------------------------------------------------------------------------
1 | pre .operator,
2 | pre .paren {
3 | color: rgb(104, 118, 135)
4 | }
5 |
6 | pre .literal {
7 | color: #990073
8 | }
9 |
10 | pre .number {
11 | color: #099;
12 | }
13 |
14 | pre .comment {
15 | color: #998;
16 | font-style: italic
17 | }
18 |
19 | pre .keyword {
20 | color: #900;
21 | font-weight: bold
22 | }
23 |
24 | pre .identifier {
25 | color: rgb(0, 0, 0);
26 | }
27 |
28 | pre .string {
29 | color: #d14;
30 | }
31 |
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/highlightjs-1.1/textmate.css:
--------------------------------------------------------------------------------
1 | pre .operator,
2 | pre .paren {
3 | color: rgb(104, 118, 135)
4 | }
5 |
6 | pre .literal {
7 | color: rgb(88, 72, 246)
8 | }
9 |
10 | pre .number {
11 | color: rgb(0, 0, 205);
12 | }
13 |
14 | pre .comment {
15 | color: rgb(76, 136, 107);
16 | }
17 |
18 | pre .keyword {
19 | color: rgb(0, 0, 255);
20 | }
21 |
22 | pre .identifier {
23 | color: rgb(0, 0, 0);
24 | }
25 |
26 | pre .string {
27 | color: rgb(3, 106, 7);
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/js/npm.js:
--------------------------------------------------------------------------------
1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
2 | require('../../js/transition.js')
3 | require('../../js/alert.js')
4 | require('../../js/button.js')
5 | require('../../js/carousel.js')
6 | require('../../js/collapse.js')
7 | require('../../js/dropdown.js')
8 | require('../../js/modal.js')
9 | require('../../js/tooltip.js')
10 | require('../../js/popover.js')
11 | require('../../js/scrollspy.js')
12 | require('../../js/tab.js')
13 | require('../../js/affix.js')
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 DataCamp
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/navigation-1.1/codefolding.js:
--------------------------------------------------------------------------------
1 |
2 | window.initializeCodeFolding = function(show) {
3 |
4 | // handlers for show-all and hide all
5 | $("#rmd-show-all-code").click(function() {
6 | $('div.r-code-collapse').each(function() {
7 | $(this).collapse('show');
8 | });
9 | });
10 | $("#rmd-hide-all-code").click(function() {
11 | $('div.r-code-collapse').each(function() {
12 | $(this).collapse('hide');
13 | });
14 | });
15 |
16 | // index for unique code element ids
17 | var currentIndex = 1;
18 |
19 | // select all R code blocks
20 | var rCodeBlocks = $('pre.r');
21 | rCodeBlocks.each(function() {
22 |
23 | // create a collapsable div to wrap the code in
24 | var div = $('
');
25 | if (show)
26 | div.addClass('in');
27 | var id = 'rcode-643E0F36' + currentIndex++;
28 | div.attr('id', id);
29 | $(this).before(div);
30 | $(this).detach().appendTo(div);
31 |
32 | // add a show code button right above
33 | var showCodeText = $('' + (show ? 'Hide' : 'Code') + '');
34 | var showCodeButton = $('');
35 | showCodeButton.append(showCodeText);
36 | showCodeButton
37 | .attr('data-toggle', 'collapse')
38 | .attr('data-target', '#' + id)
39 | .attr('aria-expanded', show)
40 | .attr('aria-controls', id);
41 |
42 | var buttonRow = $('');
43 | var buttonCol = $('');
44 |
45 | buttonCol.append(showCodeButton);
46 | buttonRow.append(buttonCol);
47 |
48 | div.before(buttonRow);
49 |
50 | // update state of button on show/hide
51 | div.on('hidden.bs.collapse', function () {
52 | showCodeText.text('Code');
53 | });
54 | div.on('show.bs.collapse', function () {
55 | showCodeText.text('Hide');
56 | });
57 | });
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/shim/html5shiv.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
3 | */
4 | // Only run this code in IE 8
5 | if (!!window.navigator.userAgent.match("MSIE 8")) {
6 | !function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.2",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b)}(this,document);
7 | };
8 |
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/navigation-1.1/tabsets.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | window.buildTabsets = function(tocID) {
4 |
5 | // build a tabset from a section div with the .tabset class
6 | function buildTabset(tabset) {
7 |
8 | // check for fade and pills options
9 | var fade = tabset.hasClass("tabset-fade");
10 | var pills = tabset.hasClass("tabset-pills");
11 | var navClass = pills ? "nav-pills" : "nav-tabs";
12 |
13 | // determine the heading level of the tabset and tabs
14 | var match = tabset.attr('class').match(/level(\d) /);
15 | if (match === null)
16 | return;
17 | var tabsetLevel = Number(match[1]);
18 | var tabLevel = tabsetLevel + 1;
19 |
20 | // find all subheadings immediately below
21 | var tabs = tabset.find("div.section.level" + tabLevel);
22 | if (!tabs.length)
23 | return;
24 |
25 | // create tablist and tab-content elements
26 | var tabList = $('
');
27 | $(tabs[0]).before(tabList);
28 | var tabContent = $('');
29 | $(tabs[0]).before(tabContent);
30 |
31 | // build the tabset
32 | var activeTab = 0;
33 | tabs.each(function(i) {
34 |
35 | // get the tab div
36 | var tab = $(tabs[i]);
37 |
38 | // get the id then sanitize it for use with bootstrap tabs
39 | var id = tab.attr('id');
40 |
41 | // see if this is marked as the active tab
42 | if (tab.hasClass('active'))
43 | activeTab = i;
44 |
45 | // remove any table of contents entries associated with
46 | // this ID (since we'll be removing the heading element)
47 | $("div#" + tocID + " li a[href='#" + id + "']").parent().remove();
48 |
49 | // sanitize the id for use with bootstrap tabs
50 | id = id.replace(/[.\/?&!#<>]/g, '').replace(/\s/g, '_');
51 | tab.attr('id', id);
52 |
53 | // get the heading element within it, grab it's text, then remove it
54 | var heading = tab.find('h' + tabLevel + ':first');
55 | var headingText = heading.html();
56 | heading.remove();
57 |
58 | // build and append the tab list item
59 | var a = $('' + headingText + '');
60 | a.attr('href', '#' + id);
61 | a.attr('aria-controls', id);
62 | var li = $('');
63 | li.append(a);
64 | tabList.append(li);
65 |
66 | // set it's attributes
67 | tab.attr('role', 'tabpanel');
68 | tab.addClass('tab-pane');
69 | tab.addClass('tabbed-pane');
70 | if (fade)
71 | tab.addClass('fade');
72 |
73 | // move it into the tab content div
74 | tab.detach().appendTo(tabContent);
75 | });
76 |
77 | // set active tab
78 | $(tabList.children('li')[activeTab]).addClass('active');
79 | var active = $(tabContent.children('div.section')[activeTab]);
80 | active.addClass('active');
81 | if (fade)
82 | active.addClass('in');
83 | }
84 |
85 | // convert section divs with the .tabset class to tabsets
86 | var tabsets = $("div.section.tabset");
87 | tabsets.each(function(i) {
88 | buildTabset($(tabsets[i]));
89 | });
90 | };
91 |
92 |
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/navigation-1.1/FileSaver.min.js:
--------------------------------------------------------------------------------
1 | /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
2 | var saveAs=saveAs||function(e){"use strict";if("undefined"==typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var t=e.document,n=function(){return e.URL||e.webkitURL||e},o=t.createElementNS("http://www.w3.org/1999/xhtml","a"),r="download"in o,i=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},a=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),c=e.webkitRequestFileSystem,f=e.requestFileSystem||c||e.mozRequestFileSystem,u=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},d="application/octet-stream",s=0,l=4e4,v=function(e){var t=function(){"string"==typeof e?n().revokeObjectURL(e):e.remove()};setTimeout(t,l)},p=function(e,t,n){t=[].concat(t);for(var o=t.length;o--;){var r=e["on"+t[o]];if("function"==typeof r)try{r.call(e,n||e)}catch(i){u(i)}}},w=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e},y=function(t,u,l){l||(t=w(t));var y,m,S,h=this,R=t.type,O=!1,g=function(){p(h,"writestart progress write writeend".split(" "))},b=function(){if(m&&a&&"undefined"!=typeof FileReader){var o=new FileReader;return o.onloadend=function(){var e=o.result;m.location.href="data:attachment/file"+e.slice(e.search(/[,;]/)),h.readyState=h.DONE,g()},o.readAsDataURL(t),void(h.readyState=h.INIT)}if((O||!y)&&(y=n().createObjectURL(t)),m)m.location.href=y;else{var r=e.open(y,"_blank");void 0===r&&a&&(e.location.href=y)}h.readyState=h.DONE,g(),v(y)},E=function(e){return function(){return h.readyState!==h.DONE?e.apply(this,arguments):void 0}},N={create:!0,exclusive:!1};return h.readyState=h.INIT,u||(u="download"),r?(y=n().createObjectURL(t),void setTimeout(function(){o.href=y,o.download=u,i(o),g(),v(y),h.readyState=h.DONE})):(e.chrome&&R&&R!==d&&(S=t.slice||t.webkitSlice,t=S.call(t,0,t.size,d),O=!0),c&&"download"!==u&&(u+=".download"),(R===d||c)&&(m=e),f?(s+=t.size,void f(e.TEMPORARY,s,E(function(e){e.root.getDirectory("saved",N,E(function(e){var n=function(){e.getFile(u,N,E(function(e){e.createWriter(E(function(n){n.onwriteend=function(t){m.location.href=e.toURL(),h.readyState=h.DONE,p(h,"writeend",t),v(e)},n.onerror=function(){var e=n.error;e.code!==e.ABORT_ERR&&b()},"writestart progress write abort".split(" ").forEach(function(e){n["on"+e]=h["on"+e]}),n.write(t),h.abort=function(){n.abort(),h.readyState=h.DONE},h.readyState=h.WRITING}),b)}),b)};e.getFile(u,{create:!1},E(function(e){e.remove(),n()}),E(function(e){e.code===e.NOT_FOUND_ERR?n():b()}))}),b)}),b)):void b())},m=y.prototype,S=function(e,t,n){return new y(e,t,n)};return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,n){return n||(e=w(e)),navigator.msSaveOrOpenBlob(e,t||"download")}:(m.abort=function(){var e=this;e.readyState=e.DONE,p(e,"abort")},m.readyState=m.INIT=0,m.WRITING=1,m.DONE=2,m.error=m.onwritestart=m.onprogress=m.onwrite=m.onabort=m.onerror=m.onwriteend=null,S)}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);"undefined"!=typeof module&&module.exports?module.exports.saveAs=saveAs:"undefined"!=typeof define&&null!==define&&null!==define.amd&&define([],function(){return saveAs});
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DataCamp Community
2 |
3 | Files related to articles written for the DataCamp Community.
4 |
5 | ## Machine Learning in R For Beginners
6 | This machine learning tutorial for beginners was first published on the DataCamp Blog on the 25th of March 2015. It was recenlty updated on the DataCamp Community on the 11th of April 2017. You can find the article [here](https://www.datacamp.com/community/tutorials/machine-learning-in-r).
7 |
8 | The file that is included into this repository is the original file that was written in R Markdown. The tutorial is built up around the steps that one needs to go through to elaborate a machine learning project in Python. It departs from one of the most popular data sets for machine learning, namely, the iris data set. After a short data exploration, the tutorial goes on to show how to use R to work with the well-known machine learning algorithm called “KNN” or k-nearest neighbors: you learn how to build up and evaluate your model. The KNN or k-nearest neighbors algorithm is one of the simplest machine learning algorithms and is an example of instance-based learning, where new data are classified based on stored, labeled instances (=supervised learning).
9 | ## Python For Finance Tutorial For Beginners
10 | A tutorial for beginners on how to get started with Python for Finance. This tutorial was published on the DataCamp Community on the 1st of June 2017. You can read the article [here](https://www.datacamp.com/community/tutorials/finance-python-trading).
11 |
12 | The file that is included in this repository is the Jupyter Notebook that contains the code that I used to write the tutorial. The tutorial is meant to give tailored, in-depth and step-by-step information to beginners on the stock market, how to set up your programming environment, and how to get started with Python's popular data manipulation package `pandas` to do some common financial analyses first and then make a simple trading strategy. Afterwards, the article shows how to backtest the strategy with `pandas` as well as `zipline` and Quantopian, and details how you can improve and evaluate your strategy.
13 |
14 | ## Scikit-Learn Tutorial: Python Machine Learning
15 | This scikit-learn tutorial for beginners was published on the DataCamp Community on the 3rd of January.
16 | You can find it [here](https://www.datacamp.com/community/tutorials/machine-learning-python).
17 |
18 | The tutorial was written in R Markdown in combination with [DataCamp Light](https://github.com/datacamp/datacamp-light) and [Pythonwhat](https://github.com/datacamp/pythonwhat). The tutorial is built up around the steps that one needs to go through in order to elaborate a machine learning project with Python. In this case, it departs from one of the built-in data sets in scikit-learn, namely, digits, but the option of downloading the data from the UCI Machine Learning Repository is also discussed. Several models are visualized with `matplotlib` and evaluated with the appropriate scikit-learn modules in this tutorial and pointers for further machine learning/data science projects are also included.
19 |
20 | ## TensorFlow Tutorial For Beginners
21 | A TensorFlow tutorial for beginners, first published on the DataCamp Community on the 13th of July, 2017. Read the full tutorial [here](https://www.datacamp.com/community/tutorials/tensorflow-tutorial).
22 |
23 | The file that is included in this repository is the Jupyter Notebook that contains the code that I used to write the tutorial. The tutorial is meant as a relatively short and step-by-step guide for beginners who want to get started with Deep Learning (DL) with [TensorFlow](tensorflow.org).
24 |
25 | ## Usage
26 | The code in this repository is released under the MIT license. Read more at the Open Source Initiative. All text remains the Intellectual Property of DataCamp. If you wish to reuse, adapt or remix, get in touch with me at karlijn at datacamp com to request permission.
27 |
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/shim/respond.min.js:
--------------------------------------------------------------------------------
1 | /*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl
2 | * Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
3 | * */
4 |
5 | // Only run this code in IE 8
6 | if (!!window.navigator.userAgent.match("MSIE 8")) {
7 | !function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;bli>a:focus,.dropdown-menu>li>a:hover{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{background-color:#2e6da4;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-o-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#f8f8f8));background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075)}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-o-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dbdbdb),to(#e2e2e2));background-image:linear-gradient(to bottom,#dbdbdb 0,#e2e2e2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.075);box-shadow:inset 0 3px 9px rgba(0,0,0,.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-o-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#3c3c3c),to(#222));background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-o-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#080808),to(#0f0f0f));background-image:linear-gradient(to bottom,#080808 0,#0f0f0f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.25);box-shadow:inset 0 3px 9px rgba(0,0,0,.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.navbar-fixed-bottom,.navbar-fixed-top,.navbar-static-top{border-radius:0}@media (max-width:767px){.navbar .navbar-nav .open .dropdown-menu>.active>a,.navbar .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}}.alert{text-shadow:0 1px 0 rgba(255,255,255,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#c8e5bc));background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);background-repeat:repeat-x;border-color:#b2dba1}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#b9def0));background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);background-repeat:repeat-x;border-color:#9acfea}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#f8efc0));background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);background-repeat:repeat-x;border-color:#f5e79e}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-o-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#e7c3c3));background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);background-repeat:repeat-x;border-color:#dca7a7}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#f5f5f5));background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x}.progress-bar{background-image:-webkit-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-o-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#286090));background-image:linear-gradient(to bottom,#337ab7 0,#286090 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);background-repeat:repeat-x}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#449d44));background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);background-repeat:repeat-x}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#31b0d5));background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);background-repeat:repeat-x}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#ec971f));background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);background-repeat:repeat-x}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c9302c));background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);background-repeat:repeat-x}.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{text-shadow:0 -1px 0 #286090;background-image:-webkit-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2b669a));background-image:linear-gradient(to bottom,#337ab7 0,#2b669a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);background-repeat:repeat-x;border-color:#2b669a}.list-group-item.active .badge,.list-group-item.active:focus .badge,.list-group-item.active:hover .badge{text-shadow:none}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#d0e9c6));background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);background-repeat:repeat-x}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#c4e3f3));background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);background-repeat:repeat-x}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#faf2cc));background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);background-repeat:repeat-x}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-o-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#ebcccc));background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);background-repeat:repeat-x}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#e8e8e8),to(#f5f5f5));background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x;border-color:#dcdcdc;-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)}
--------------------------------------------------------------------------------
/Machine Learning in R/machine_learning.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Getting Started With Machine Learning in R"
3 | author: "Karlijn Willems"
4 | output: html_notebook
5 | ---
6 |
7 | # Introducing: Machine Learning
8 |
9 | Machine learning is a branch in computer science that studies the design of algorithms that can learn. Typical machine learning tasks are concept learning, function learning or "predictive modeling", clustering and finding predictive patterns. These tasks are learned through data that were observed through experiences or instructions, for example. Machine learning hopes that including the experience into its tasks will eventually improve the learning. The ultimate goal is to improve the learning in such a way that it becomes automatic, so that humans like ourselves don't need to interfere any more.
10 |
11 | Machine learning has close ties with Knowledge Discovery, Data Mining, Artificial Intelligence and statistics. Typical applications of machine learning can be classified into scientific knowledge discovery and more commercial applications, ranging from the ["Robot Scientist"](https://www.aber.ac.uk/en/cs/research/cb/projects/robotscientist/) to anti-spam filtering and recommender systems.
12 |
13 | This small tutorial is meant to introduce you to the basics of machine learning in R: it will show you how to use R to work with the well-known machine learning algorithm called "KNN" or *k*-nearest neighbors.
14 |
15 | # Using R For *k*-Nearest Neighbors (KNN)
16 |
17 | The KNN or *k*-nearest neighbors algorithm is one of the simplest machine learning algorithms and is an example of instance-based learning, where new data are classified based on stored, labeled instances. More specifically, the distance between the stored data and the new instance is calculated by means of some kind of a similarity measure. This similarity measure is typically expressed by a distance measure such as the Euclidean distance, cosine similarity or the Manhattan distance. In other words, the similarity to the data that was already in the system is calculated for any new data point that you input into the system. Then, you use this similarity value to perform predictive modeling. Predictive modeling is either classification, assigning a label or a class to the new instance, or regression, assigning a value to the new instance. Whether you classify or assign a value to the new instance depends of course on your how you compose your model with KNN.
18 |
19 | The *k*-nearest neighbor algorithm adds to this basic algorithm that after the distance of the new point to all stored data points has been calculated, the distance values are sorted and the *k*-nearest neighbors are determined. The labels of these neighbors are gathered and a majority vote or weighted vote is used for classification or regression purposes. In other words, the higher the score for a certain data point that was already stored, the more likely that the new instance will receive the same classification as that of the neighbor. In the case of regression, the value that will be assigned to the new data point is the mean of its *k* nearest neighbors.
20 |
21 | [Animated PPT]
22 |
23 | ## Step One. Get Your Data
24 |
25 | Machine learning typically starts from observed data. You can take your own data set or browse through other sources to find one.
26 |
27 | ### Built-in Datasets of R
28 |
29 | This tutorial makes use of the Iris data set, which is well-known in the area of machine learning. This dataset is built into R, so you can take a look at this dataset by typing the following into your console:
30 | ```{r, eval = FALSE}
31 | iris
32 | ```
33 |
34 | ### UC Irvine Machine Learning Repository
35 |
36 | If you want to download the data set instead of using the one that is built into R, you can go to the [UC Irvine Machine Learning Repository](http://archive.ics.uci.edu/ml/) and look up the Iris data set.
37 |
38 | **Tip: not only check out the data folder of the Iris data set, but also take a look at the data description page!**
39 |
40 | Then, load in the data set with the following command:
41 | ```{r, eval = FALSE}
42 | iris <- read.csv(url("http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data"), header = FALSE)
43 | ```
44 |
45 | The command reads the .csv or "Comma Separated Value" file from the website. The `header` argument has been put to `FALSE`, which means that the Iris data set from this source does not give you the attribute names of the data.
46 |
47 | Instead of the attribute names, you might see strange column names such as "V1" or "V2". Those are set at random. To simplify the working with the data set, it is a good idea to make one yourself: you can do this through the function `names()`, which gets or sets the names of an object. Concatenate the names of the attributes as you would like them to appear. For the Iris data set, you can use the following R command:
48 | ```{r, eval = FALSE}
49 | names(iris) <- c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", "Species")
50 | ```
51 |
52 | ## Step Two. Know Your Data
53 |
54 | Now that you have loaded the Iris data set into RStudio, you should try to get a thorough understanding of what your data is about. Just looking or reading about your data is certainly not enough to get started!
55 |
56 | ### Initial Overview Of The Data Set
57 |
58 | First, you can already try to get an idea of your data by making some graphs, such as histograms or boxplots. In this case, however, scatter plots can give you a great idea of what you're dealing with: it can be interesting to see how much one variable is affected by another. In other words, you want to see if there is any correlation between two variables.
59 |
60 | You can make scatterplots with the [ggvis package](http://www.rdocumentation.org/packages/ggvis), for example.
61 |
62 | **Note** that you first need to load the `ggvis` package:
63 | ```{r}
64 | library(ggvis)
65 | ```
66 |
67 | ```{r, message = FALSE}
68 | iris %>% ggvis(~Sepal.Length, ~Sepal.Width, fill = ~Species) %>% layer_points()
69 | ```
70 |
71 | You see that there is a high correlation between the sepal length and the sepal width of the Setosa iris flowers, while the correlation is somewhat less high for the Virginica and Versicolor flowers.
72 |
73 | The scatter plot that maps the petal length and the petal width tells a similar story:
74 | ```{r, message = FALSE}
75 | iris %>% ggvis(~Petal.Length, ~Petal.Width, fill = ~Species) %>% layer_points()
76 | ```
77 |
78 | You see that this graph indicates a positive correlation between the petal length and the petal width for all different species that are included into the Iris data set.
79 |
80 | **Tip: are you curious about ggvis, graphs or histograms in particular? Check out our [tutorial on histograms](http://blog.datacamp.com/make-histogram-basic-r/) and/or [our course on ggvis](https://www.datacamp.com/courses/ggvis-data-visualization-r-tutorial).**
81 |
82 | After a general visualized overview of the data, you can also view the data set by entering
83 | ```{r eval=FALSE}
84 | iris
85 | ```
86 |
87 | However, as you will see from the result of this command, this really isn't the best way to inspect your data set thoroughly: the data set takes up a lot of space in the console, which will impede you from forming a clear idea about your data. It is therefore a better idea to inspect the data set by executing
88 | ```{r, eval=FALSE}
89 | head(iris)
90 | ```
91 |
92 | or
93 | ```{r, eval=FALSE}
94 | str(iris)
95 | ```
96 |
97 | **Tip: try both of these commands out to see the difference!**
98 |
99 | **Note** that the last command will help you to clearly distinguish the data type `num` and the three levels of the `Species` attribute, which is a factor. This is very convenient, since many R machine learning classifiers require that the target feature is coded as a factor.
100 |
101 | **Remember**: factor variables represent categorical variables in R. They can thus take on a limited number of different values.
102 |
103 | A quick look at the `Species` attribute through tells you that the division of the species of flowers is 50-50-50:
104 | ```{r, eval=FALSE}
105 | table(iris$Species)
106 | ```
107 |
108 | If you want to check the percentual division of the `Species` attribute, you can ask for a table of proportions:
109 | ```{r, eval=FALSE}
110 | round(prop.table(table(iris$Species)) * 100, digits = 1)
111 | ```
112 |
113 | **Note** that the `round` argument rounds the values of the first argument, `prop.table(table(iris$Species))*100` to the specified number of digitis, which is one digit after the decimal point. You can easily adjust this by changing the value of the `digits` argument.
114 |
115 | ### Profound Understanding Of Your Data
116 |
117 | Let's not remain on this high-level overview of the data! R gives you the opportunity to go more in-depth with the `summary()` function. This will give you the minimum value, first quantile, median, mean, third quantile and maximum value of the data set Iris for numeric data types. For the class variable, the count of factors will be returned:
118 | ```{r, eval=TRUE, message=FALSE}
119 | summary(iris)
120 | ```
121 |
122 | **Tip: you can also refine your summary overview by adding specific attributes to the command that was presented above:**
123 | ```{r, eval=FALSE}
124 | summary(iris[c("Petal.Width", "Sepal.Width")])
125 | ```
126 |
127 | As you can see, the `c()` function is added to the original command: the columns `petal width` and `sepal width` are concatenated and a summary is then asked of just these two columns of the Iris data set.
128 |
129 | ##Step Three. Where To Go Now?
130 |
131 | After you have acquired a good understanding of your data, you have to decide on the use cases that would be relevant for your data set. In other words, you think about what your data set might teach you or what you think you can learn from your data. From there on, you can think about what kind of algorithms you would be able to apply to your data set in order to get the results that you think you can obtain.
132 |
133 | **Tip: keep in mind that the more familiar you are with your data, the easier it will be to assess the use cases for your specific data set. The same also holds for finding the appropriate machine algorithm.**
134 |
135 | For this tutorial, the Iris data set will be used for classification, which is an example of predictive modeling. The last attribute of the data set, `Species`, will be the target variable or the variable that we want to predict in this example.
136 |
137 | **Note** that you can also take one of the numerical classes as the target variable if you want to use KNN to do regression.
138 |
139 | ## Step Four. Prepare Your Workspace
140 |
141 | Many of the algorithms used in machine learning are not incorporated by default into R. You will most probably need to download the packages that you want to use when you want to get started with machine learning.
142 |
143 | **Tip: got an idea of which learning algorithm you may use, but not of which package you want or need? You can find a pretty complete overview of all the packages that are used in R [right here](http://www.rdocumentation.org/domains/MachineLearning).**
144 |
145 | To illustrate the KNN algorithm, this tutorial works with the package `class`. You can type in
146 | ```{r, eval=TRUE}
147 | library(class)
148 | ```
149 |
150 | If you don't have this package yet, you can quickly and easily do so by typing
151 | ```{r, eval=FALSE}
152 | install.packages("")
153 | ```
154 |
155 | **Remember** the nerd tip: if you're not sure if you have this package, you can run the following command to find out!
156 | ```{r, eval=FALSE}
157 | any(grepl("", installed.packages()))
158 | ```
159 |
160 | ## Step Five. Prepare Your Data
161 |
162 | ### Normalization
163 |
164 | As a part of your data preparation, you might need to normalize your data so that its consistent. For this introductory tutorial, just remember that normalization makes it easier for the KNN algorithm to learn. There are two types of normalization:
165 |
166 | * example normalization is the adjustment of each example individually, while
167 | * feature normalization indicates that you adjust each feature in the same way across all examples.
168 |
169 | So when do you need to normalize your dataset? In short: when you suspect that the data is not consistent. You can easily see this when you go through the results of the `summary()` function. Look at the minimum and maximum values of all the (numerical) attributes. If you see that one attribute has a wide range of values, you will need to normalize your dataset, because this means that the distance will be dominated by this feature. For example, if your dataset has just two attributes, X and Y, and X has values that range from 1 to 1000, while Y has values that only go from 1 to 100, then Y's influence on the distance function will usually be overpowered by X's influence. When you normalize, you actually adjust the range of all features, so that distances between variables with larger ranges will not be over-emphasised.
170 |
171 | **Tip: go back to the result of `summary(iris)` and try to figure out if normalization is necessary.**
172 |
173 | The Iris data set doesn't need to be normalized: the `Sepal.Length` attribute has values that go from 4.3 to 7.9 and `Sepal.Width` contains values from 2 to 4.4, while `Petal.Length`'s values range from 1 to 6.9 and `Petal.Width` goes from 0.1 to 2.5. All values of all attributes are contained within the range of 0.1 and 7.9, which you can consider acceptable.
174 |
175 | Nevertheless, it's still a good idea to study normalization and its effect, especially if you're new to machine learning. You can perform feature normalization, for example, by first making your own `normalize` argument:
176 | ```{r, eval=TRUE}
177 | normalize <- function(x) {
178 | num <- x - min(x)
179 | denom <- max(x) - min(x)
180 | return (num/denom)
181 | }
182 | ```
183 |
184 | You can then use this argument in another command, where you put the results of the normalization in a data frame through `as.data.frame()` after the function `lapply()` returns a list of the same length as the data set that you give in. Each element of that list is the result of the application of the `normalize` argument to the data set that served as input:
185 | ```{r, eval=FALSE}
186 | YourNormalizedDataSet <- as.data.frame(lapply(YourDataSet, normalize))
187 | ```
188 |
189 | For the Iris dataset, you would have applied the `normalize` argument on the four numerical attributes of the Iris data set (`Sepal.Length`, `Sepal.Width`, `Petal.Length`, `Petal.Width`) and put the results in a data frame:
190 | ```{r, eval=TRUE}
191 | iris_norm <- as.data.frame(lapply(iris[1:4], normalize))
192 | ```
193 |
194 | **Tip: to more thoroughly illustrate the effect of normalization on the data set, compare the following result to the summary of the Iris data set that was given in step two:**
195 | ```{r, eval=TRUE}
196 | summary(iris_norm)
197 | ```
198 |
199 | ### Training And Test Sets
200 |
201 | In order to assess your model's performance later, you will need to divide the data set into two parts: a training set and a test set. The first is used to train the system, while the second is used to evaluate the learned or trained system. In practice, the division of your data set into a test and a training sets is disjoint: the most common splitting choice is to take 2/3 of your original data set as the training set, while the 1/3 that remains will compose the test set.
202 |
203 | One last look on the data set teaches you that if you performed the division of both sets on the data set as is, you would get a training class with all species of "Setosa" and "Versicolor", but none of "Virginica". The model would therefore classify all unknown instances as either "Setosa" or "Versicolor", as it would not be aware of the presence of a third species of flowers in the data. In short, you would get incorrect predictions for the test set.
204 |
205 | You thus need to make sure that all three classes of species are present in the training model. What's more, the amount of instances of all three species needs to be more or less _equal_ so that you do not favour one or the other class in your predictions.
206 |
207 | To make your training and test sets, you first set a seed. This is a number of R's random number generator. The major advantage of setting a seed is that you can get the same sequence of random numbers whenever you supply the same seed in the random number generator.
208 | ```{r, eval=TRUE}
209 | set.seed(1234)
210 | ```
211 |
212 | Then, you want to make sure that your Iris data set is shuffled and that you have an equal amount of each species in your training and test sets. You use the `sample()` function to take a sample with a size that is set as the number of rows of the Iris data set, or 150. You sample with replacement: you choose from a vector of 2 elements and assign either 1 or 2 to the 150 rows of the Iris data set. The assignment of the elements is subject to probability weights of 0.67 and 0.33.
213 | ```{r, eval=TRUE}
214 | ind <- sample(2, nrow(iris), replace=TRUE, prob=c(0.67, 0.33))
215 | ```
216 |
217 | **Note** that the `replace` argument is set to `TRUE`: this means that you assign a 1 or a 2 to a certain row and then reset the vector of 2 to its original state. This means that, for the next rows in your data set, you can either assign a 1 or a 2, each time again. The probability of choosing a 1 or a 2 should not be proportional to the weights amongst the remaining items, so you specify probability weights.
218 |
219 | **Remember** that you want your training set to be 2/3 of your original data set: that is why you assign "1" with a probability of 0.67 and the "2"s with a probability of 0.33 to the 150 sample rows.
220 |
221 | You can then use the sample that is stored in the variable `ind` to define your training and test sets:
222 | ```{r, eval=TRUE}
223 | iris.training <- iris[ind==1, 1:4]
224 | iris.test <- iris[ind==2, 1:4]
225 | ```
226 |
227 | **Note** that, in addition to the 2/3 and 1/3 proportions specified above, you don't take into account all attributes to form the training and test sets. Specifically, you only take `Sepal.Length`, `Sepal.Width`, `Petal.Length` and `Petal.Width`. This is because you actually want to predict the fifth attribute, `Species`: it is your target variable. However, you do want to include it into the KNN algorithm, otherwise there will never be any prediction for it. You therefore need to store the class labels in factor vectors and divide them over the training and test sets:
228 | ```{r, eval=TRUE}
229 | iris.trainLabels <- iris[ind==1,5]
230 | iris.testLabels <- iris[ind==2, 5]
231 | ```
232 |
233 | ## Step Six. The Actual KNN Model
234 |
235 | ### Building Your Classifier
236 |
237 | After all these preparation steps, you have made sure that all your known (training) data is stored. No actual model or learning was performed up until this moment. Now, you want to find the *k* nearest neighbors of your training set.
238 |
239 | An easy way to do these two steps is by using the `knn()` function, which uses the Euclidian distance measure in order to find the *k*-nearest neighbours to your new, unknown instance. Here, the *k* parameter is one that you set yourself. As mentioned before, new instances are classified by looking at the majority vote or weighted vote. In case of classification, the data point with the highest score wins the battle and the unknown instance receives the label of that winning data point. If there is an equal amount of winners, the classification happens randomly.
240 |
241 | **Note**: the *k* parameter is often an odd number to avoid ties in the voting scores.
242 |
243 | To build your classifier, you need to take the `knn()` function and simply add some arguments to it, just like in this example:
244 | ```{r, eval=TRUE}
245 | iris_pred <- knn(train = iris.training, test = iris.test, cl = iris.trainLabels, k=3)
246 | ```
247 |
248 | You store into `iris_pred` the `knn()` function that takes as arguments the training set, the test set, the train labels and the amount of neighbours you want to find with this algorithm. The result of this function is a factor vector with the predicted classes for each row of the test data.
249 |
250 | **Note** that you don't want to insert the test labels: these will be used to see if your model is good at predicting the actual classes of your instances!
251 |
252 | You can retrieve the result of the `knn()` function by typing in the following command:
253 | ```{r, eval=TRUE}
254 | iris_pred
255 | ```
256 |
257 | The result of this command is the factor vector with the predicted classes for each row of the test data.
258 |
259 | ## Step Seven. Evaluation of Your Model
260 |
261 | An essential next step in machine learning is the evaluation of your model's performance. In other words, you want to analyze the degree of correctness of the model's predictions. For a more abstract view, you can just compare the results of `iris_pred` to the test labels that you had defined earlier:
262 | ```{r, eval=TRUE, message=FALSE, echo=FALSE}
263 | irisTestLabels <- data.frame(iris.testLabels)
264 | merge <- data.frame(iris_pred, iris.testLabels)
265 | names(merge) <- c("Predicted Species", "Observed Species")
266 | merge
267 | ```
268 |
269 | You see that the model makes reasonably accurate predictions, with the exception of one wrong classification in row 29, where "Versicolor" was predicted while the test label is "Virginica".
270 |
271 | This is already some indication of your model's performance, but you might want to go even deeper into your analysis. For this purpose, you can import the package `gmodels`:
272 | ```{r, eval=FALSE}
273 | install.packages("package name")
274 | ```
275 |
276 | If you have already installed this package, you can simply enter
277 | ```{r, eval=TRUE}
278 | library(gmodels)
279 | ```
280 |
281 | Then you can make a cross tabulation or a contingency table. This type of table is often used to understand the relationship between two variables. In this case, you want to understand how the classes of your test data, stored in `iris.testLabels` relate to your model that is stored in `iris_pred`:
282 | ```{r, eval=TRUE}
283 | CrossTable(x = iris.testLabels, y = iris_pred, prop.chisq=FALSE)
284 | ```
285 |
286 | **Note** that the last argument `prop.chisq` indicates whether or not the chi-square contribution of each cell is included. The chi-square statistic is the sum of the contributions from each of the individual cells and is used to decide whether the difference between the observed and the expected values is significant.
287 |
288 | From this table, you can derive the number of correct and incorrect predictions: one instance from the testing set was labeled `Versicolor` by the model, while it was actually a flower of species `Virginica`. You can see this in the first row of the "Virginica" species in the `iris.testLabels` column. In all other cases, correct predictions were made. You can conclude that the model's performance is good enough and that you don't need to improve the model!
289 |
290 | # Move On To Big Data
291 |
292 | This tutorial was mainly concerned with performing basic machine learning algorithm KNN with the help of R. The Iris data set that was used was small and overviewable; But you can do so much more! If you have experimented enough with the basics presented in this tutorial and other machine learning algorithms, you might want to find it interesting to go further into R and data analysis. *[DataCamp can help you to take this step ](https://www.datacamp.com/courses )*.
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/bootstrap-3.3.5/css/bootstrap-theme.css:
--------------------------------------------------------------------------------
1 | /*!
2 | * Bootstrap v3.3.5 (http://getbootstrap.com)
3 | * Copyright 2011-2015 Twitter, Inc.
4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 | */
6 | .btn-default,
7 | .btn-primary,
8 | .btn-success,
9 | .btn-info,
10 | .btn-warning,
11 | .btn-danger {
12 | text-shadow: 0 -1px 0 rgba(0, 0, 0, .2);
13 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
14 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
15 | }
16 | .btn-default:active,
17 | .btn-primary:active,
18 | .btn-success:active,
19 | .btn-info:active,
20 | .btn-warning:active,
21 | .btn-danger:active,
22 | .btn-default.active,
23 | .btn-primary.active,
24 | .btn-success.active,
25 | .btn-info.active,
26 | .btn-warning.active,
27 | .btn-danger.active {
28 | -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
29 | box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
30 | }
31 | .btn-default.disabled,
32 | .btn-primary.disabled,
33 | .btn-success.disabled,
34 | .btn-info.disabled,
35 | .btn-warning.disabled,
36 | .btn-danger.disabled,
37 | .btn-default[disabled],
38 | .btn-primary[disabled],
39 | .btn-success[disabled],
40 | .btn-info[disabled],
41 | .btn-warning[disabled],
42 | .btn-danger[disabled],
43 | fieldset[disabled] .btn-default,
44 | fieldset[disabled] .btn-primary,
45 | fieldset[disabled] .btn-success,
46 | fieldset[disabled] .btn-info,
47 | fieldset[disabled] .btn-warning,
48 | fieldset[disabled] .btn-danger {
49 | -webkit-box-shadow: none;
50 | box-shadow: none;
51 | }
52 | .btn-default .badge,
53 | .btn-primary .badge,
54 | .btn-success .badge,
55 | .btn-info .badge,
56 | .btn-warning .badge,
57 | .btn-danger .badge {
58 | text-shadow: none;
59 | }
60 | .btn:active,
61 | .btn.active {
62 | background-image: none;
63 | }
64 | .btn-default {
65 | text-shadow: 0 1px 0 #fff;
66 | background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%);
67 | background-image: -o-linear-gradient(top, #fff 0%, #e0e0e0 100%);
68 | background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#e0e0e0));
69 | background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%);
70 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);
71 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
72 | background-repeat: repeat-x;
73 | border-color: #dbdbdb;
74 | border-color: #ccc;
75 | }
76 | .btn-default:hover,
77 | .btn-default:focus {
78 | background-color: #e0e0e0;
79 | background-position: 0 -15px;
80 | }
81 | .btn-default:active,
82 | .btn-default.active {
83 | background-color: #e0e0e0;
84 | border-color: #dbdbdb;
85 | }
86 | .btn-default.disabled,
87 | .btn-default[disabled],
88 | fieldset[disabled] .btn-default,
89 | .btn-default.disabled:hover,
90 | .btn-default[disabled]:hover,
91 | fieldset[disabled] .btn-default:hover,
92 | .btn-default.disabled:focus,
93 | .btn-default[disabled]:focus,
94 | fieldset[disabled] .btn-default:focus,
95 | .btn-default.disabled.focus,
96 | .btn-default[disabled].focus,
97 | fieldset[disabled] .btn-default.focus,
98 | .btn-default.disabled:active,
99 | .btn-default[disabled]:active,
100 | fieldset[disabled] .btn-default:active,
101 | .btn-default.disabled.active,
102 | .btn-default[disabled].active,
103 | fieldset[disabled] .btn-default.active {
104 | background-color: #e0e0e0;
105 | background-image: none;
106 | }
107 | .btn-primary {
108 | background-image: -webkit-linear-gradient(top, #337ab7 0%, #265a88 100%);
109 | background-image: -o-linear-gradient(top, #337ab7 0%, #265a88 100%);
110 | background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#265a88));
111 | background-image: linear-gradient(to bottom, #337ab7 0%, #265a88 100%);
112 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);
113 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
114 | background-repeat: repeat-x;
115 | border-color: #245580;
116 | }
117 | .btn-primary:hover,
118 | .btn-primary:focus {
119 | background-color: #265a88;
120 | background-position: 0 -15px;
121 | }
122 | .btn-primary:active,
123 | .btn-primary.active {
124 | background-color: #265a88;
125 | border-color: #245580;
126 | }
127 | .btn-primary.disabled,
128 | .btn-primary[disabled],
129 | fieldset[disabled] .btn-primary,
130 | .btn-primary.disabled:hover,
131 | .btn-primary[disabled]:hover,
132 | fieldset[disabled] .btn-primary:hover,
133 | .btn-primary.disabled:focus,
134 | .btn-primary[disabled]:focus,
135 | fieldset[disabled] .btn-primary:focus,
136 | .btn-primary.disabled.focus,
137 | .btn-primary[disabled].focus,
138 | fieldset[disabled] .btn-primary.focus,
139 | .btn-primary.disabled:active,
140 | .btn-primary[disabled]:active,
141 | fieldset[disabled] .btn-primary:active,
142 | .btn-primary.disabled.active,
143 | .btn-primary[disabled].active,
144 | fieldset[disabled] .btn-primary.active {
145 | background-color: #265a88;
146 | background-image: none;
147 | }
148 | .btn-success {
149 | background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%);
150 | background-image: -o-linear-gradient(top, #5cb85c 0%, #419641 100%);
151 | background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#419641));
152 | background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%);
153 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);
154 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
155 | background-repeat: repeat-x;
156 | border-color: #3e8f3e;
157 | }
158 | .btn-success:hover,
159 | .btn-success:focus {
160 | background-color: #419641;
161 | background-position: 0 -15px;
162 | }
163 | .btn-success:active,
164 | .btn-success.active {
165 | background-color: #419641;
166 | border-color: #3e8f3e;
167 | }
168 | .btn-success.disabled,
169 | .btn-success[disabled],
170 | fieldset[disabled] .btn-success,
171 | .btn-success.disabled:hover,
172 | .btn-success[disabled]:hover,
173 | fieldset[disabled] .btn-success:hover,
174 | .btn-success.disabled:focus,
175 | .btn-success[disabled]:focus,
176 | fieldset[disabled] .btn-success:focus,
177 | .btn-success.disabled.focus,
178 | .btn-success[disabled].focus,
179 | fieldset[disabled] .btn-success.focus,
180 | .btn-success.disabled:active,
181 | .btn-success[disabled]:active,
182 | fieldset[disabled] .btn-success:active,
183 | .btn-success.disabled.active,
184 | .btn-success[disabled].active,
185 | fieldset[disabled] .btn-success.active {
186 | background-color: #419641;
187 | background-image: none;
188 | }
189 | .btn-info {
190 | background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
191 | background-image: -o-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
192 | background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#2aabd2));
193 | background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%);
194 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);
195 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
196 | background-repeat: repeat-x;
197 | border-color: #28a4c9;
198 | }
199 | .btn-info:hover,
200 | .btn-info:focus {
201 | background-color: #2aabd2;
202 | background-position: 0 -15px;
203 | }
204 | .btn-info:active,
205 | .btn-info.active {
206 | background-color: #2aabd2;
207 | border-color: #28a4c9;
208 | }
209 | .btn-info.disabled,
210 | .btn-info[disabled],
211 | fieldset[disabled] .btn-info,
212 | .btn-info.disabled:hover,
213 | .btn-info[disabled]:hover,
214 | fieldset[disabled] .btn-info:hover,
215 | .btn-info.disabled:focus,
216 | .btn-info[disabled]:focus,
217 | fieldset[disabled] .btn-info:focus,
218 | .btn-info.disabled.focus,
219 | .btn-info[disabled].focus,
220 | fieldset[disabled] .btn-info.focus,
221 | .btn-info.disabled:active,
222 | .btn-info[disabled]:active,
223 | fieldset[disabled] .btn-info:active,
224 | .btn-info.disabled.active,
225 | .btn-info[disabled].active,
226 | fieldset[disabled] .btn-info.active {
227 | background-color: #2aabd2;
228 | background-image: none;
229 | }
230 | .btn-warning {
231 | background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
232 | background-image: -o-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
233 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#eb9316));
234 | background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%);
235 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);
236 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
237 | background-repeat: repeat-x;
238 | border-color: #e38d13;
239 | }
240 | .btn-warning:hover,
241 | .btn-warning:focus {
242 | background-color: #eb9316;
243 | background-position: 0 -15px;
244 | }
245 | .btn-warning:active,
246 | .btn-warning.active {
247 | background-color: #eb9316;
248 | border-color: #e38d13;
249 | }
250 | .btn-warning.disabled,
251 | .btn-warning[disabled],
252 | fieldset[disabled] .btn-warning,
253 | .btn-warning.disabled:hover,
254 | .btn-warning[disabled]:hover,
255 | fieldset[disabled] .btn-warning:hover,
256 | .btn-warning.disabled:focus,
257 | .btn-warning[disabled]:focus,
258 | fieldset[disabled] .btn-warning:focus,
259 | .btn-warning.disabled.focus,
260 | .btn-warning[disabled].focus,
261 | fieldset[disabled] .btn-warning.focus,
262 | .btn-warning.disabled:active,
263 | .btn-warning[disabled]:active,
264 | fieldset[disabled] .btn-warning:active,
265 | .btn-warning.disabled.active,
266 | .btn-warning[disabled].active,
267 | fieldset[disabled] .btn-warning.active {
268 | background-color: #eb9316;
269 | background-image: none;
270 | }
271 | .btn-danger {
272 | background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
273 | background-image: -o-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
274 | background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c12e2a));
275 | background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%);
276 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);
277 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
278 | background-repeat: repeat-x;
279 | border-color: #b92c28;
280 | }
281 | .btn-danger:hover,
282 | .btn-danger:focus {
283 | background-color: #c12e2a;
284 | background-position: 0 -15px;
285 | }
286 | .btn-danger:active,
287 | .btn-danger.active {
288 | background-color: #c12e2a;
289 | border-color: #b92c28;
290 | }
291 | .btn-danger.disabled,
292 | .btn-danger[disabled],
293 | fieldset[disabled] .btn-danger,
294 | .btn-danger.disabled:hover,
295 | .btn-danger[disabled]:hover,
296 | fieldset[disabled] .btn-danger:hover,
297 | .btn-danger.disabled:focus,
298 | .btn-danger[disabled]:focus,
299 | fieldset[disabled] .btn-danger:focus,
300 | .btn-danger.disabled.focus,
301 | .btn-danger[disabled].focus,
302 | fieldset[disabled] .btn-danger.focus,
303 | .btn-danger.disabled:active,
304 | .btn-danger[disabled]:active,
305 | fieldset[disabled] .btn-danger:active,
306 | .btn-danger.disabled.active,
307 | .btn-danger[disabled].active,
308 | fieldset[disabled] .btn-danger.active {
309 | background-color: #c12e2a;
310 | background-image: none;
311 | }
312 | .thumbnail,
313 | .img-thumbnail {
314 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
315 | box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
316 | }
317 | .dropdown-menu > li > a:hover,
318 | .dropdown-menu > li > a:focus {
319 | background-color: #e8e8e8;
320 | background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
321 | background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
322 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
323 | background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
324 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
325 | background-repeat: repeat-x;
326 | }
327 | .dropdown-menu > .active > a,
328 | .dropdown-menu > .active > a:hover,
329 | .dropdown-menu > .active > a:focus {
330 | background-color: #2e6da4;
331 | background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
332 | background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
333 | background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
334 | background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
335 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
336 | background-repeat: repeat-x;
337 | }
338 | .navbar-default {
339 | background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%);
340 | background-image: -o-linear-gradient(top, #fff 0%, #f8f8f8 100%);
341 | background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f8f8f8));
342 | background-image: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%);
343 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);
344 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
345 | background-repeat: repeat-x;
346 | border-radius: 4px;
347 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
348 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
349 | }
350 | .navbar-default .navbar-nav > .open > a,
351 | .navbar-default .navbar-nav > .active > a {
352 | background-image: -webkit-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
353 | background-image: -o-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
354 | background-image: -webkit-gradient(linear, left top, left bottom, from(#dbdbdb), to(#e2e2e2));
355 | background-image: linear-gradient(to bottom, #dbdbdb 0%, #e2e2e2 100%);
356 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);
357 | background-repeat: repeat-x;
358 | -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
359 | box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
360 | }
361 | .navbar-brand,
362 | .navbar-nav > li > a {
363 | text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
364 | }
365 | .navbar-inverse {
366 | background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222 100%);
367 | background-image: -o-linear-gradient(top, #3c3c3c 0%, #222 100%);
368 | background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#222));
369 | background-image: linear-gradient(to bottom, #3c3c3c 0%, #222 100%);
370 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);
371 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
372 | background-repeat: repeat-x;
373 | border-radius: 4px;
374 | }
375 | .navbar-inverse .navbar-nav > .open > a,
376 | .navbar-inverse .navbar-nav > .active > a {
377 | background-image: -webkit-linear-gradient(top, #080808 0%, #0f0f0f 100%);
378 | background-image: -o-linear-gradient(top, #080808 0%, #0f0f0f 100%);
379 | background-image: -webkit-gradient(linear, left top, left bottom, from(#080808), to(#0f0f0f));
380 | background-image: linear-gradient(to bottom, #080808 0%, #0f0f0f 100%);
381 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);
382 | background-repeat: repeat-x;
383 | -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
384 | box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
385 | }
386 | .navbar-inverse .navbar-brand,
387 | .navbar-inverse .navbar-nav > li > a {
388 | text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
389 | }
390 | .navbar-static-top,
391 | .navbar-fixed-top,
392 | .navbar-fixed-bottom {
393 | border-radius: 0;
394 | }
395 | @media (max-width: 767px) {
396 | .navbar .navbar-nav .open .dropdown-menu > .active > a,
397 | .navbar .navbar-nav .open .dropdown-menu > .active > a:hover,
398 | .navbar .navbar-nav .open .dropdown-menu > .active > a:focus {
399 | color: #fff;
400 | background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
401 | background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
402 | background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
403 | background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
404 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
405 | background-repeat: repeat-x;
406 | }
407 | }
408 | .alert {
409 | text-shadow: 0 1px 0 rgba(255, 255, 255, .2);
410 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
411 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
412 | }
413 | .alert-success {
414 | background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
415 | background-image: -o-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
416 | background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#c8e5bc));
417 | background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);
418 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
419 | background-repeat: repeat-x;
420 | border-color: #b2dba1;
421 | }
422 | .alert-info {
423 | background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
424 | background-image: -o-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
425 | background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#b9def0));
426 | background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);
427 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
428 | background-repeat: repeat-x;
429 | border-color: #9acfea;
430 | }
431 | .alert-warning {
432 | background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
433 | background-image: -o-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
434 | background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#f8efc0));
435 | background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);
436 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
437 | background-repeat: repeat-x;
438 | border-color: #f5e79e;
439 | }
440 | .alert-danger {
441 | background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
442 | background-image: -o-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
443 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#e7c3c3));
444 | background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);
445 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
446 | background-repeat: repeat-x;
447 | border-color: #dca7a7;
448 | }
449 | .progress {
450 | background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
451 | background-image: -o-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
452 | background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f5f5f5));
453 | background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
454 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
455 | background-repeat: repeat-x;
456 | }
457 | .progress-bar {
458 | background-image: -webkit-linear-gradient(top, #337ab7 0%, #286090 100%);
459 | background-image: -o-linear-gradient(top, #337ab7 0%, #286090 100%);
460 | background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#286090));
461 | background-image: linear-gradient(to bottom, #337ab7 0%, #286090 100%);
462 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);
463 | background-repeat: repeat-x;
464 | }
465 | .progress-bar-success {
466 | background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%);
467 | background-image: -o-linear-gradient(top, #5cb85c 0%, #449d44 100%);
468 | background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#449d44));
469 | background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
470 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
471 | background-repeat: repeat-x;
472 | }
473 | .progress-bar-info {
474 | background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
475 | background-image: -o-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
476 | background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#31b0d5));
477 | background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
478 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
479 | background-repeat: repeat-x;
480 | }
481 | .progress-bar-warning {
482 | background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
483 | background-image: -o-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
484 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#ec971f));
485 | background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
486 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
487 | background-repeat: repeat-x;
488 | }
489 | .progress-bar-danger {
490 | background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%);
491 | background-image: -o-linear-gradient(top, #d9534f 0%, #c9302c 100%);
492 | background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c9302c));
493 | background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
494 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
495 | background-repeat: repeat-x;
496 | }
497 | .progress-bar-striped {
498 | background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
499 | background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
500 | background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
501 | }
502 | .list-group {
503 | border-radius: 4px;
504 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
505 | box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
506 | }
507 | .list-group-item.active,
508 | .list-group-item.active:hover,
509 | .list-group-item.active:focus {
510 | text-shadow: 0 -1px 0 #286090;
511 | background-image: -webkit-linear-gradient(top, #337ab7 0%, #2b669a 100%);
512 | background-image: -o-linear-gradient(top, #337ab7 0%, #2b669a 100%);
513 | background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2b669a));
514 | background-image: linear-gradient(to bottom, #337ab7 0%, #2b669a 100%);
515 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);
516 | background-repeat: repeat-x;
517 | border-color: #2b669a;
518 | }
519 | .list-group-item.active .badge,
520 | .list-group-item.active:hover .badge,
521 | .list-group-item.active:focus .badge {
522 | text-shadow: none;
523 | }
524 | .panel {
525 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
526 | box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
527 | }
528 | .panel-default > .panel-heading {
529 | background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
530 | background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
531 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
532 | background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
533 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
534 | background-repeat: repeat-x;
535 | }
536 | .panel-primary > .panel-heading {
537 | background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
538 | background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
539 | background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
540 | background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
541 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
542 | background-repeat: repeat-x;
543 | }
544 | .panel-success > .panel-heading {
545 | background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
546 | background-image: -o-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
547 | background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#d0e9c6));
548 | background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
549 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
550 | background-repeat: repeat-x;
551 | }
552 | .panel-info > .panel-heading {
553 | background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
554 | background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
555 | background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3));
556 | background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
557 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
558 | background-repeat: repeat-x;
559 | }
560 | .panel-warning > .panel-heading {
561 | background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
562 | background-image: -o-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
563 | background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#faf2cc));
564 | background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
565 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
566 | background-repeat: repeat-x;
567 | }
568 | .panel-danger > .panel-heading {
569 | background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
570 | background-image: -o-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
571 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#ebcccc));
572 | background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
573 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
574 | background-repeat: repeat-x;
575 | }
576 | .well {
577 | background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
578 | background-image: -o-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
579 | background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#f5f5f5));
580 | background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
581 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
582 | background-repeat: repeat-x;
583 | border-color: #dcdcdc;
584 | -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
585 | box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
586 | }
587 | /*# sourceMappingURL=bootstrap-theme.css.map */
588 |
--------------------------------------------------------------------------------
/Scikit-Learn Tutorial Python Machine Learning/Traditional Chinese Translation/scikit-learn-tutorial-TC_files/highlightjs-1.1/highlight.js:
--------------------------------------------------------------------------------
1 | var hljs=new function(){function m(p){return p.replace(/&/gm,"&").replace(/"}while(y.length||w.length){var v=u().splice(0,1)[0];z+=m(x.substr(q,v.offset-q));q=v.offset;if(v.event=="start"){z+=t(v.node);s.push(v.node)}else{if(v.event=="stop"){var p,r=s.length;do{r--;p=s[r];z+=(""+p.nodeName.toLowerCase()+">")}while(p!=v.node);s.splice(r,1);while(r'+M[0]+""}else{r+=M[0]}O=P.lR.lastIndex;M=P.lR.exec(L)}return r+L.substr(O,L.length-O)}function J(L,M){if(M.sL&&e[M.sL]){var r=d(M.sL,L);x+=r.keyword_count;return r.value}else{return F(L,M)}}function I(M,r){var L=M.cN?'':"";if(M.rB){y+=L;M.buffer=""}else{if(M.eB){y+=m(r)+L;M.buffer=""}else{y+=L;M.buffer=r}}D.push(M);A+=M.r}function G(N,M,Q){var R=D[D.length-1];if(Q){y+=J(R.buffer+N,R);return false}var P=q(M,R);if(P){y+=J(R.buffer+N,R);I(P,M);return P.rB}var L=v(D.length-1,M);if(L){var O=R.cN?"":"";if(R.rE){y+=J(R.buffer+N,R)+O}else{if(R.eE){y+=J(R.buffer+N,R)+O+m(M)}else{y+=J(R.buffer+N+M,R)+O}}while(L>1){O=D[D.length-2].cN?"":"";y+=O;L--;D.length--}var r=D[D.length-1];D.length--;D[D.length-1].buffer="";if(r.starts){I(r.starts,"")}return R.rE}if(w(M,R)){throw"Illegal"}}var E=e[B];var D=[E.dM];var A=0;var x=0;var y="";try{var s,u=0;E.dM.buffer="";do{s=p(C,u);var t=G(s[0],s[1],s[2]);u+=s[0].length;if(!t){u+=s[1].length}}while(!s[2]);if(D.length>1){throw"Illegal"}return{r:A,keyword_count:x,value:y}}catch(H){if(H=="Illegal"){return{r:0,keyword_count:0,value:m(C)}}else{throw H}}}function g(t){var p={keyword_count:0,r:0,value:m(t)};var r=p;for(var q in e){if(!e.hasOwnProperty(q)){continue}var s=d(q,t);s.language=q;if(s.keyword_count+s.r>r.keyword_count+r.r){r=s}if(s.keyword_count+s.r>p.keyword_count+p.r){r=p;p=s}}if(r.language){p.second_best=r}return p}function i(r,q,p){if(q){r=r.replace(/^((<[^>]+>|\t)+)/gm,function(t,w,v,u){return w.replace(/\t/g,q)})}if(p){r=r.replace(/\n/g," ")}return r}function n(t,w,r){var x=h(t,r);var v=a(t);var y,s;if(v){y=d(v,x)}else{return}var q=c(t);if(q.length){s=document.createElement("pre");s.innerHTML=y.value;y.value=k(q,c(s),x)}y.value=i(y.value,w,r);var u=t.className;if(!u.match("(\\s|^)(language-)?"+v+"(\\s|$)")){u=u?(u+" "+v):v}if(/MSIE [678]/.test(navigator.userAgent)&&t.tagName=="CODE"&&t.parentNode.tagName=="PRE"){s=t.parentNode;var p=document.createElement("div");p.innerHTML="