├── .gitattributes ├── .gitignore ├── .nojekyll ├── Glossary.pdf ├── LICENSE.md ├── MLtechrep.bib ├── README.md ├── _bookdown.yml ├── _bookdown_files └── introduction-to-machine-learning_files │ ├── figure-html │ ├── featureplot-1.png │ ├── featureplot-1.svg │ ├── ggsenate-1.svg │ ├── knn_lime-1.svg │ ├── knn_lime-2.svg │ ├── knnvarimp-1.svg │ ├── learning_curve-1.svg │ ├── min_depth_plot-1.svg │ ├── min_depth_plot-2.svg │ ├── other_imps_plot-1.svg │ ├── regregvarimp-1.svg │ ├── rf_lime-1.svg │ ├── rf_lime-2.svg │ ├── rf_lime_vis1-1.svg │ ├── rf_lime_vis1_clean-1.svg │ ├── rf_lime_vis2-1.svg │ ├── rf_lime_vis2_clean-1.svg │ ├── rf_pd_plot-1.svg │ ├── rf_pd_plot_true-1.svg │ ├── svm2d-1.svg │ ├── unnamed-chunk-2-1.svg │ └── unnamed-chunk-3-1.svg │ └── figure-html4 │ ├── featureplot-1.svg │ ├── regregvarimp-1.svg │ ├── svm2d-1.svg │ └── unnamed-chunk-2-1.svg ├── _build.sh ├── _deploy.sh ├── _output.yml ├── appendix.Rmd ├── black_box.ipynb ├── blackbox.Rmd ├── by-sa_4.0.txt ├── concepts.Rmd ├── css ├── book.css ├── old │ ├── mytufte.css │ ├── standard_html.css │ └── toc.css └── standard_html.css ├── data ├── Senate_Raw.csv ├── knn_explain.RData ├── results_knn.RData ├── results_nnet.RData ├── results_regreg.RData ├── results_rf.RData ├── results_svm.RData ├── results_xgb.RData ├── rf_explain.RData ├── rf_explainer_min_depth.RData ├── rf_ggrf_min_depth.RData ├── rf_variable_importance.RData ├── senate_graph (Nodes).csv ├── wine.csv ├── winequality-red.csv ├── winequality-white.csv └── winequality.names ├── docs ├── appendix.html ├── blackbox.html ├── concepts.html ├── css │ ├── book.css │ └── standard_html.css ├── img │ ├── 198R.png │ ├── ARC-acronym-signature.png │ ├── ARC_logos │ │ └── ARC-acronym-signature.png │ ├── CSCAR_logos │ │ └── signature-acronym.png │ ├── biasvar2.svg │ ├── biasvar_gp.svg │ ├── biasvartarget.svg │ ├── ccbysa.png │ ├── kfold.svg │ ├── learningcurve.svg │ ├── lossfuncs.png │ ├── lvmodel.png │ ├── mc.png │ ├── mc_logo.png │ ├── min_depth_1.png │ ├── min_depth_2.png │ ├── nineteeneightyR.png │ ├── nnet.png │ ├── senate.png │ ├── signature-acronym.png │ ├── svm3d.png │ ├── tree1.png │ └── tree2.png ├── index.html ├── intro.html ├── introduction-to-machine-learning_files │ └── figure-html │ │ ├── featureplot-1.svg │ │ ├── ggsenate-1.svg │ │ ├── knn_lime-1.svg │ │ ├── knn_lime-2.svg │ │ ├── learning_curve-1.svg │ │ ├── min_depth_plot-1.svg │ │ ├── min_depth_plot-2.svg │ │ ├── other_imps_plot-1.svg │ │ ├── regregvarimp-1.svg │ │ ├── rf_lime-1.svg │ │ ├── rf_lime-2.svg │ │ ├── rf_lime_vis1-1.svg │ │ ├── rf_lime_vis1_clean-1.svg │ │ ├── rf_lime_vis2-1.svg │ │ ├── rf_lime_vis2_clean-1.svg │ │ ├── rf_pd_plot-1.svg │ │ ├── rf_pd_plot_true-1.svg │ │ ├── svm2d-1.svg │ │ ├── unnamed-chunk-2-1.svg │ │ └── unnamed-chunk-3-1.svg ├── introduction.html ├── libs │ ├── DiagrammeR-styles-0.2 │ │ └── styles.css │ ├── crosstalk-1.0.0 │ │ ├── css │ │ │ └── crosstalk.css │ │ └── js │ │ │ └── crosstalk.min.js │ ├── d3-3.5.3 │ │ └── d3.min.js │ ├── d3-tip-0.6.6 │ │ └── index.js │ ├── d3heatmap-binding-0.6.1.1 │ │ └── d3heatmap.js │ ├── d3heatmap-binding-0.6.1.2 │ │ └── d3heatmap.js │ ├── d3heatmapcore-0.0.0 │ │ ├── heatmapcore.css │ │ └── heatmapcore.js │ ├── datatables-binding-0.2 │ │ └── datatables.js │ ├── datatables-binding-0.4 │ │ └── datatables.js │ ├── datatables-css-0.0.0 │ │ └── datatables-crosstalk.css │ ├── dt-core-1.10.12 │ │ ├── css │ │ │ ├── jquery.dataTables.extra.css │ │ │ └── jquery.dataTables.min.css │ │ └── js │ │ │ └── jquery.dataTables.min.js │ ├── dt-core-1.10.16 │ │ ├── css │ │ │ ├── jquery.dataTables.extra.css │ │ │ └── jquery.dataTables.min.css │ │ └── js │ │ │ └── jquery.dataTables.min.js │ ├── gitbook-2.6.7 │ │ ├── css │ │ │ ├── fontawesome │ │ │ │ └── fontawesome-webfont.ttf │ │ │ ├── plugin-bookdown.css │ │ │ ├── plugin-fontsettings.css │ │ │ ├── plugin-highlight.css │ │ │ ├── plugin-search.css │ │ │ ├── plugin-table.css │ │ │ └── style.css │ │ └── js │ │ │ ├── app.min.js │ │ │ ├── jquery.highlight.js │ │ │ ├── lunr.js │ │ │ ├── plugin-bookdown.js │ │ │ ├── plugin-fontsettings.js │ │ │ ├── plugin-search.js │ │ │ └── plugin-sharing.js │ ├── grViz-binding-0.9.2 │ │ └── grViz.js │ ├── grViz-binding-1.0.0 │ │ └── grViz.js │ ├── htmlwidgets-0.9 │ │ └── htmlwidgets.js │ ├── htmlwidgets-1.0 │ │ └── htmlwidgets.js │ ├── htmlwidgets-1.3 │ │ └── htmlwidgets.js │ ├── jquery-2.2.3 │ │ └── jquery.min.js │ ├── plotly-binding-4.7.1 │ │ └── plotly.js │ ├── plotly-binding-4.8.0 │ │ └── plotly.js │ ├── plotly-htmlwidgets-css-1.39.2 │ │ └── plotly-htmlwidgets.css │ ├── plotly-main-1.39.2 │ │ └── plotly-latest.min.js │ ├── plotlyjs-1.29.2 │ │ ├── plotly-htmlwidgets.css │ │ └── plotly-latest.min.js │ ├── typedarray-0.1 │ │ └── typedarray.min.js │ └── viz-0.3 │ │ └── viz.js ├── opening-the-black-box.html ├── other.html ├── preface.html ├── references.html ├── search_index.json └── wrap-up.html ├── img ├── 198R.png ├── 198R_small.png ├── ARC-acronym-signature.png ├── ARC_logos │ ├── ARC-acronym-signature-white.png │ ├── ARC-acronym-signature.png │ ├── signature-informal-white.png │ ├── signature-informal.png │ ├── signature-marketing-white.png │ ├── signature-marketing.png │ ├── signature-stationery-white - large copy.png │ ├── signature-stationery-white.png │ ├── signature-stationery.png │ ├── signature-vertical-white.png │ └── signature-vertical.png ├── CSCAR_logos │ ├── signature-acronym-white.png │ ├── signature-acronym.png │ ├── signature-marketing-white.png │ ├── signature-marketing.png │ ├── signature-social.png │ ├── signature-vertical-informal.png │ ├── signature-vertical-white.png │ └── signature-vertical.png ├── R.ico ├── biasvar2.svg ├── biasvar_gp.svg ├── biasvartarget.svg ├── ccbysa_compact.png ├── ccbysa_test.png ├── favicons.zip ├── kfold.svg ├── learningcurve.svg ├── lossfuncs.png ├── lvmodel.png ├── mc.png ├── mc_logo.png ├── mc_sunset_2.png ├── min_depth_1.png ├── min_depth_2.png ├── nineteeneightyR.png ├── nnet.png ├── readmeimg1.png ├── rf.png ├── senate.png ├── senate.svg ├── signature-acronym.png ├── svm2d_temp.svg ├── svm3d.png ├── svm3d_temp.png ├── svm3d_temp.svg ├── tree1.png └── tree2.png ├── index.Rmd ├── intro.Rmd ├── introduction-to-machine-learning.Rproj ├── marcio_workshop.ipynb ├── mlcrash.pdf ├── old.7z ├── original wine data paper.pdf ├── other.Rmd ├── preface.Rmd ├── python_demo.py ├── references.Rmd ├── refs.bib ├── workshop.zip └── workshop ├── data ├── results_knn.RData ├── results_nnet.RData ├── results_regreg.RData ├── results_rf.RData ├── results_svm.RData ├── results_xgb.RData └── wine.csv ├── python_examples ├── README.md ├── Workshop.ipynb ├── adult.csv ├── adult_notes.rtf └── wine.csv ├── workshop.Rproj └── worskhop_code.R /.gitattributes: -------------------------------------------------------------------------------- 1 | # History files 2 | .Rhistory 3 | .Rapp.history 4 | 5 | # Session Data files 6 | .RData 7 | 8 | # Example code in package build process 9 | *-Ex.R 10 | 11 | # Output files from R CMD build 12 | /*.tar.gz 13 | 14 | # Output files from R CMD check 15 | /*.Rcheck/ 16 | 17 | # RStudio files 18 | .Rproj.user/ 19 | 20 | # primary content 21 | *.Rmd 22 | 23 | # produced vignettes 24 | _book/*.html 25 | _book/*.pdf 26 | 27 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 28 | .httr-oauth 29 | 30 | # knitr and R markdown default cache directories 31 | /*_bookdown_files/ 32 | /*_cache/ 33 | /cache/ 34 | 35 | # Temporary files created by R markdown 36 | *.utf8.md 37 | *.knit.md 38 | 39 | *.html linguist-vendored 40 | *.js linguist-vendored 41 | *.sh linguist-vendored 42 | *.css linguist-vendored 43 | 44 | *.Rmd linguist-language=R 45 | *.stan linguist-language=Stan 46 | *.inp linguist-language=Mplus 47 | *.out linguist-generated=true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | *_book 6 | *_cache 7 | .DS_Store 8 | .ipynb*/ -------------------------------------------------------------------------------- /.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/.nojekyll -------------------------------------------------------------------------------- /Glossary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/Glossary.pdf -------------------------------------------------------------------------------- /MLtechrep.bib: -------------------------------------------------------------------------------- 1 | @book{efron2016computer, 2 | title={Computer Age Statistical Inference}, 3 | author={Efron, Bradley and Hastie, Trevor}, 4 | volume={5}, 5 | year={2016}, 6 | publisher={Cambridge University Press} 7 | } 8 | 9 | @inproceedings{banko_scaling_2001, 10 | address = {Stroudsburg, {PA}, {USA}}, 11 | series = {{ACL} '01}, 12 | title = {Scaling to very very large corpora for natural language disambiguation}, 13 | url = {http://dx.doi.org/10.3115/1073012.1073017}, 14 | doi = {10.3115/1073012.1073017}, 15 | abstract = {The amount of readily available on-line text has reached hundreds of billions of words and continues to grow. Yet for most core natural language tasks, algorithms continue to be optimized, tested and compared after training on corpora consisting of only one million words or less. In this paper, we evaluate the performance of different learning methods on a prototypical natural language disambiguation task, confusion set disambiguation, when trained on orders of magnitude more labeled data than has previously been used. We are fortunate that for this particular application, correctly labeled training data is free. Since this will often not be the case, we examine methods for effectively exploiting very large corpora when labeled data comes at a cost.}, 16 | urldate = {2012-10-31}, 17 | booktitle = {Proceedings of the 39th Annual Meeting on Association for Computational Linguistics}, 18 | publisher = {Association for Computational Linguistics}, 19 | author = {Banko, Michele and Brill, Eric}, 20 | year = {2001}, 21 | file = {ACM Full Text PDF:C:\Users\mclark19\AppData\Roaming\Mozilla\Firefox\Profiles\kfv56tr7.default\zotero\storage\TAGCIZ7A\Banko and Brill - 2001 - Scaling to very very large corpora for natural lan.pdf:application/pdf} 22 | }, 23 | 24 | @book{wood_generalized_2006, 25 | title = {Generalized additive models: an introduction with R}, 26 | volume = {66}, 27 | shorttitle = {Generalized additive models}, 28 | publisher = {{CRC} Press}, 29 | author = {Wood, S. N}, 30 | year = {2006, 2017}, 31 | file = {[PDF] from bath.ac.uk:C:\Users\mclark19\AppData\Roaming\Mozilla\Firefox\Profiles\kfv56tr7.default\zotero\storage\N99I9S57\Wood - 2006 - Generalized additive models an introduction with .pdf:application/pdf;Snapshot:C:\Users\mclark19\AppData\Roaming\Mozilla\Firefox\Profiles\kfv56tr7.default\zotero\storage\AVVZHAIN\Wood - 2006 - Generalized additive models an introduction with .html:text/html} 32 | }, 33 | 34 | @book{harrell2015regression, 35 | title={Regression Modeling Strategies: With Applications to Linear Models, Logistic and Ordinal Regression, and Survival Analysis}, 36 | author={Harrell, F.}, 37 | isbn={9783319194257}, 38 | series={Springer Series in Statistics}, 39 | year={2015}, 40 | publisher={Springer International Publishing} 41 | }, 42 | 43 | 44 | @article{breiman_statistical_2001, 45 | title = {Statistical Modeling: The Two Cultures (with comments and a rejoinder by the author)}, 46 | volume = {16}, 47 | issn = {0883-4237}, 48 | shorttitle = {Statistical Modeling}, 49 | url = {http://projecteuclid.org/euclid.ss/1009213726}, 50 | doi = {10.1214/ss/1009213726}, 51 | abstract = {There are two cultures in the use of statistical modeling to reach 52 | conclusions from data. One assumes that the data are generated by a given 53 | stochastic data model. The other uses algorithmic models and treats the data 54 | mechanism as unknown. The statistical community has been committed to the 55 | almost exclusive use of data models. This commitment has led to irrelevant 56 | theory, questionable conclusions, and has kept statisticians from working on a 57 | large range of interesting current problems. Algorithmic modeling, both in 58 | theory and practice, has developed rapidly in fields outside statistics. It can 59 | be used both on large complex data sets and as a more accurate and informative 60 | alternative to data modeling on smaller data sets. If our goal as a field is to 61 | use data to solve problems, then we need to move away from exclusive dependence 62 | on data models and adopt a more diverse set of tools.}, 63 | number = {3}, 64 | urldate = {2012-07-22}, 65 | journal = {Statistical Science}, 66 | author = {Breiman, Leo}, 67 | month = aug, 68 | year = {2001}, 69 | note = {Mathematical Reviews number ({MathSciNet):} {MR1874152}}, 70 | pages = {199--231} 71 | }, 72 | 73 | @book{hastie_elements_2009, 74 | edition = {2nd ed. 2017. Corr. 12th Printing.}, 75 | title = {The Elements of Statistical Learning: Data Mining, Inference, and Prediction, Second Edition}, 76 | isbn = {0387848576}, 77 | shorttitle = {The Elements of Statistical Learning}, 78 | publisher = {Springer}, 79 | author = {Hastie, Trevor and Tibshirani, Robert and Friedman, Jerome}, 80 | month = feb, 81 | year = {2009} 82 | }, 83 | 84 | @article{domingos_few_2012, 85 | title = {A few useful things to know about machine learning}, 86 | volume = {55}, 87 | issn = {0001-0782}, 88 | url = {http://doi.acm.org/10.1145/2347736.2347755}, 89 | doi = {10.1145/2347736.2347755}, 90 | number = {10}, 91 | urldate = {2012-12-14}, 92 | journal = {Commun. {ACM}}, 93 | author = {Domingos, Pedro}, 94 | month = oct, 95 | year = {2012}, 96 | file = {ACM Full Text PDF:C:\Users\mclark19\AppData\Roaming\Mozilla\Firefox\Profiles\kfv56tr7.default\zotero\storage\Q74GIGS9\Domingos - 2012 - A few useful things to know about machine learning.pdf:application/pdf} 97 | }, 98 | 99 | @book{murphy_machine_2012, 100 | title = {Machine Learning: A Probabilistic Perspective}, 101 | isbn = {0262018020}, 102 | shorttitle = {Machine Learning}, 103 | publisher = {The {MIT} Press}, 104 | author = {Murphy, Kevin P.}, 105 | month = aug, 106 | year = {2012} 107 | } 108 | 109 | @article{fernandez2014, 110 | title={Do we need hundreds of classifiers to solve real world classification problems}, 111 | author={Fern{\'a}ndez-Delgado, Manuel and Cernadas, Eva and Barro, Sen{\'e}n and Amorim, Dinani}, 112 | journal={J. Mach. Learn. Res}, 113 | volume={15}, 114 | number={1}, 115 | pages={3133--3181}, 116 | year={2014} 117 | } 118 | 119 | @inproceedings{ribeiro2016, 120 | title={Why should i trust you?: Explaining the predictions of any classifier}, 121 | author={Ribeiro, Marco Tulio and Singh, Sameer and Guestrin, Carlos}, 122 | booktitle={Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining}, 123 | pages={1135--1144}, 124 | year={2016}, 125 | organization={ACM} 126 | } 127 | 128 | @book{kuhn2013, 129 | title={Applied predictive modeling}, 130 | author={Kuhn, Max and Johnson, Kjell}, 131 | volume={26}, 132 | year={2013}, 133 | publisher={Springer} 134 | } 135 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introduction to Machine Learning 2 | 3 | This document covers machine learning basics. The focus is on concepts and general approaches, with demonstration in R, though examples can be found for Python as well. The background assumed for the reader is generally one that will have had more or less traditional/applied training with regression modeling, but little else is assumed beyond that. R background can be fairly minimal, as there is no attempt to teach programming skills, but you should be familiar with basic data processing and analysis. 4 | 5 | 6 | It has gone through an update in 2018 and serves as the basis for a workshop. [LINK TO DOC](http://m-clark.github.io/introduction-to-machine-learning/) 7 | 8 | Contents include: 9 | 10 | - An introduction to get used to terminology and tie things to common methods 11 | - A focus on concepts, such as regularization and the bias-variance trade-off 12 | - Examples including regularized regression, random forests, neural nets, and more 13 | - An overview of extensions and ties to other methods 14 | - A couple Python demos for the same methods 15 | 16 | 17 | -------------------------------------------------------------------------------- /_bookdown.yml: -------------------------------------------------------------------------------- 1 | book_filename: "introduction-to-machine-learning" 2 | language: 3 | ui: 4 | chapter_name: "Chapter " 5 | output_dir: "docs" 6 | delete_merged_file: true 7 | 8 | rmd_files: [ 9 | "index.Rmd", 10 | "preface.Rmd", 11 | "intro.Rmd", 12 | 'concepts.Rmd', 13 | 'blackbox.Rmd', 14 | 'other.Rmd', 15 | 'appendix.Rmd', 16 | 'references.Rmd' 17 | ] 18 | -------------------------------------------------------------------------------- /_bookdown_files/introduction-to-machine-learning_files/figure-html/featureplot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/_bookdown_files/introduction-to-machine-learning_files/figure-html/featureplot-1.png -------------------------------------------------------------------------------- /_bookdown_files/introduction-to-machine-learning_files/figure-html/knnvarimp-1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 0 36 | 25 37 | 50 38 | 75 39 | 100 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | residual.sugar 55 | sulphates 56 | pH 57 | total.sulfur.dioxide 58 | citric.acid 59 | fixed.acidity 60 | chlorides 61 | volatile.acidity 62 | alcohol 63 | Importance 64 | 65 | -------------------------------------------------------------------------------- /_bookdown_files/introduction-to-machine-learning_files/figure-html/regregvarimp-1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 0 36 | 25 37 | 50 38 | 75 39 | 100 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | citric.acid 55 | pH 56 | fixed.acidity 57 | residual.sugar 58 | total.sulfur.dioxide 59 | chlorides 60 | sulphates 61 | volatile.acidity 62 | alcohol 63 | Importance 64 | 65 | -------------------------------------------------------------------------------- /_bookdown_files/introduction-to-machine-learning_files/figure-html4/regregvarimp-1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 0 36 | 25 37 | 50 38 | 75 39 | 100 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | citric.acid 55 | pH 56 | fixed.acidity 57 | residual.sugar 58 | total.sulfur.dioxide 59 | chlorides 60 | sulphates 61 | volatile.acidity 62 | alcohol 63 | Importance 64 | 65 | -------------------------------------------------------------------------------- /_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::gitbook')" 4 | -------------------------------------------------------------------------------- /_deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | [ -z "${GITHUB_PAT}" ] && exit 0 6 | [ "${TRAVIS_BRANCH}" != "master" ] && exit 0 7 | 8 | git config --global user.email "micl@umich.edu" 9 | git config --global user.name "Michael Clark" 10 | 11 | git clone -b gh-pages https://${GITHUB_PAT}@github.com/${TRAVIS_REPO_SLUG}.git book-output 12 | cd book-output 13 | cp -r ../_book/* ./ 14 | git add --all * 15 | git commit -m"Update the book" || true 16 | git push origin gh-pages 17 | -------------------------------------------------------------------------------- /_output.yml: -------------------------------------------------------------------------------- 1 | bookdown::gitbook: 2 | css: [css/book.css, 'https://use.fontawesome.com/releases/v5.0.13/css/all.css'] 3 | font-import: https://fonts.googleapis.com/css?family=Roboto|Open+Sans 4 | font-family: 'Roboto' 5 | number_sections: false 6 | split_by: rmd 7 | config: 8 | df_print: kable 9 | highlight: pygments 10 | edit : null 11 | download: null 12 | search: yes 13 | sharing: 14 | facebook: no 15 | twitter: no 16 | google: no 17 | weibo: no 18 | instapper: no 19 | vk: no 20 | all: ['twitter', 'facebook', 'google', 'weibo', 'instapaper'] 21 | toc: 22 | depth: 2 23 | collapse: section 24 | scroll_highlight: yes 25 | before: | 26 |
  • Machine Learning
  • 27 | after: | 28 |
  • 29 | 30 | MC logo 31 | 32 |
  • 33 |
  • 34 |
    35 | 36 | 37 | 38 |
    39 |
  • 40 |
  • 41 |
    42 | 43 | 44 | 45 | 46 | 47 |
    48 |
  • 49 | -------------------------------------------------------------------------------- /css/book.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css?family=Roboto|Roboto+Mono|Roboto+Condensed|Lato|Lora|Fira+Sans"); 2 | 3 | /* title page */ 4 | .book .book-body .page-wrapper .page-inner section.normal h1.title { 5 | font-size: 250%; 6 | font-family: 'Fira Sans', Karla, 'Roboto Condensed', Lora, Lato, Roboto, sans; 7 | font-style: normal; 8 | font-weight: 100; 9 | } 10 | 11 | .book .book-body .page-wrapper .page-inner section.normal .author .noem { 12 | display: block; 13 | margin: 0 0 10px 0; 14 | font-size: 125%; 15 | font-style: normal; 16 | font-variant: small-caps; 17 | font-weight: 200; 18 | font-family: 'Roboto Condensed', 'Fira Sans', Roboto, 'Open Sans', sans; 19 | } 20 | 21 | .book .book-body .page-wrapper .page-inner section.normal .author a { 22 | display: block; 23 | margin: 0 0 10px 0; 24 | font-size: 100%; 25 | font-style: normal; 26 | /*font-variant: small-caps; so that can displayed as input*/ 27 | font-weight: 200; 28 | font-family: 'Roboto Condensed', 'Fira Sans', Roboto, 'Open Sans', sans; 29 | } 30 | 31 | 32 | 33 | .book .book-body .page-wrapper .page-inner section.normal a.uri { 34 | display: block; 35 | margin: 0 0 10px 0; 36 | font-size: 75%; 37 | font-style: normal; /* ignored thanks to bootstrap random enforcement of em*/ 38 | font-variant: small-caps; 39 | font-family: Roboto, 'Open Sans', sans; 40 | } 41 | 42 | .book .book-body .page-wrapper .page-inner section.normal h4.date { 43 | font-style: normal; 44 | font-size: 100%; 45 | font-family: 'Open Sans', sans; 46 | } 47 | 48 | /* main */ 49 | 50 | .book { 51 | background-color: #fffff8; 52 | } 53 | 54 | .section { 55 | background-color: #fffff8; 56 | } 57 | 58 | 59 | 60 | .book .book-body .page-wrapper .page-inner section.normal { 61 | display: block; 62 | background-color: #fffff8; 63 | color: #585858; 64 | padding: 5px 15px; 65 | font-family: Roboto, 'Helvetica Neue', sans-serif; 66 | word-wrap: break-word; 67 | overflow: hidden; 68 | line-height: 1.7; 69 | text-size-adjust: 100%; 70 | -ms-text-size-adjust: 100%; 71 | -webkit-text-size-adjust: 100%; 72 | -moz-text-size-adjust: 100%; 73 | } 74 | 75 | .book .book-body { 76 | background: #fffff8; 77 | -webkit-transition: left 250ms ease; 78 | -moz-transition: left 250ms ease; 79 | -o-transition: left 250ms ease; 80 | transition: left 250ms ease; 81 | } 82 | 83 | /* link effects */ 84 | .book .book-body .page-wrapper .page-inner section.normal a { 85 | color: #3D68FF; 86 | background-image: linear-gradient(180deg,transparent 90%, #FFD43D 0); 87 | background-size: 0 100%; 88 | background-repeat: no-repeat; 89 | text-decoration: none; 90 | -webkit-transition: background-size .4s ease; 91 | -moz-transition: background-size .4s ease; 92 | -ms-transition: background-size .4s ease; 93 | -o-transition: background-size .4s ease; 94 | transition: background-size .4s ease; 95 | border-bottom: 0px solid; 96 | } 97 | 98 | .book .book-body .page-wrapper .page-inner section.normal a:hover { 99 | text-decoration: none; 100 | background-size: 100% 100%; 101 | cursor: pointer; 102 | } 103 | 104 | .body-inner { 105 | background-color: #fffff8; 106 | } 107 | 108 | .book .book-body .page-wrapper { 109 | position: relative; 110 | outline: 0; 111 | background-color: #fffff8; 112 | } 113 | 114 | .book .book-body .page-wrapper .page-inner { 115 | max-width: 900px; 116 | margin: 0 auto; 117 | padding: 20px 0 40px; 118 | } 119 | 120 | .book .book-header { 121 | overflow: visible; 122 | height: 48px; /* adjust to match title space*/ 123 | padding: 0 8px; 124 | z-index: 2; 125 | font-family: Roboto sans-serif; 126 | font-size: .85em; 127 | color: #7e888b; 128 | background-color: #fffff8; 129 | /* background: 0 0; */ 130 | } 131 | 132 | /* only way to set bgcolor of top bar?*/ 133 | .book-body.fixed { 134 | background-color: #fffff8; 135 | } 136 | 137 | /* Rather than resize the header, just get rid of line */ 138 | .book.with-summary .book-header.fixed { 139 | background-color: #fffff8; 140 | font-variant: small-caps; 141 | /*font-family: Stalemate Roboto Sans; ignored as all it is doing is taking from index title*/ 142 | border-bottom: 0 solid rgba(0,0,0,.07); /*just remove it; this makes height in .book-header above moot*/ 143 | border-bottom-width: 0; 144 | border-bottom-style: solid; 145 | border-bottom-color: rgba(0, 0, 0, 0.07); 146 | } 147 | 148 | i { 149 | background-color: #fffff8; 150 | } 151 | 152 | /* toc area general */ 153 | .book .book-summary { 154 | position: absolute; 155 | font-family: "Open Sans", 'Helvetica Neue', Roboto, sans-serif; 156 | top: 0; 157 | left: -300px; 158 | bottom: 0; 159 | z-index: 1; 160 | width: 300px; 161 | color: #364149; /**/ 162 | background: #f5f5f540; /* #eaf5fb; #d9edf7#bdcadb #3572D9 #fafafa*/ 163 | border-right: 1px solid rgba(0,0,0,.07); 164 | -webkit-transition: left 250ms ease; 165 | -moz-transition: left 250ms ease; 166 | -o-transition: left 250ms ease; 167 | transition: left 250ms ease; 168 | } 169 | 170 | /* nav/menu area */ 171 | .book .book-summary ul.summary li a, .book .book-summary ul.summary li span { 172 | display: block; 173 | padding: 10px 25px; 174 | border-bottom: none; 175 | color: #364149; /**/ 176 | background: 0 0; 177 | text-overflow: ellipsis; 178 | overflow: hidden; 179 | white-space: nowrap; 180 | position: relative; 181 | font-family: Lato,'Roboto Condensed', sans; 182 | /* font-variant: small-caps; */ 183 | } 184 | 185 | 186 | .book .book-summary ul.summary li a:hover, .book .book-summary ul.summary li.active>a { 187 | color: #fffff8; /*#6197D5*/ 188 | background-color: #990024; 189 | } 190 | 191 | /* so that before and after aren't treated the same as the toc, because why would they? */ 192 | .book .book-summary ul.summary li.before a { 193 | color: #990024; 194 | text-decoration: none; 195 | font-size: 125%; 196 | font-variant: small-caps; 197 | font-family: 'Roboto Condensed', 'Helvetica Neue', 'Open Sans', Roboto, sans-serif; 198 | font-weight: 500; 199 | } 200 | 201 | 202 | .book .book-summary ul.summary li.before a:hover, 203 | .book .book-summary ul.summary li.before li.active>a { 204 | color: #fffff8; /*#6197D5*/ 205 | background-color: #990024; 206 | text-decoration: none; 207 | } 208 | 209 | .book .book-summary ul.summary li.after a, .book .book-summary ul.summary li.after a:hover { 210 | background-color: transparent; 211 | } 212 | 213 | /* divider line for the title before and other stuff after toc */ 214 | .book .book-summary ul.summary li.divider{ 215 | height:1px; 216 | margin:7px 0; 217 | overflow:hidden; 218 | background:rgba(0,0,0,.07) 219 | } 220 | 221 | .book .book-body .page-wrapper .page-inner section.normal pre { 222 | overflow: auto; 223 | word-wrap: normal; 224 | margin: 0 0 1.275em; 225 | padding: .85em 1em; 226 | background: #fafafa; 227 | } 228 | 229 | 230 | .book .book-body .page-wrapper .page-inner section.normal code, 231 | .book .book-body .page-wrapper .page-inner section.normal pre { 232 | font-family: 'Roboto Mono', Monaco, Consolas, "Liberation Mono", Menlo, 'Courier New', monospace; 233 | direction: ltr; 234 | border: none; 235 | color: inherit; 236 | } 237 | 238 | .book .book-body .page-wrapper .page-inner section.normal .note { 239 | background-color: #fafafa; 240 | /*background-image: url('../img/R.ico');*/ 241 | font-size: 80% ; 242 | margin: auto; 243 | font-weight: 500; 244 | max-width: 75%; 245 | border-width: 10px; 246 | border-color: #bfbfbf; 247 | box-shadow: 10px 10px 5px #EBEBEB; /*#888888*/ 248 | padding: 1em; 249 | } 250 | 251 | /* headers */ 252 | 253 | h1, h2, h3, h4, h5 { 254 | color:#990024; 255 | font-family: 'Roboto Condensed'; 256 | } 257 | 258 | /* notes */ 259 | 260 | .img-note { 261 | vertical-align: central; 262 | width: 2em; 263 | } 264 | 265 | .footnotes { 266 | color: #00000080; 267 | } 268 | 269 | 270 | 271 | /* marginnotes */ 272 | .book .book-body .page-wrapper .page-inner section.normal .marginnote span.mjx-chtml, span.mjx-block { 273 | display: block; 274 | font-size: 80%; 275 | } 276 | 277 | .book .book-body .page-wrapper .page-inner section.normal .marginnote { 278 | float: right; 279 | clear: right; 280 | margin-right: -45%; 281 | width: 40%; 282 | margin-top: 0; 283 | margin-bottom: 0; 284 | font-size: 75%; 285 | line-height: 1; 286 | vertical-align: baseline; 287 | position: relative; 288 | } 289 | 290 | 291 | 292 | /* code */ 293 | 294 | /* logical NA */ 295 | .ot { 296 | color: #337ab7; 297 | } 298 | 299 | /* char/string */ 300 | .ch, .st { 301 | color: #aa5500; 302 | } 303 | 304 | /* args */ 305 | .dt { 306 | 307 | } 308 | 309 | /* package */ 310 | code span.st { 311 | color: #aa5500; 312 | } 313 | 314 | /* float, other */ 315 | .fl, .dv { 316 | color: #23527c; 317 | } 318 | 319 | /* override pygments setting code to a tag */ 320 | .book .book-body .page-wrapper .page-inner section.normal pre code a { 321 | color: #585858; 322 | } 323 | 324 | /* img */ 325 | 326 | img { 327 | display: block; 328 | margin: 0 auto; 329 | } 330 | 331 | .arc { 332 | display: block; 333 | width:30%; 334 | padding:5px 0; 335 | margin: 0 0 10px 0; 336 | } 337 | 338 | .cscar { 339 | display: block; 340 | width:21%; 341 | padding:5px 0; 342 | margin: 0 0 10px 0; 343 | } 344 | 345 | /* zoom for img*/ 346 | .zoom { 347 | transition: all .3s; 348 | } 349 | 350 | .zoom:hover { 351 | transform: scale(1.5); /* (150% zoom - Note: if the zoom is too large, it will go outside of the viewport) */ 352 | } 353 | 354 | 355 | /* creative commons, github icons */ 356 | .fab .fa-creative-commons, .fa-creative-commons-sa, .fa-creative-commons-by, .fa-github, .fa-lg { 357 | color: #990024; 358 | background-color: transparent; 359 | } 360 | 361 | /* text highlights */ 362 | .emph { 363 | color: #E32D00 ; /*#ff5500 #D14300*/ 364 | font-weight: 500; 365 | } 366 | 367 | /* pack func and objclass colors initially come from hcl(seq(90,360, length.out=4), c=80, l=80); redone for contrast*/ 368 | .pack { 369 | color: #990071; /*#AC9CFF #e41a1c*/ 370 | font-weight: 500; 371 | } 372 | 373 | .func { 374 | color: #007020; /*#007199 #00CBB6; #984ea3; can just use `` instead*/ 375 | font-weight: bold; 376 | } 377 | 378 | .objclass { 379 | color: #947100; /*#AAB400 #4daf4a; #FFC5D0*/ 380 | font-weight: 500; 381 | } 382 | 383 | 384 | /* miscellaneous */ 385 | 386 | .col2 { 387 | columns: 2 200px; /* number of columns and width in pixels*/ 388 | -webkit-columns: 2 200px; /* chrome, safari */ 389 | -moz-columns: 2 200px; /* firefox */ 390 | } 391 | .col3 { 392 | columns: 3 100px; 393 | -webkit-columns: 3 100px; 394 | -moz-columns: 3 100px; 395 | } 396 | 397 | .plotly { 398 | margin-left: 5%; 399 | margin-right: 5%; 400 | } 401 | 402 | /*.plotly html-widget { 403 | width: 100%; 404 | }*/ 405 | 406 | .d3heatmap { 407 | margin-left: 5%; 408 | margin-right: 5%; 409 | width: 75%; 410 | } 411 | 412 | 413 | /* tables */ 414 | 415 | table { 416 | margin: auto; 417 | } 418 | 419 | .book .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) { 420 | background-color: white; 421 | } 422 | 423 | div.datatables { 424 | margin-left: auto; /* to center them when full is not necessary. */ 425 | margin-right: auto; 426 | } 427 | -------------------------------------------------------------------------------- /css/old/mytufte.css: -------------------------------------------------------------------------------- 1 | 2 | @font-face { 3 | font-family: 'Open Sans'; 4 | font-style: normal; 5 | font-weight: 400; 6 | src: local('Open Sans'), local('OpenSans'), url(http://fonts.gstatic.com/s/opensans/v13/cJZKeOuBrn4kERxqtaUH3aCWcynf_cDxXwCLxiixG1c.ttf) format('truetype'); 7 | } 8 | @font-face { 9 | font-family: 'Risque'; 10 | font-style: normal; 11 | font-weight: 400; 12 | src: local('Risque'), local('Risque-Regular'), url(http://fonts.gstatic.com/s/risque/v4/iFA7a9Hk8IxDgPVBx7IE_Q.ttf) format('truetype'); 13 | } 14 | @font-face { 15 | font-family: 'Roboto'; 16 | font-style: normal; 17 | font-weight: 400; 18 | src: local('Roboto'), local('Roboto-Regular'), url(http://fonts.gstatic.com/s/roboto/v15/zN7GBFwfMP4uA6AR0HCoLQ.ttf) format('truetype'); 19 | } 20 | 21 | /* latin-ext */ 22 | @font-face { 23 | font-family: 'Libre Baskerville'; 24 | font-style: normal; 25 | font-weight: 400; 26 | src: local('Libre Baskerville'), local('LibreBaskerville-Regular'), url(https://fonts.gstatic.com/s/librebaskerville/v4/pR0sBQVcY0JZc_ciXjFsKwHlCYWexZJCPRz1QQ0uKVU.woff2) format('woff2'); 27 | unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; 28 | } 29 | /* latin */ 30 | @font-face { 31 | font-family: 'Libre Baskerville'; 32 | font-style: normal; 33 | font-weight: 400; 34 | src: local('Libre Baskerville'), local('LibreBaskerville-Regular'), url(https://fonts.gstatic.com/s/librebaskerville/v4/pR0sBQVcY0JZc_ciXjFsK6Ucnt8gjcHpqyffjHeZWDA.woff2) format('woff2'); 35 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; 36 | } 37 | 38 | .emph { 39 | color: #ff5503; 40 | font-weight: 500; 41 | } 42 | 43 | /* pack func and objclass colors come from hcl(seq(90,360, length.out=4), c=80, l=80)*/ 44 | .pack { 45 | color: #AC9CFF; /*#e41a1c*/ 46 | font-weight: 500; 47 | } 48 | 49 | .func { /*#984ea3;can just use `` instead*/ 50 | color: #00CBB6; 51 | font-weight: 500; 52 | } 53 | 54 | .objclass { 55 | color: #AAB400; /*#4daf4a; #FFC5D0*/ 56 | font-weight: 500; 57 | } 58 | 59 | 60 | body { 61 | /*font-family: 'Libre Baskerville', Roboto;*/ 62 | color: #595959; /*#595959 (i.e. gray35) provides recommended contrast ratio 7:1; previous #7f7f7f (4:1); */ 63 | } 64 | 65 | p, ul, ol { 66 | font-family: 'Libre Baskerville'; 67 | font-size: 100%; 68 | } 69 | 70 | ul { 71 | list-style-type: none; 72 | } 73 | 74 | pre { 75 | box-sizing: border-box; 76 | left: 0; /* This changes where the code chunk box actually starts */ 77 | /* padding: 10px 0 10px 60px; /* Change the last value here to move the text left or right */ 78 | position: relative; 79 | width: 55%; /* This changes where the code chunk box ends on the right side */ 80 | font-size: 75%; /*changes output size; and comments*/ 81 | line-height: 1.25em; /* line spacing; default seems to be about 1.5 or more */ 82 | /*border: 10px solid #ff5500;*/ /*code block and results border*/ 83 | background-color: none; /* results background #F7F7F7*/ 84 | 85 | } 86 | 87 | pre code.r { 88 | line-height: 1.5em; /* line spacing; default seems to be about 1.5 or more */ 89 | } 90 | 91 | 92 | #TOC{ 93 | font-size: 75%; 94 | } 95 | 96 | .table { 97 | margin: 0 auto; 98 | } 99 | 100 | 101 | .tocify ul, .tocify li { 102 | list-style: none; 103 | margin: 0; 104 | padding: 0; 105 | border: none; 106 | width: 100%; 107 | line-height: 30px; 108 | } 109 | 110 | li.tocify-item.list-group-item.active { 111 | background-color: #B2001D; /* background of current section in toc rgb(97,151,213)*/ 112 | } 113 | 114 | h1, h2, h3, h4, h5 { 115 | /* color:rgb(97,151,213); */ 116 | color: #B2001D; /* stan red*/ 117 | } 118 | 119 | 120 | 121 | a href { 122 | text-decoration: none; 123 | color: #1e90ff; 124 | } 125 | 126 | 127 | /* background is used for the link underline in order to 'clear descenders', which wouldn't be a problem if you don't underline links like it's 1997. Setting to none here removes*/ 128 | a:link { 129 | background: none; 130 | color: #1e90ff; 131 | } 132 | 133 | 134 | 135 | /* make smaller font to go along with overall regular sized font above */ 136 | .sidenote, .marginnote { 137 | font-size: 75%; 138 | } 139 | 140 | /* fix of ridiculous default buttons */ 141 | .btn-default { 142 | background: #f0f8ff; 143 | font-family: 'Open Sans'; 144 | color: rgb(97,151,213); 145 | text-decoration: none; 146 | width: 20%; 147 | -webkit-border-radius: 50px; 148 | -moz-border-radius: 50px; 149 | border-radius: 50px; 150 | border: 3px solid ; 151 | border-color: rgba(97,151,213, .75); 152 | margin: 50px; 153 | /*border: 3px solid rgb(97,151,213); 154 | /*background:rgba(227,227,227,0.5);*/ 155 | /* -webkit-box-shadow: #B3B3B3 5px 5px 5px; 156 | -moz-box-shadow: #B3B3B3 5px 5px 5px; 157 | box-shadow: #B3B3B3 5px 5px 5px; */ 158 | } 159 | 160 | .btn-default:active, 161 | .btn-default.active, 162 | .open > .dropdown-toggle.btn-default { 163 | color: #ffffff; 164 | background-color: #282828; 165 | border-color: #232323; 166 | } 167 | 168 | 169 | .imgbigger { 170 | width: 100%; 171 | height: 100%; 172 | } 173 | 174 | .imgbigger img { 175 | -webkit-transition: all .5s ease; /* Safari and Chrome */ 176 | -moz-transition: all .5s ease; /* Firefox */ 177 | -ms-transition: all .5s ease; /* IE 9 */ 178 | -o-transition: all .5s ease; /* Opera */ 179 | transition: all .5s ease; 180 | } 181 | 182 | .imgbigger:hover img { 183 | -webkit-transform:scale(2); /* Safari and Chrome */ 184 | -moz-transform:scale(2); /* Firefox */ 185 | -ms-transform:scale(2); /* IE 9 */ 186 | -o-transform:scale(2); /* Opera */ 187 | transform:scale(2); 188 | } 189 | 190 | -------------------------------------------------------------------------------- /css/old/standard_html.css: -------------------------------------------------------------------------------- 1 | .emph { 2 | color: #ff5503; 3 | font-weight: 500; 4 | } 5 | 6 | /* pack func and objclass colors come from hcl(seq(90,360, length.out=4), c=80, l=80)*/ 7 | .pack { 8 | color: #AC9CFF; /*#e41a1c*/ 9 | font-weight: 500; 10 | } 11 | 12 | .func { /*#984ea3;can just use `` instead*/ 13 | color: #00CBB6; 14 | font-weight: 500; 15 | } 16 | 17 | .objclass { 18 | color: #AAB400; /*#4daf4a; #FFC5D0*/ 19 | font-weight: 500; 20 | } 21 | 22 | a { 23 | color: #1e90ff; /*dodgerblue*/ 24 | } 25 | 26 | body { 27 | color: #595959; /*#595959 (i.e. gray35) provides recommended contrast ratio 7:1; previous #7f7f7f (4:1); */ 28 | } 29 | 30 | pre { 31 | box-sizing: border-box; 32 | left: 0; /* This changes where the code chunk box actually starts */ 33 | /* padding: 10px 0 10px 60px; /* Change the last value here to move the text left or right */ 34 | position: relative; 35 | width: 100%; /* This changes where the code chunk box ends on the right side */ 36 | font-size: 75%; /*changes output size; and comments*/ 37 | /*border: 10px solid #ff5500;*/ /*code block and results border*/ 38 | /*background-color:#ff5500;*/ /* results background*/ 39 | 40 | } 41 | 42 | #TOC{ 43 | font-size: 75%; 44 | } 45 | 46 | .table { 47 | margin: 0 auto; 48 | } 49 | 50 | 51 | .tocify ul, .tocify li { 52 | list-style: none; 53 | margin: 0; 54 | padding: 0; 55 | border: none; 56 | width: 100%; 57 | line-height: 30px; 58 | } 59 | 60 | li.tocify-item.list-group-item.active { 61 | background-color: rgb(97,151,213); /* background of current section in toc */ 62 | } 63 | 64 | h1, h2, h3, h4, h5 { 65 | color:rgb(97,151,213); 66 | } 67 | 68 | .col2 { /* primarily for confusion matrix in this doc*/ 69 | padding: 0; 70 | /*columns: 2 200px;*/ /* number of columns and width in pixels*/ 71 | column-count: 2; 72 | column-width: 25%; 73 | width: 70%; 74 | column-gap: 5px; 75 | margin: 0 0; 76 | padding: 0 0; 77 | 78 | -webkit-column-gap: 5px; /* Chrome, Safari, Opera */ 79 | -moz-column-gap: 5px; /* Firefox */ 80 | } 81 | .col3 { 82 | columns: 3 100px; 83 | -webkit-columns: 3 100px; 84 | -moz-columns: 3 100px; 85 | } 86 | -------------------------------------------------------------------------------- /css/old/toc.css: -------------------------------------------------------------------------------- 1 | #TOC ul, 2 | #TOC li, 3 | #TOC span, 4 | #TOC a { 5 | margin: 0; 6 | padding: 0; 7 | position: relative; 8 | } 9 | #TOC { 10 | line-height: 1; 11 | border-radius: 5px 5px 0 0; 12 | /*background: rgb(97,151,213);*/ 13 | background: #B2001D; /*stan red is #B2001D*/ 14 | /*background: linear-gradient(to bottom, #333333 0%, rgb(97,151,213) 100%); /*141414 is the darker black*/ 15 | border-bottom: 2px solid #B2001D; /* old #0fa1e0 */ 16 | width: 55%; 17 | font-size: 50%; 18 | } 19 | #TOC:after, 20 | #TOC ul:after { 21 | content: ''; 22 | display: block; 23 | clear: both; 24 | } 25 | #TOC a { 26 | background: #B2001D; 27 | /*background: rgb(97,151,213);*/ 28 | /*background: linear-gradient(to bottom, #333333 0%, rgb(97,151,213) 100%);*/ 29 | color: #ffffff; 30 | display: block; 31 | padding: 10px 10px; 32 | text-decoration: none; 33 | text-shadow: none; 34 | } 35 | #TOC ul { 36 | list-style: none; 37 | } 38 | #TOC > ul > li { 39 | display: inline-block; 40 | float: left; 41 | margin: 0; 42 | } 43 | #TOC > ul > li > a { 44 | color: #ffffff; 45 | font-size: 75%; 46 | } 47 | #TOC > ul > li:hover:after { 48 | content: ''; 49 | display: block; 50 | width: 0; 51 | height: 0; 52 | position: absolute; 53 | left: 50%; 54 | bottom: 0; 55 | border-left: 10px solid transparent; 56 | border-right: 10px solid transparent; 57 | border-bottom: 10px solid #B2001D; 58 | margin-left: -10px; 59 | } 60 | #TOC > ul > li:first-child > a { 61 | border-radius: 5px 0 0 0; 62 | } 63 | #TOC.align-right > ul > li:first-child > a, 64 | #TOC.align-center > ul > li:first-child > a { 65 | border-radius: 0; 66 | } 67 | #TOC.align-right > ul > li:last-child > a { 68 | border-radius: 0 5px 0 0; 69 | } 70 | 71 | /* colors of hover-over menu item */ 72 | #TOC > ul > li.active > a, 73 | #TOC > ul > li:hover > a { 74 | color: #ffffff; 75 | box-shadow: inset 0 0 5px rgb(30,144,255); /**/ 76 | /*background: #070707; 77 | background: linear-gradient(to bottom, #262626 0%, #070707 100%);*/ 78 | background: rgb(97,151,213); 79 | font-size: 75%; 80 | } 81 | 82 | #TOC .has-sub { 83 | z-index: 1; 84 | } 85 | 86 | #TOC .has-sub:hover > ul { 87 | display: block; 88 | } 89 | 90 | #TOC .has-sub ul { 91 | display: none; 92 | position: absolute; 93 | width: 200px; 94 | top: 100%; 95 | left: 0; 96 | 97 | } 98 | 99 | /* main sublists*/ 100 | #TOC .has-sub ul li a { 101 | background: rgb(97,151,213); /* old: #0fa1e0*/ 102 | border-bottom: 1px none #B2001D; /* sublist line old: dotted #31b7f1*/ 103 | filter: none; 104 | display: block; 105 | line-height: 120%; 106 | padding: 10px; 107 | color: #ffffff; 108 | font-size: 75%; 109 | } 110 | 111 | /* on hover for drop down*/ 112 | #TOC .has-sub ul li:hover a { 113 | background: #0c7fb0; 114 | 115 | } 116 | #TOC ul ul li:hover > a { 117 | color: #ffffff; 118 | font-size: 75%; 119 | } 120 | 121 | #TOC .has-sub .has-sub:hover > ul { 122 | display: block; 123 | } 124 | #TOC .has-sub .has-sub ul { 125 | display: none; 126 | position: absolute; 127 | left: 100%; 128 | top: 0; 129 | 130 | } 131 | #TOC .has-sub .has-sub ul li a { 132 | background: #0c7fb0; 133 | border-bottom: 1px dotted #31b7f1; 134 | } 135 | #TOC .has-sub .has-sub ul li a:hover { 136 | background: #0a6d98; 137 | } 138 | #TOC ul ul li.last > a, 139 | #TOC ul ul li:last-child > a, 140 | #TOC ul ul ul li.last > a, 141 | #TOC ul ul ul li:last-child > a, 142 | #TOC .has-sub ul li:last-child > a, 143 | #TOC .has-sub ul li.last > a { 144 | border-bottom: 0; 145 | } 146 | #TOC ul { 147 | font-size: 1.2rem; 148 | } 149 | -------------------------------------------------------------------------------- /css/standard_html.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css?family=Roboto|Roboto+Mono|Roboto+Condensed"); 2 | @import url("https://fonts.googleapis.com/css?family=Open+Sans"); 3 | @import url('https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300'); 4 | @import url('https://fonts.googleapis.com/css?family=Source+Code+Pro'); 5 | @import url('https://fonts.googleapis.com/css?family=Stalemate|Alex+Brush'); 6 | 7 | 8 | .emph { 9 | color: #E32D00 ; /*#ff5500 #D14300*/ 10 | font-weight: 500; 11 | } 12 | 13 | /* pack func and objclass colors initially come from hcl(seq(90,360, length.out=4), c=80, l=80); redone for contrast*/ 14 | .pack { 15 | color: #990071; /*#AC9CFF #e41a1c*/ 16 | font-weight: 500; 17 | } 18 | 19 | .func { 20 | color: #007199; /*#00CBB6; #984ea3; can just use `` instead*/ 21 | font-weight: 500; 22 | } 23 | 24 | .objclass { 25 | color: #947100; /*#AAB400 #4daf4a; #FFC5D0*/ 26 | font-weight: 500; 27 | } 28 | 29 | a { 30 | color: #1e90ff; /*dodgerblue*/ 31 | } 32 | 33 | body { 34 | color: #585858; /*#595959 (i.e. gray35) provides recommended contrast ratio 7:1 on white; change 9s to 8s for offwhite;*/ 35 | background-color: #fffff8; 36 | } 37 | 38 | p { 39 | 40 | } 41 | 42 | .author { 43 | font-variant: small-caps; 44 | } 45 | 46 | code { 47 | box-sizing: border-box; 48 | left: 0; /* This changes where the code chunk box actually starts */ 49 | /* padding: 10px 0 10px 60px; /* Change the last value here to move the text left or right */ 50 | position: relative; 51 | width: 100%; /* This changes where the code chunk box ends on the right side */ 52 | font-family: 'Roboto Mono' 'Lucida Sans' Consolas monospace; 53 | font-size: 100%; /*changes output size; and comments*/ 54 | /*border: 10px solid #ff5500;*/ /*code block and results border*/ 55 | /*background-color:#ff5500;*/ /* results background*/ 56 | 57 | } 58 | pre .r { 59 | box-sizing: border-box; 60 | left: 0; /* This changes where the code chunk box actually starts */ 61 | /* padding: 10px 0 10px 60px; /* Change the last value here to move the text left or right */ 62 | position: relative; 63 | /*width: 100%; /* This changes where the code chunk box ends on the right side */ 64 | font-family: 'Roboto Mono' 'Lucida Sans' Consolas monospace; 65 | /*font-size: 100%; /*changes output size; and comments*/ 66 | /*border: 10px solid #ff5500;*/ /*code block and results border*/ 67 | /*background-color:#ff5500;*/ /* results background*/ 68 | 69 | } 70 | 71 | #TOC{ 72 | font-size: 75%; 73 | 74 | } 75 | 76 | .table { 77 | margin: 0 auto; 78 | } 79 | 80 | 81 | .tocify ul, .tocify li { 82 | list-style: none; 83 | margin: 0; 84 | padding: 0; 85 | border: none; 86 | width: 100%; 87 | line-height: 30px; 88 | background-color: #fffff9; 89 | } 90 | 91 | li.tocify-item.list-group-item.active { 92 | background-color: rgb(97,151,213); /* background of current section in toc */ 93 | } 94 | 95 | h1, h2, h3, h4, h5 { 96 | color:#990024; 97 | font-family: 'Roboto Condensed'; 98 | } 99 | 100 | .col2 { 101 | columns: 2 200px; /* number of columns and width in pixels*/ 102 | -webkit-columns: 2 200px; /* chrome, safari */ 103 | -moz-columns: 2 200px; /* firefox */ 104 | } 105 | .col3 { 106 | columns: 3 100px; 107 | -webkit-columns: 3 100px; 108 | -moz-columns: 3 100px; 109 | } 110 | 111 | .plotly { 112 | margin-left: 5%; 113 | margin-right: 5%; 114 | } 115 | 116 | /*.plotly html-widget { 117 | width: 100%; 118 | }*/ 119 | 120 | .d3heatmap { 121 | margin-left: 5%; 122 | margin-right: 5%; 123 | width: 75%; 124 | } 125 | 126 | 127 | div.datatables { 128 | margin-left: auto; /* to center them when full is not necessary. */ 129 | margin-right: auto; 130 | } 131 | 132 | table { 133 | margin: auto; 134 | } -------------------------------------------------------------------------------- /data/knn_explain.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/data/knn_explain.RData -------------------------------------------------------------------------------- /data/results_knn.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/data/results_knn.RData -------------------------------------------------------------------------------- /data/results_nnet.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/data/results_nnet.RData -------------------------------------------------------------------------------- /data/results_regreg.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/data/results_regreg.RData -------------------------------------------------------------------------------- /data/results_rf.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/data/results_rf.RData -------------------------------------------------------------------------------- /data/results_svm.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/data/results_svm.RData -------------------------------------------------------------------------------- /data/results_xgb.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/data/results_xgb.RData -------------------------------------------------------------------------------- /data/rf_explain.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/data/rf_explain.RData -------------------------------------------------------------------------------- /data/rf_explainer_min_depth.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/data/rf_explainer_min_depth.RData -------------------------------------------------------------------------------- /data/rf_ggrf_min_depth.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/data/rf_ggrf_min_depth.RData -------------------------------------------------------------------------------- /data/rf_variable_importance.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/data/rf_variable_importance.RData -------------------------------------------------------------------------------- /data/winequality.names: -------------------------------------------------------------------------------- 1 | Citation Request: 2 | This dataset is public available for research. The details are described in [Cortez et al., 2009]. 3 | Please include this citation if you plan to use this database: 4 | 5 | P. Cortez, A. Cerdeira, F. Almeida, T. Matos and J. Reis. 6 | Modeling wine preferences by data mining from physicochemical properties. 7 | In Decision Support Systems, Elsevier, 47(4):547-553. ISSN: 0167-9236. 8 | 9 | Available at: [@Elsevier] http://dx.doi.org/10.1016/j.dss.2009.05.016 10 | [Pre-press (pdf)] http://www3.dsi.uminho.pt/pcortez/winequality09.pdf 11 | [bib] http://www3.dsi.uminho.pt/pcortez/dss09.bib 12 | 13 | 1. Title: Wine Quality 14 | 15 | 2. Sources 16 | Created by: Paulo Cortez (Univ. Minho), Antonio Cerdeira, Fernando Almeida, Telmo Matos and Jose Reis (CVRVV) @ 2009 17 | 18 | 3. Past Usage: 19 | 20 | P. Cortez, A. Cerdeira, F. Almeida, T. Matos and J. Reis. 21 | Modeling wine preferences by data mining from physicochemical properties. 22 | In Decision Support Systems, Elsevier, 47(4):547-553. ISSN: 0167-9236. 23 | 24 | In the above reference, two datasets were created, using red and white wine samples. 25 | The inputs include objective tests (e.g. PH values) and the output is based on sensory data 26 | (median of at least 3 evaluations made by wine experts). Each expert graded the wine quality 27 | between 0 (very bad) and 10 (very excellent). Several data mining methods were applied to model 28 | these datasets under a regression approach. The support vector machine model achieved the 29 | best results. Several metrics were computed: MAD, confusion matrix for a fixed error tolerance (T), 30 | etc. Also, we plot the relative importances of the input variables (as measured by a sensitivity 31 | analysis procedure). 32 | 33 | 4. Relevant Information: 34 | 35 | The two datasets are related to red and white variants of the Portuguese "Vinho Verde" wine. 36 | For more details, consult: http://www.vinhoverde.pt/en/ or the reference [Cortez et al., 2009]. 37 | Due to privacy and logistic issues, only physicochemical (inputs) and sensory (the output) variables 38 | are available (e.g. there is no data about grape types, wine brand, wine selling price, etc.). 39 | 40 | These datasets can be viewed as classification or regression tasks. 41 | The classes are ordered and not balanced (e.g. there are munch more normal wines than 42 | excellent or poor ones). Outlier detection algorithms could be used to detect the few excellent 43 | or poor wines. Also, we are not sure if all input variables are relevant. So 44 | it could be interesting to test feature selection methods. 45 | 46 | 5. Number of Instances: red wine - 1599; white wine - 4898. 47 | 48 | 6. Number of Attributes: 11 + output attribute 49 | 50 | Note: several of the attributes may be correlated, thus it makes sense to apply some sort of 51 | feature selection. 52 | 53 | 7. Attribute information: 54 | 55 | For more information, read [Cortez et al., 2009]. 56 | 57 | Input variables (based on physicochemical tests): 58 | 1 - fixed acidity 59 | 2 - volatile acidity 60 | 3 - citric acid 61 | 4 - residual sugar 62 | 5 - chlorides 63 | 6 - free sulfur dioxide 64 | 7 - total sulfur dioxide 65 | 8 - density 66 | 9 - pH 67 | 10 - sulphates 68 | 11 - alcohol 69 | Output variable (based on sensory data): 70 | 12 - quality (score between 0 and 10) 71 | 72 | 8. Missing Attribute Values: None 73 | -------------------------------------------------------------------------------- /docs/css/standard_html.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css?family=Roboto|Roboto+Mono|Roboto+Condensed"); 2 | @import url("https://fonts.googleapis.com/css?family=Open+Sans"); 3 | @import url('https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300'); 4 | @import url('https://fonts.googleapis.com/css?family=Source+Code+Pro'); 5 | @import url('https://fonts.googleapis.com/css?family=Stalemate|Alex+Brush'); 6 | 7 | 8 | .emph { 9 | color: #E32D00 ; /*#ff5500 #D14300*/ 10 | font-weight: 500; 11 | } 12 | 13 | /* pack func and objclass colors initially come from hcl(seq(90,360, length.out=4), c=80, l=80); redone for contrast*/ 14 | .pack { 15 | color: #990071; /*#AC9CFF #e41a1c*/ 16 | font-weight: 500; 17 | } 18 | 19 | .func { 20 | color: #007199; /*#00CBB6; #984ea3; can just use `` instead*/ 21 | font-weight: 500; 22 | } 23 | 24 | .objclass { 25 | color: #947100; /*#AAB400 #4daf4a; #FFC5D0*/ 26 | font-weight: 500; 27 | } 28 | 29 | a { 30 | color: #1e90ff; /*dodgerblue*/ 31 | } 32 | 33 | body { 34 | color: #585858; /*#595959 (i.e. gray35) provides recommended contrast ratio 7:1 on white; change 9s to 8s for offwhite;*/ 35 | background-color: #fffff8; 36 | } 37 | 38 | p { 39 | 40 | } 41 | 42 | .author { 43 | font-variant: small-caps; 44 | } 45 | 46 | code { 47 | box-sizing: border-box; 48 | left: 0; /* This changes where the code chunk box actually starts */ 49 | /* padding: 10px 0 10px 60px; /* Change the last value here to move the text left or right */ 50 | position: relative; 51 | width: 100%; /* This changes where the code chunk box ends on the right side */ 52 | font-family: 'Roboto Mono' 'Lucida Sans' Consolas monospace; 53 | font-size: 100%; /*changes output size; and comments*/ 54 | /*border: 10px solid #ff5500;*/ /*code block and results border*/ 55 | /*background-color:#ff5500;*/ /* results background*/ 56 | 57 | } 58 | pre .r { 59 | box-sizing: border-box; 60 | left: 0; /* This changes where the code chunk box actually starts */ 61 | /* padding: 10px 0 10px 60px; /* Change the last value here to move the text left or right */ 62 | position: relative; 63 | /*width: 100%; /* This changes where the code chunk box ends on the right side */ 64 | font-family: 'Roboto Mono' 'Lucida Sans' Consolas monospace; 65 | /*font-size: 100%; /*changes output size; and comments*/ 66 | /*border: 10px solid #ff5500;*/ /*code block and results border*/ 67 | /*background-color:#ff5500;*/ /* results background*/ 68 | 69 | } 70 | 71 | #TOC{ 72 | font-size: 75%; 73 | 74 | } 75 | 76 | .table { 77 | margin: 0 auto; 78 | } 79 | 80 | 81 | .tocify ul, .tocify li { 82 | list-style: none; 83 | margin: 0; 84 | padding: 0; 85 | border: none; 86 | width: 100%; 87 | line-height: 30px; 88 | background-color: #fffff9; 89 | } 90 | 91 | li.tocify-item.list-group-item.active { 92 | background-color: rgb(97,151,213); /* background of current section in toc */ 93 | } 94 | 95 | h1, h2, h3, h4, h5 { 96 | color:#990024; 97 | font-family: 'Roboto Condensed'; 98 | } 99 | 100 | .col2 { 101 | columns: 2 200px; /* number of columns and width in pixels*/ 102 | -webkit-columns: 2 200px; /* chrome, safari */ 103 | -moz-columns: 2 200px; /* firefox */ 104 | } 105 | .col3 { 106 | columns: 3 100px; 107 | -webkit-columns: 3 100px; 108 | -moz-columns: 3 100px; 109 | } 110 | 111 | .plotly { 112 | margin-left: 5%; 113 | margin-right: 5%; 114 | } 115 | 116 | /*.plotly html-widget { 117 | width: 100%; 118 | }*/ 119 | 120 | .d3heatmap { 121 | margin-left: 5%; 122 | margin-right: 5%; 123 | width: 75%; 124 | } 125 | 126 | 127 | div.datatables { 128 | margin-left: auto; /* to center them when full is not necessary. */ 129 | margin-right: auto; 130 | } 131 | 132 | table { 133 | margin: auto; 134 | } -------------------------------------------------------------------------------- /docs/img/198R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/198R.png -------------------------------------------------------------------------------- /docs/img/ARC-acronym-signature.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/ARC-acronym-signature.png -------------------------------------------------------------------------------- /docs/img/ARC_logos/ARC-acronym-signature.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/ARC_logos/ARC-acronym-signature.png -------------------------------------------------------------------------------- /docs/img/CSCAR_logos/signature-acronym.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/CSCAR_logos/signature-acronym.png -------------------------------------------------------------------------------- /docs/img/biasvartarget.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | X 15 | 16 | X 17 | 18 | X 19 | 20 | X 21 | 22 | X 23 | 24 | X 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | X 34 | 35 | X 36 | 37 | X 38 | 39 | X 40 | 41 | X 42 | 43 | X 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | X 54 | 55 | X 56 | 57 | X 58 | 59 | X 60 | 61 | X 62 | 63 | X 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | X 74 | 75 | X 76 | 77 | X 78 | 79 | X 80 | 81 | X 82 | 83 | X 84 | 85 | High Bias 86 | Low Bias 87 | High Variance 88 | Low Variance 89 | 90 | -------------------------------------------------------------------------------- /docs/img/ccbysa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/ccbysa.png -------------------------------------------------------------------------------- /docs/img/kfold.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | Train 9 | 10 | Test 11 | 12 | Train 13 | 14 | Test 15 | 16 | Train 17 | 18 | Train 19 | 20 | Train 21 | 22 | Train 23 | 24 | Test 25 | Partition 1 26 | Partition 3 27 | Partition 2 28 | Iteration 1 29 | Iteration 2 30 | Iteration 3 31 | 32 | -------------------------------------------------------------------------------- /docs/img/learningcurve.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 38 | 39 | 0.0 40 | 0.2 41 | 0.4 42 | 0.6 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 0 53 | 25 54 | 50 55 | 75 56 | 100 57 | Model Complexity Parameter 58 | Test Error 59 | 60 | -------------------------------------------------------------------------------- /docs/img/lossfuncs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/lossfuncs.png -------------------------------------------------------------------------------- /docs/img/lvmodel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/lvmodel.png -------------------------------------------------------------------------------- /docs/img/mc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/mc.png -------------------------------------------------------------------------------- /docs/img/mc_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/mc_logo.png -------------------------------------------------------------------------------- /docs/img/min_depth_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/min_depth_1.png -------------------------------------------------------------------------------- /docs/img/min_depth_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/min_depth_2.png -------------------------------------------------------------------------------- /docs/img/nineteeneightyR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/nineteeneightyR.png -------------------------------------------------------------------------------- /docs/img/nnet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/nnet.png -------------------------------------------------------------------------------- /docs/img/senate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/senate.png -------------------------------------------------------------------------------- /docs/img/signature-acronym.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/signature-acronym.png -------------------------------------------------------------------------------- /docs/img/svm3d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/svm3d.png -------------------------------------------------------------------------------- /docs/img/tree1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/tree1.png -------------------------------------------------------------------------------- /docs/img/tree2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/img/tree2.png -------------------------------------------------------------------------------- /docs/introduction-to-machine-learning_files/figure-html/regregvarimp-1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 0 36 | 25 37 | 50 38 | 75 39 | 100 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | citric.acid 55 | pH 56 | fixed.acidity 57 | residual.sugar 58 | total.sulfur.dioxide 59 | chlorides 60 | sulphates 61 | volatile.acidity 62 | alcohol 63 | Importance 64 | 65 | -------------------------------------------------------------------------------- /docs/libs/DiagrammeR-styles-0.2/styles.css: -------------------------------------------------------------------------------- 1 | .DiagrammeR,.grViz pre { 2 | white-space: pre-wrap; /* CSS 3 */ 3 | white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ 4 | white-space: -pre-wrap; /* Opera 4-6 */ 5 | white-space: -o-pre-wrap; /* Opera 7 */ 6 | word-wrap: break-word; /* Internet Explorer 5.5+ */ 7 | } 8 | 9 | .DiagrammeR g .label { 10 | font-family: Helvetica; 11 | font-size: 14px; 12 | color: #333333; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /docs/libs/crosstalk-1.0.0/css/crosstalk.css: -------------------------------------------------------------------------------- 1 | /* Adjust margins outwards, so column contents line up with the edges of the 2 | parent of container-fluid. */ 3 | .container-fluid.crosstalk-bscols { 4 | margin-left: -30px; 5 | margin-right: -30px; 6 | white-space: normal; 7 | } 8 | 9 | /* But don't adjust the margins outwards if we're directly under the body, 10 | i.e. we were the top-level of something at the console. */ 11 | body > .container-fluid.crosstalk-bscols { 12 | margin-left: auto; 13 | margin-right: auto; 14 | } 15 | 16 | .crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column { 17 | display: inline-block; 18 | padding-right: 12px; 19 | vertical-align: top; 20 | } 21 | 22 | @media only screen and (max-width:480px) { 23 | .crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column { 24 | display: block; 25 | padding-right: inherit; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /docs/libs/d3-tip-0.6.6/index.js: -------------------------------------------------------------------------------- 1 | // d3.tip 2 | // Copyright (c) 2013 Justin Palmer 3 | // 4 | // Tooltips for d3.js SVG visualizations 5 | 6 | (function (root, factory) { 7 | if (typeof define === 'function' && define.amd) { 8 | // AMD. Register as an anonymous module with d3 as a dependency. 9 | define(['d3'], factory) 10 | } else if (typeof module === 'object' && module.exports) { 11 | // CommonJS 12 | module.exports = function(d3) { 13 | d3.tip = factory(d3) 14 | return d3.tip 15 | } 16 | } else { 17 | // Browser global. 18 | root.d3.tip = factory(root.d3) 19 | } 20 | }(this, function (d3) { 21 | 22 | // Public - contructs a new tooltip 23 | // 24 | // Returns a tip 25 | return function() { 26 | var direction = d3_tip_direction, 27 | offset = d3_tip_offset, 28 | html = d3_tip_html, 29 | node = initNode(), 30 | svg = null, 31 | point = null, 32 | target = null 33 | 34 | function tip(vis) { 35 | svg = getSVGNode(vis) 36 | point = svg.createSVGPoint() 37 | document.body.appendChild(node) 38 | } 39 | 40 | // Public - show the tooltip on the screen 41 | // 42 | // Returns a tip 43 | tip.show = function() { 44 | var args = Array.prototype.slice.call(arguments) 45 | if(args[args.length - 1] instanceof SVGElement) target = args.pop() 46 | 47 | var content = html.apply(this, args), 48 | poffset = offset.apply(this, args), 49 | dir = direction.apply(this, args), 50 | nodel = d3.select(node), 51 | i = directions.length, 52 | coords, 53 | scrollTop = document.documentElement.scrollTop || document.body.scrollTop, 54 | scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft 55 | 56 | nodel.html(content) 57 | .style({ opacity: 1, 'pointer-events': 'all' }) 58 | 59 | while(i--) nodel.classed(directions[i], false) 60 | coords = direction_callbacks.get(dir).apply(this) 61 | nodel.classed(dir, true).style({ 62 | top: (coords.top + poffset[0]) + scrollTop + 'px', 63 | left: (coords.left + poffset[1]) + scrollLeft + 'px' 64 | }) 65 | 66 | return tip 67 | } 68 | 69 | // Public - hide the tooltip 70 | // 71 | // Returns a tip 72 | tip.hide = function() { 73 | var nodel = d3.select(node) 74 | nodel.style({ opacity: 0, 'pointer-events': 'none' }) 75 | return tip 76 | } 77 | 78 | // Public: Proxy attr calls to the d3 tip container. Sets or gets attribute value. 79 | // 80 | // n - name of the attribute 81 | // v - value of the attribute 82 | // 83 | // Returns tip or attribute value 84 | tip.attr = function(n, v) { 85 | if (arguments.length < 2 && typeof n === 'string') { 86 | return d3.select(node).attr(n) 87 | } else { 88 | var args = Array.prototype.slice.call(arguments) 89 | d3.selection.prototype.attr.apply(d3.select(node), args) 90 | } 91 | 92 | return tip 93 | } 94 | 95 | // Public: Proxy style calls to the d3 tip container. Sets or gets a style value. 96 | // 97 | // n - name of the property 98 | // v - value of the property 99 | // 100 | // Returns tip or style property value 101 | tip.style = function(n, v) { 102 | if (arguments.length < 2 && typeof n === 'string') { 103 | return d3.select(node).style(n) 104 | } else { 105 | var args = Array.prototype.slice.call(arguments) 106 | d3.selection.prototype.style.apply(d3.select(node), args) 107 | } 108 | 109 | return tip 110 | } 111 | 112 | // Public: Set or get the direction of the tooltip 113 | // 114 | // v - One of n(north), s(south), e(east), or w(west), nw(northwest), 115 | // sw(southwest), ne(northeast) or se(southeast) 116 | // 117 | // Returns tip or direction 118 | tip.direction = function(v) { 119 | if (!arguments.length) return direction 120 | direction = v == null ? v : d3.functor(v) 121 | 122 | return tip 123 | } 124 | 125 | // Public: Sets or gets the offset of the tip 126 | // 127 | // v - Array of [x, y] offset 128 | // 129 | // Returns offset or 130 | tip.offset = function(v) { 131 | if (!arguments.length) return offset 132 | offset = v == null ? v : d3.functor(v) 133 | 134 | return tip 135 | } 136 | 137 | // Public: sets or gets the html value of the tooltip 138 | // 139 | // v - String value of the tip 140 | // 141 | // Returns html value or tip 142 | tip.html = function(v) { 143 | if (!arguments.length) return html 144 | html = v == null ? v : d3.functor(v) 145 | 146 | return tip 147 | } 148 | 149 | function d3_tip_direction() { return 'n' } 150 | function d3_tip_offset() { return [0, 0] } 151 | function d3_tip_html() { return ' ' } 152 | 153 | var direction_callbacks = d3.map({ 154 | n: direction_n, 155 | s: direction_s, 156 | e: direction_e, 157 | w: direction_w, 158 | nw: direction_nw, 159 | ne: direction_ne, 160 | sw: direction_sw, 161 | se: direction_se 162 | }), 163 | 164 | directions = direction_callbacks.keys() 165 | 166 | function direction_n() { 167 | var bbox = getScreenBBox() 168 | return { 169 | top: bbox.n.y - node.offsetHeight, 170 | left: bbox.n.x - node.offsetWidth / 2 171 | } 172 | } 173 | 174 | function direction_s() { 175 | var bbox = getScreenBBox() 176 | return { 177 | top: bbox.s.y, 178 | left: bbox.s.x - node.offsetWidth / 2 179 | } 180 | } 181 | 182 | function direction_e() { 183 | var bbox = getScreenBBox() 184 | return { 185 | top: bbox.e.y - node.offsetHeight / 2, 186 | left: bbox.e.x 187 | } 188 | } 189 | 190 | function direction_w() { 191 | var bbox = getScreenBBox() 192 | return { 193 | top: bbox.w.y - node.offsetHeight / 2, 194 | left: bbox.w.x - node.offsetWidth 195 | } 196 | } 197 | 198 | function direction_nw() { 199 | var bbox = getScreenBBox() 200 | return { 201 | top: bbox.nw.y - node.offsetHeight, 202 | left: bbox.nw.x - node.offsetWidth 203 | } 204 | } 205 | 206 | function direction_ne() { 207 | var bbox = getScreenBBox() 208 | return { 209 | top: bbox.ne.y - node.offsetHeight, 210 | left: bbox.ne.x 211 | } 212 | } 213 | 214 | function direction_sw() { 215 | var bbox = getScreenBBox() 216 | return { 217 | top: bbox.sw.y, 218 | left: bbox.sw.x - node.offsetWidth 219 | } 220 | } 221 | 222 | function direction_se() { 223 | var bbox = getScreenBBox() 224 | return { 225 | top: bbox.se.y, 226 | left: bbox.e.x 227 | } 228 | } 229 | 230 | function initNode() { 231 | var node = d3.select(document.createElement('div')) 232 | node.style({ 233 | position: 'absolute', 234 | top: 0, 235 | opacity: 0, 236 | 'pointer-events': 'none', 237 | 'box-sizing': 'border-box' 238 | }) 239 | 240 | return node.node() 241 | } 242 | 243 | function getSVGNode(el) { 244 | el = el.node() 245 | if(el.tagName.toLowerCase() === 'svg') 246 | return el 247 | 248 | return el.ownerSVGElement 249 | } 250 | 251 | // Private - gets the screen coordinates of a shape 252 | // 253 | // Given a shape on the screen, will return an SVGPoint for the directions 254 | // n(north), s(south), e(east), w(west), ne(northeast), se(southeast), nw(northwest), 255 | // sw(southwest). 256 | // 257 | // +-+-+ 258 | // | | 259 | // + + 260 | // | | 261 | // +-+-+ 262 | // 263 | // Returns an Object {n, s, e, w, nw, sw, ne, se} 264 | function getScreenBBox() { 265 | var targetel = target || d3.event.target, 266 | bbox = {}, 267 | matrix = targetel.getScreenCTM(), 268 | tbbox = targetel.getBBox(), 269 | width = tbbox.width, 270 | height = tbbox.height, 271 | x = tbbox.x, 272 | y = tbbox.y 273 | 274 | point.x = x 275 | point.y = y 276 | bbox.nw = point.matrixTransform(matrix) 277 | point.x += width 278 | bbox.ne = point.matrixTransform(matrix) 279 | point.y += height 280 | bbox.se = point.matrixTransform(matrix) 281 | point.x -= width 282 | bbox.sw = point.matrixTransform(matrix) 283 | point.y -= height / 2 284 | bbox.w = point.matrixTransform(matrix) 285 | point.x += width 286 | bbox.e = point.matrixTransform(matrix) 287 | point.x -= width / 2 288 | point.y -= height / 2 289 | bbox.n = point.matrixTransform(matrix) 290 | point.y += height 291 | bbox.s = point.matrixTransform(matrix) 292 | 293 | return bbox 294 | } 295 | 296 | return tip 297 | }; 298 | 299 | })); 300 | -------------------------------------------------------------------------------- /docs/libs/d3heatmap-binding-0.6.1.1/d3heatmap.js: -------------------------------------------------------------------------------- 1 | HTMLWidgets.widget({ 2 | 3 | name: 'd3heatmap', 4 | 5 | type: 'output', 6 | 7 | initialize: function(el, width, height) { 8 | 9 | return { 10 | lastTheme: null, 11 | lastValue: null 12 | }; 13 | 14 | }, 15 | 16 | renderValue: function(el, x, instance) { 17 | this.doRenderValue(el, x, instance); 18 | }, 19 | 20 | // Need dedicated helper function that can be called by both renderValue 21 | // and resize. resize can't call this.renderValue because that will be 22 | // routed to the Shiny wrapper method from htmlwidgets, which expects the 23 | // wrapper data object, not x. 24 | doRenderValue: function(el, x, instance) { 25 | var self = this; 26 | 27 | instance.lastValue = x; 28 | 29 | if (instance.lastTheme && instance.lastTheme != x.theme) { 30 | d3.select(document.body).classed("theme-" + instance.lastTheme, false); 31 | } 32 | if (x.theme) { 33 | d3.select(document.body).classed("theme-" + x.theme, true); 34 | } 35 | 36 | el.innerHTML = ""; 37 | 38 | this.loadImage(x.image, function(imgData, w, h) { 39 | 40 | if (w !== x.matrix.dim[0] || h !== x.matrix.dim[1]) { 41 | throw new Error("Color dimensions didn't match data dimensions") 42 | } 43 | 44 | var merged = []; 45 | for (var i = 0; i < x.matrix.data.length; i++) { 46 | var r = imgData[i*4]; 47 | var g = imgData[i*4+1]; 48 | var b = imgData[i*4+2]; 49 | var a = imgData[i*4+3]; 50 | merged.push({ 51 | label: x.matrix.data[i], 52 | color: "rgba(" + [r,g,b,a/255].join(",") + ")" 53 | }) 54 | } 55 | x.matrix.merged = merged; 56 | //console.log(JSON.stringify({merged: x.matrix.merged}, null, " ")); 57 | 58 | var hm = heatmap(el, x, x.options); 59 | if (window.Shiny) { 60 | var id = self.getId(el); 61 | hm.on('hover', function(e) { 62 | Shiny.onInputChange(id + '_hover', !e.data ? e.data : { 63 | label: e.data.label, 64 | row: x.matrix.rows[e.data.row], 65 | col: x.matrix.cols[e.data.col] 66 | }); 67 | }); 68 | /* heatmap doesn't currently send click, since it means zoom-out 69 | hm.on('click', function(e) { 70 | Shiny.onInputChange(id + '_click', !e.data ? e.data : { 71 | label: e.data.label, 72 | row: e.data.row + 1, 73 | col: e.data.col + 1 74 | }); 75 | }); 76 | */ 77 | } 78 | }); 79 | }, 80 | 81 | resize: function(el, width, height, instance) { 82 | if (instance.lastValue) { 83 | this.doRenderValue(el, instance.lastValue, instance); 84 | } 85 | }, 86 | 87 | loadImage: function(uri, callback) { 88 | var img = new Image(); 89 | img.onload = function() { 90 | // Save size 91 | w = img.width; 92 | h = img.height; 93 | 94 | // Create a dummy canvas to extract the image data 95 | var imgDataCanvas = document.createElement("canvas"); 96 | imgDataCanvas.width = w; 97 | imgDataCanvas.height = h; 98 | imgDataCanvas.style.display = "none"; 99 | document.body.appendChild(imgDataCanvas); 100 | 101 | var imgDataCtx = imgDataCanvas.getContext("2d"); 102 | imgDataCtx.drawImage(img, 0, 0); 103 | 104 | // Save the image data. 105 | imgData = imgDataCtx.getImageData(0, 0, w, h).data; 106 | 107 | // Done with the canvas, remove it from the page so it can be gc'd. 108 | document.body.removeChild(imgDataCanvas); 109 | 110 | callback(imgData, w, h); 111 | }; 112 | img.src = uri; 113 | } 114 | 115 | }); 116 | -------------------------------------------------------------------------------- /docs/libs/d3heatmap-binding-0.6.1.2/d3heatmap.js: -------------------------------------------------------------------------------- 1 | HTMLWidgets.widget({ 2 | 3 | name: 'd3heatmap', 4 | 5 | type: 'output', 6 | 7 | initialize: function(el, width, height) { 8 | 9 | return { 10 | lastTheme: null, 11 | lastValue: null 12 | }; 13 | 14 | }, 15 | 16 | renderValue: function(el, x, instance) { 17 | this.doRenderValue(el, x, instance); 18 | }, 19 | 20 | // Need dedicated helper function that can be called by both renderValue 21 | // and resize. resize can't call this.renderValue because that will be 22 | // routed to the Shiny wrapper method from htmlwidgets, which expects the 23 | // wrapper data object, not x. 24 | doRenderValue: function(el, x, instance) { 25 | var self = this; 26 | 27 | instance.lastValue = x; 28 | 29 | if (instance.lastTheme && instance.lastTheme != x.theme) { 30 | d3.select(document.body).classed("theme-" + instance.lastTheme, false); 31 | } 32 | if (x.theme) { 33 | d3.select(document.body).classed("theme-" + x.theme, true); 34 | } 35 | 36 | el.innerHTML = ""; 37 | 38 | this.loadImage(x.image, function(imgData, w, h) { 39 | 40 | if (w !== x.matrix.dim[0] || h !== x.matrix.dim[1]) { 41 | throw new Error("Color dimensions didn't match data dimensions") 42 | } 43 | 44 | var merged = []; 45 | for (var i = 0; i < x.matrix.data.length; i++) { 46 | var r = imgData[i*4]; 47 | var g = imgData[i*4+1]; 48 | var b = imgData[i*4+2]; 49 | var a = imgData[i*4+3]; 50 | merged.push({ 51 | label: x.matrix.data[i], 52 | color: "rgba(" + [r,g,b,a/255].join(",") + ")" 53 | }) 54 | } 55 | x.matrix.merged = merged; 56 | //console.log(JSON.stringify({merged: x.matrix.merged}, null, " ")); 57 | 58 | var hm = heatmap(el, x, x.options); 59 | if (window.Shiny) { 60 | var id = self.getId(el); 61 | hm.on('hover', function(e) { 62 | Shiny.onInputChange(id + '_hover', !e.data ? e.data : { 63 | label: e.data.label, 64 | row: x.matrix.rows[e.data.row], 65 | col: x.matrix.cols[e.data.col] 66 | }); 67 | }); 68 | /* heatmap doesn't currently send click, since it means zoom-out 69 | hm.on('click', function(e) { 70 | Shiny.onInputChange(id + '_click', !e.data ? e.data : { 71 | label: e.data.label, 72 | row: e.data.row + 1, 73 | col: e.data.col + 1 74 | }); 75 | }); 76 | */ 77 | } 78 | }); 79 | }, 80 | 81 | resize: function(el, width, height, instance) { 82 | if (instance.lastValue) { 83 | this.doRenderValue(el, instance.lastValue, instance); 84 | } 85 | }, 86 | 87 | loadImage: function(uri, callback) { 88 | var img = new Image(); 89 | img.onload = function() { 90 | // Save size 91 | w = img.width; 92 | h = img.height; 93 | 94 | // Create a dummy canvas to extract the image data 95 | var imgDataCanvas = document.createElement("canvas"); 96 | imgDataCanvas.width = w; 97 | imgDataCanvas.height = h; 98 | imgDataCanvas.style.display = "none"; 99 | document.body.appendChild(imgDataCanvas); 100 | 101 | var imgDataCtx = imgDataCanvas.getContext("2d"); 102 | imgDataCtx.drawImage(img, 0, 0); 103 | 104 | // Save the image data. 105 | imgData = imgDataCtx.getImageData(0, 0, w, h).data; 106 | 107 | // Done with the canvas, remove it from the page so it can be gc'd. 108 | document.body.removeChild(imgDataCanvas); 109 | 110 | callback(imgData, w, h); 111 | }; 112 | img.src = uri; 113 | } 114 | 115 | }); 116 | -------------------------------------------------------------------------------- /docs/libs/d3heatmapcore-0.0.0/heatmapcore.css: -------------------------------------------------------------------------------- 1 | body.theme-dark { 2 | background-color: #333 !important; 3 | } 4 | 5 | .link { 6 | fill: none; 7 | } 8 | .theme-dark .link { 9 | } 10 | 11 | .d3heatmap { 12 | position: relative; 13 | width: 820px; 14 | height: 700px; 15 | overflow: hidden; 16 | } 17 | .d3heatmap .domain { 18 | fill: none; 19 | stroke: none; 20 | } 21 | .d3heatmap .axis { 22 | overflow: hidden; 23 | } 24 | .d3heatmap .axis line { 25 | fill: none; 26 | stroke: #AAA; 27 | stroke-width: 1px; 28 | shape-rendering: crispEdges; 29 | } 30 | .d3heatmap .axis text, .d3heatmap-tip { 31 | font-size: 15px; 32 | font-family: Ubuntu Sans, Segoe UI, Lucida Grande, sans-serif; 33 | } 34 | .d3heatmap .axis rect { 35 | cursor: pointer; 36 | } 37 | .inner { 38 | position: relative; 39 | } 40 | .info { 41 | position: absolute; 42 | left: 20px; 43 | top: 90px; 44 | width: 160px; 45 | height: 140px; 46 | text-align: right; 47 | font-size: 40px; 48 | padding-top: 118px; 49 | } 50 | .d3heatmap text { 51 | cursor: default; 52 | } 53 | .d3heatmap .brush .extent{ 54 | fill-opacity: 0.15; 55 | stroke-width: 1px; 56 | } 57 | .colDend { 58 | position: absolute; 59 | overflow: hidden; 60 | } 61 | .rowDend { 62 | position: absolute; 63 | overflow: hidden; 64 | } 65 | .colormap { 66 | position: absolute; 67 | overflow: hidden; 68 | } 69 | .theme-dark text { 70 | fill: #E2E2E2; 71 | } 72 | .highlighting .colormap .datapt { 73 | opacity: 0.2; 74 | } 75 | .highlighting .colormap .datapt.highlight { 76 | opacity: 1; 77 | } 78 | 79 | .highlighting .axis g.tick.faded { 80 | opacity: 0.4 !important; 81 | } 82 | 83 | .d3heatmap-tip { 84 | font-size: 13px; 85 | color: white; 86 | background-color: #444; 87 | padding: 6px 12px; 88 | box-shadow: 3px 3px 5px 0px rgba(0, 0, 0, 0.22); 89 | } 90 | .theme-dark .d3heatmap-tip { 91 | background-color: white; 92 | color: #444; 93 | } 94 | .d3heatmap-tip table { 95 | border-collapse: separate; 96 | border-spacing: 2px; 97 | } 98 | .d3heatmap-tip th, .d3heatmap-tip td { 99 | padding: 0 1px; 100 | } 101 | -------------------------------------------------------------------------------- /docs/libs/datatables-css-0.0.0/datatables-crosstalk.css: -------------------------------------------------------------------------------- 1 | .dt-crosstalk-fade { 2 | opacity: 0.2; 3 | } 4 | 5 | html body div.DTS div.dataTables_scrollBody { 6 | background: none; 7 | } 8 | -------------------------------------------------------------------------------- /docs/libs/dt-core-1.10.12/css/jquery.dataTables.extra.css: -------------------------------------------------------------------------------- 1 | /* Selected rows/cells */ 2 | table.dataTable tr.selected td, table.dataTable td.selected { 3 | background-color: #b0bed9 !important; 4 | } 5 | /* In case of scrollX/Y or FixedHeader */ 6 | .dataTables_scrollBody .dataTables_sizing { 7 | visibility: hidden; 8 | } 9 | -------------------------------------------------------------------------------- /docs/libs/dt-core-1.10.16/css/jquery.dataTables.extra.css: -------------------------------------------------------------------------------- 1 | /* Selected rows/cells */ 2 | table.dataTable tr.selected td, table.dataTable td.selected { 3 | background-color: #b0bed9 !important; 4 | } 5 | /* In case of scrollX/Y or FixedHeader */ 6 | .dataTables_scrollBody .dataTables_sizing { 7 | visibility: hidden; 8 | } 9 | -------------------------------------------------------------------------------- /docs/libs/gitbook-2.6.7/css/fontawesome/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-clark/introduction-to-machine-learning/632ccfd4bc061e011c7889dd03a714ca0892ebf8/docs/libs/gitbook-2.6.7/css/fontawesome/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /docs/libs/gitbook-2.6.7/css/plugin-bookdown.css: -------------------------------------------------------------------------------- 1 | .book .book-header h1 { 2 | padding-left: 20px; 3 | padding-right: 20px; 4 | } 5 | .book .book-header.fixed { 6 | position: fixed; 7 | right: 0; 8 | top: 0; 9 | left: 0; 10 | border-bottom: 1px solid rgba(0,0,0,.07); 11 | } 12 | span.search-highlight { 13 | background-color: #ffff88; 14 | } 15 | @media (min-width: 600px) { 16 | .book.with-summary .book-header.fixed { 17 | left: 300px; 18 | } 19 | } 20 | @media (max-width: 1240px) { 21 | .book .book-body.fixed { 22 | top: 50px; 23 | } 24 | .book .book-body.fixed .body-inner { 25 | top: auto; 26 | } 27 | } 28 | @media (max-width: 600px) { 29 | .book.with-summary .book-header.fixed { 30 | left: calc(100% - 60px); 31 | min-width: 300px; 32 | } 33 | .book.with-summary .book-body { 34 | transform: none; 35 | left: calc(100% - 60px); 36 | min-width: 300px; 37 | } 38 | .book .book-body.fixed { 39 | top: 0; 40 | } 41 | } 42 | 43 | .book .book-body.fixed .body-inner { 44 | top: 50px; 45 | } 46 | .book .book-body .page-wrapper .page-inner section.normal sub, .book .book-body .page-wrapper .page-inner section.normal sup { 47 | font-size: 85%; 48 | } 49 | 50 | @media print { 51 | .book .book-summary, .book .book-body .book-header, .fa { 52 | display: none !important; 53 | } 54 | .book .book-body.fixed { 55 | left: 0px; 56 | } 57 | .book .book-body,.book .book-body .body-inner, .book.with-summary { 58 | overflow: visible !important; 59 | } 60 | } 61 | .kable_wrapper { 62 | border-spacing: 20px 0; 63 | border-collapse: separate; 64 | border: none; 65 | margin: auto; 66 | } 67 | .kable_wrapper > tbody > tr > td { 68 | vertical-align: top; 69 | } 70 | .book .book-body .page-wrapper .page-inner section.normal table tr.header { 71 | border-top-width: 2px; 72 | } 73 | .book .book-body .page-wrapper .page-inner section.normal table tr:last-child td { 74 | border-bottom-width: 2px; 75 | } 76 | .book .book-body .page-wrapper .page-inner section.normal table td, .book .book-body .page-wrapper .page-inner section.normal table th { 77 | border-left: none; 78 | border-right: none; 79 | } 80 | .book .book-body .page-wrapper .page-inner section.normal table.kable_wrapper > tbody > tr, .book .book-body .page-wrapper .page-inner section.normal table.kable_wrapper > tbody > tr > td { 81 | border-top: none; 82 | } 83 | .book .book-body .page-wrapper .page-inner section.normal table.kable_wrapper > tbody > tr:last-child > td { 84 | border-bottom: none; 85 | } 86 | 87 | div.theorem, div.lemma, div.corollary, div.proposition, div.conjecture { 88 | font-style: italic; 89 | } 90 | span.theorem, span.lemma, span.corollary, span.proposition, span.conjecture { 91 | font-style: normal; 92 | } 93 | div.proof:after { 94 | content: "\25a2"; 95 | float: right; 96 | } 97 | .header-section-number { 98 | padding-right: .5em; 99 | } 100 | -------------------------------------------------------------------------------- /docs/libs/gitbook-2.6.7/css/plugin-fontsettings.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Theme 1 3 | */ 4 | .color-theme-1 .dropdown-menu { 5 | background-color: #111111; 6 | border-color: #7e888b; 7 | } 8 | .color-theme-1 .dropdown-menu .dropdown-caret .caret-inner { 9 | border-bottom: 9px solid #111111; 10 | } 11 | .color-theme-1 .dropdown-menu .buttons { 12 | border-color: #7e888b; 13 | } 14 | .color-theme-1 .dropdown-menu .button { 15 | color: #afa790; 16 | } 17 | .color-theme-1 .dropdown-menu .button:hover { 18 | color: #73553c; 19 | } 20 | /* 21 | * Theme 2 22 | */ 23 | .color-theme-2 .dropdown-menu { 24 | background-color: #2d3143; 25 | border-color: #272a3a; 26 | } 27 | .color-theme-2 .dropdown-menu .dropdown-caret .caret-inner { 28 | border-bottom: 9px solid #2d3143; 29 | } 30 | .color-theme-2 .dropdown-menu .buttons { 31 | border-color: #272a3a; 32 | } 33 | .color-theme-2 .dropdown-menu .button { 34 | color: #62677f; 35 | } 36 | .color-theme-2 .dropdown-menu .button:hover { 37 | color: #f4f4f5; 38 | } 39 | .book .book-header .font-settings .font-enlarge { 40 | line-height: 30px; 41 | font-size: 1.4em; 42 | } 43 | .book .book-header .font-settings .font-reduce { 44 | line-height: 30px; 45 | font-size: 1em; 46 | } 47 | .book.color-theme-1 .book-body { 48 | color: #704214; 49 | background: #f3eacb; 50 | } 51 | .book.color-theme-1 .book-body .page-wrapper .page-inner section { 52 | background: #f3eacb; 53 | } 54 | .book.color-theme-2 .book-body { 55 | color: #bdcadb; 56 | background: #1c1f2b; 57 | } 58 | .book.color-theme-2 .book-body .page-wrapper .page-inner section { 59 | background: #1c1f2b; 60 | } 61 | .book.font-size-0 .book-body .page-inner section { 62 | font-size: 1.2rem; 63 | } 64 | .book.font-size-1 .book-body .page-inner section { 65 | font-size: 1.4rem; 66 | } 67 | .book.font-size-2 .book-body .page-inner section { 68 | font-size: 1.6rem; 69 | } 70 | .book.font-size-3 .book-body .page-inner section { 71 | font-size: 2.2rem; 72 | } 73 | .book.font-size-4 .book-body .page-inner section { 74 | font-size: 4rem; 75 | } 76 | .book.font-family-0 { 77 | font-family: Georgia, serif; 78 | } 79 | .book.font-family-1 { 80 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 81 | } 82 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal { 83 | color: #704214; 84 | } 85 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal a { 86 | color: inherit; 87 | } 88 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1, 89 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2, 90 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h3, 91 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h4, 92 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h5, 93 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 { 94 | color: inherit; 95 | } 96 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1, 97 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2 { 98 | border-color: inherit; 99 | } 100 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 { 101 | color: inherit; 102 | } 103 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal hr { 104 | background-color: inherit; 105 | } 106 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal blockquote { 107 | border-color: #c4b29f; 108 | opacity: 0.9; 109 | } 110 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre, 111 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code { 112 | background: #fdf6e3; 113 | color: #657b83; 114 | border-color: #f8df9c; 115 | } 116 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal .highlight { 117 | background-color: inherit; 118 | } 119 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table th, 120 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table td { 121 | border-color: #f5d06c; 122 | } 123 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr { 124 | color: inherit; 125 | background-color: #fdf6e3; 126 | border-color: #444444; 127 | } 128 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) { 129 | background-color: #fbeecb; 130 | } 131 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal { 132 | color: #bdcadb; 133 | } 134 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal a { 135 | color: #3eb1d0; 136 | } 137 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1, 138 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2, 139 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h3, 140 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h4, 141 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h5, 142 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 { 143 | color: #fffffa; 144 | } 145 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1, 146 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2 { 147 | border-color: #373b4e; 148 | } 149 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 { 150 | color: #373b4e; 151 | } 152 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal hr { 153 | background-color: #373b4e; 154 | } 155 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal blockquote { 156 | border-color: #373b4e; 157 | } 158 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre, 159 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code { 160 | color: #9dbed8; 161 | background: #2d3143; 162 | border-color: #2d3143; 163 | } 164 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal .highlight { 165 | background-color: #282a39; 166 | } 167 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table th, 168 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table td { 169 | border-color: #3b3f54; 170 | } 171 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr { 172 | color: #b6c2d2; 173 | background-color: #2d3143; 174 | border-color: #3b3f54; 175 | } 176 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) { 177 | background-color: #35394b; 178 | } 179 | .book.color-theme-1 .book-header { 180 | color: #afa790; 181 | background: transparent; 182 | } 183 | .book.color-theme-1 .book-header .btn { 184 | color: #afa790; 185 | } 186 | .book.color-theme-1 .book-header .btn:hover { 187 | color: #73553c; 188 | background: none; 189 | } 190 | .book.color-theme-1 .book-header h1 { 191 | color: #704214; 192 | } 193 | .book.color-theme-2 .book-header { 194 | color: #7e888b; 195 | background: transparent; 196 | } 197 | .book.color-theme-2 .book-header .btn { 198 | color: #3b3f54; 199 | } 200 | .book.color-theme-2 .book-header .btn:hover { 201 | color: #fffff5; 202 | background: none; 203 | } 204 | .book.color-theme-2 .book-header h1 { 205 | color: #bdcadb; 206 | } 207 | .book.color-theme-1 .book-body .navigation { 208 | color: #afa790; 209 | } 210 | .book.color-theme-1 .book-body .navigation:hover { 211 | color: #73553c; 212 | } 213 | .book.color-theme-2 .book-body .navigation { 214 | color: #383f52; 215 | } 216 | .book.color-theme-2 .book-body .navigation:hover { 217 | color: #fffff5; 218 | } 219 | /* 220 | * Theme 1 221 | */ 222 | .book.color-theme-1 .book-summary { 223 | color: #afa790; 224 | background: #111111; 225 | border-right: 1px solid rgba(0, 0, 0, 0.07); 226 | } 227 | .book.color-theme-1 .book-summary .book-search { 228 | background: transparent; 229 | } 230 | .book.color-theme-1 .book-summary .book-search input, 231 | .book.color-theme-1 .book-summary .book-search input:focus { 232 | border: 1px solid transparent; 233 | } 234 | .book.color-theme-1 .book-summary ul.summary li.divider { 235 | background: #7e888b; 236 | box-shadow: none; 237 | } 238 | .book.color-theme-1 .book-summary ul.summary li i.fa-check { 239 | color: #33cc33; 240 | } 241 | .book.color-theme-1 .book-summary ul.summary li.done > a { 242 | color: #877f6a; 243 | } 244 | .book.color-theme-1 .book-summary ul.summary li a, 245 | .book.color-theme-1 .book-summary ul.summary li span { 246 | color: #877f6a; 247 | background: transparent; 248 | font-weight: normal; 249 | } 250 | .book.color-theme-1 .book-summary ul.summary li.active > a, 251 | .book.color-theme-1 .book-summary ul.summary li a:hover { 252 | color: #704214; 253 | background: transparent; 254 | font-weight: normal; 255 | } 256 | /* 257 | * Theme 2 258 | */ 259 | .book.color-theme-2 .book-summary { 260 | color: #bcc1d2; 261 | background: #2d3143; 262 | border-right: none; 263 | } 264 | .book.color-theme-2 .book-summary .book-search { 265 | background: transparent; 266 | } 267 | .book.color-theme-2 .book-summary .book-search input, 268 | .book.color-theme-2 .book-summary .book-search input:focus { 269 | border: 1px solid transparent; 270 | } 271 | .book.color-theme-2 .book-summary ul.summary li.divider { 272 | background: #272a3a; 273 | box-shadow: none; 274 | } 275 | .book.color-theme-2 .book-summary ul.summary li i.fa-check { 276 | color: #33cc33; 277 | } 278 | .book.color-theme-2 .book-summary ul.summary li.done > a { 279 | color: #62687f; 280 | } 281 | .book.color-theme-2 .book-summary ul.summary li a, 282 | .book.color-theme-2 .book-summary ul.summary li span { 283 | color: #c1c6d7; 284 | background: transparent; 285 | font-weight: 600; 286 | } 287 | .book.color-theme-2 .book-summary ul.summary li.active > a, 288 | .book.color-theme-2 .book-summary ul.summary li a:hover { 289 | color: #f4f4f5; 290 | background: #252737; 291 | font-weight: 600; 292 | } 293 | -------------------------------------------------------------------------------- /docs/libs/gitbook-2.6.7/css/plugin-search.css: -------------------------------------------------------------------------------- 1 | .book .book-summary .book-search { 2 | padding: 6px; 3 | background: transparent; 4 | position: absolute; 5 | top: -50px; 6 | left: 0px; 7 | right: 0px; 8 | transition: top 0.5s ease; 9 | } 10 | .book .book-summary .book-search input, 11 | .book .book-summary .book-search input:focus, 12 | .book .book-summary .book-search input:hover { 13 | width: 100%; 14 | background: transparent; 15 | border: 1px solid #ccc; 16 | box-shadow: none; 17 | outline: none; 18 | line-height: 22px; 19 | padding: 7px 4px; 20 | color: inherit; 21 | box-sizing: border-box; 22 | } 23 | .book.with-search .book-summary .book-search { 24 | top: 0px; 25 | } 26 | .book.with-search .book-summary ul.summary { 27 | top: 50px; 28 | } 29 | -------------------------------------------------------------------------------- /docs/libs/gitbook-2.6.7/css/plugin-table.css: -------------------------------------------------------------------------------- 1 | .book .book-body .page-wrapper .page-inner section.normal table{display:table;width:100%;border-collapse:collapse;border-spacing:0;overflow:auto}.book .book-body .page-wrapper .page-inner section.normal table td,.book .book-body .page-wrapper .page-inner section.normal table th{padding:6px 13px;border:1px solid #ddd}.book .book-body .page-wrapper .page-inner section.normal table tr{background-color:#fff;border-top:1px solid #ccc}.book .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n){background-color:#f8f8f8}.book .book-body .page-wrapper .page-inner section.normal table th{font-weight:700} 2 | -------------------------------------------------------------------------------- /docs/libs/gitbook-2.6.7/js/jquery.highlight.js: -------------------------------------------------------------------------------- 1 | gitbook.require(["jQuery"], function(jQuery) { 2 | 3 | /* 4 | * jQuery Highlight plugin 5 | * 6 | * Based on highlight v3 by Johann Burkard 7 | * http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html 8 | * 9 | * Code a little bit refactored and cleaned (in my humble opinion). 10 | * Most important changes: 11 | * - has an option to highlight only entire words (wordsOnly - false by default), 12 | * - has an option to be case sensitive (caseSensitive - false by default) 13 | * - highlight element tag and class names can be specified in options 14 | * 15 | * Copyright (c) 2009 Bartek Szopka 16 | * 17 | * Licensed under MIT license. 18 | * 19 | */ 20 | 21 | jQuery.extend({ 22 | highlight: function (node, re, nodeName, className) { 23 | if (node.nodeType === 3) { 24 | var match = node.data.match(re); 25 | if (match) { 26 | var highlight = document.createElement(nodeName || 'span'); 27 | highlight.className = className || 'highlight'; 28 | var wordNode = node.splitText(match.index); 29 | wordNode.splitText(match[0].length); 30 | var wordClone = wordNode.cloneNode(true); 31 | highlight.appendChild(wordClone); 32 | wordNode.parentNode.replaceChild(highlight, wordNode); 33 | return 1; //skip added node in parent 34 | } 35 | } else if ((node.nodeType === 1 && node.childNodes) && // only element nodes that have children 36 | !/(script|style)/i.test(node.tagName) && // ignore script and style nodes 37 | !(node.tagName === nodeName.toUpperCase() && node.className === className)) { // skip if already highlighted 38 | for (var i = 0; i < node.childNodes.length; i++) { 39 | i += jQuery.highlight(node.childNodes[i], re, nodeName, className); 40 | } 41 | } 42 | return 0; 43 | } 44 | }); 45 | 46 | jQuery.fn.unhighlight = function (options) { 47 | var settings = { className: 'highlight', element: 'span' }; 48 | jQuery.extend(settings, options); 49 | 50 | return this.find(settings.element + "." + settings.className).each(function () { 51 | var parent = this.parentNode; 52 | parent.replaceChild(this.firstChild, this); 53 | parent.normalize(); 54 | }).end(); 55 | }; 56 | 57 | jQuery.fn.highlight = function (words, options) { 58 | var settings = { className: 'highlight', element: 'span', caseSensitive: false, wordsOnly: false }; 59 | jQuery.extend(settings, options); 60 | 61 | if (words.constructor === String) { 62 | words = [words]; 63 | } 64 | words = jQuery.grep(words, function(word, i){ 65 | return word !== ''; 66 | }); 67 | words = jQuery.map(words, function(word, i) { 68 | return word.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); 69 | }); 70 | if (words.length === 0) { return this; } 71 | 72 | var flag = settings.caseSensitive ? "" : "i"; 73 | var pattern = "(" + words.join("|") + ")"; 74 | if (settings.wordsOnly) { 75 | pattern = "\\b" + pattern + "\\b"; 76 | } 77 | var re = new RegExp(pattern, flag); 78 | 79 | return this.each(function () { 80 | jQuery.highlight(this, re, settings.element, settings.className); 81 | }); 82 | }; 83 | 84 | }); 85 | -------------------------------------------------------------------------------- /docs/libs/gitbook-2.6.7/js/plugin-bookdown.js: -------------------------------------------------------------------------------- 1 | gitbook.require(["gitbook", "lodash", "jQuery"], function(gitbook, _, $) { 2 | 3 | var gs = gitbook.storage; 4 | 5 | gitbook.events.bind("start", function(e, config) { 6 | 7 | // add the Edit button (edit on Github) 8 | var edit = config.edit; 9 | if (edit && edit.link) gitbook.toolbar.createButton({ 10 | icon: 'fa fa-edit', 11 | label: edit.text || 'Edit', 12 | position: 'left', 13 | onClick: function(e) { 14 | e.preventDefault(); 15 | window.open(edit.link); 16 | } 17 | }); 18 | 19 | // add the History button (file history on Github) 20 | var history = config.history; 21 | if (history && history.link) gitbook.toolbar.createButton({ 22 | icon: 'fa fa-history', 23 | label: history.text || 'History', 24 | position: 'left', 25 | onClick: function(e) { 26 | e.preventDefault(); 27 | window.open(history.link); 28 | } 29 | }); 30 | 31 | var down = config.download; 32 | var normalizeDownload = function() { 33 | if (!down || !(down instanceof Array) || down.length === 0) return; 34 | if (down[0] instanceof Array) return down; 35 | return $.map(down, function(file, i) { 36 | return [[file, file.replace(/.*[.]/g, '').toUpperCase()]]; 37 | }); 38 | }; 39 | down = normalizeDownload(down); 40 | if (down) if (down.length === 1 && /[.]pdf$/.test(down[0][0])) { 41 | gitbook.toolbar.createButton({ 42 | icon: 'fa fa-file-pdf-o', 43 | label: down[0][1], 44 | position: 'left', 45 | onClick: function(e) { 46 | e.preventDefault(); 47 | window.open(down[0][0]); 48 | } 49 | }); 50 | } else { 51 | gitbook.toolbar.createButton({ 52 | icon: 'fa fa-download', 53 | label: 'Download', 54 | position: 'left', 55 | dropdown: $.map(down, function(item, i) { 56 | return { 57 | text: item[1], 58 | onClick: function(e) { 59 | e.preventDefault(); 60 | window.open(item[0]); 61 | } 62 | }; 63 | }) 64 | }); 65 | } 66 | 67 | // highlight the current section in TOC 68 | var href = window.location.pathname; 69 | href = href.substr(href.lastIndexOf('/') + 1); 70 | if (href === '') href = 'index.html'; 71 | var li = $('a[href^="' + href + location.hash + '"]').parent('li.chapter').first(); 72 | var summary = $('ul.summary'), chaps = summary.find('li.chapter'); 73 | if (li.length === 0) li = chaps.first(); 74 | li.addClass('active'); 75 | chaps.on('click', function(e) { 76 | chaps.removeClass('active'); 77 | $(this).addClass('active'); 78 | gs.set('tocScrollTop', summary.scrollTop()); 79 | }); 80 | 81 | var toc = config.toc; 82 | // collapse TOC items that are not for the current chapter 83 | if (toc && toc.collapse) (function() { 84 | var type = toc.collapse; 85 | if (type === 'none') return; 86 | if (type !== 'section' && type !== 'subsection') return; 87 | // sections under chapters 88 | var toc_sub = summary.children('li[data-level]').children('ul'); 89 | if (type === 'section') { 90 | toc_sub.hide() 91 | .parent().has(li).children('ul').show(); 92 | } else { 93 | toc_sub.children('li').children('ul').hide() 94 | .parent().has(li).children('ul').show(); 95 | } 96 | li.children('ul').show(); 97 | var toc_sub2 = toc_sub.children('li'); 98 | if (type === 'section') toc_sub2.children('ul').hide(); 99 | summary.children('li[data-level]').find('a') 100 | .on('click.bookdown', function(e) { 101 | if (href === $(this).attr('href').replace(/#.*/, '')) 102 | $(this).parent('li').children('ul').toggle(); 103 | }); 104 | })(); 105 | 106 | // add tooltips to the 's that are truncated 107 | $('a').each(function(i, el) { 108 | if (el.offsetWidth >= el.scrollWidth) return; 109 | if (typeof el.title === 'undefined') return; 110 | el.title = el.text; 111 | }); 112 | 113 | // restore TOC scroll position 114 | var pos = gs.get('tocScrollTop'); 115 | if (typeof pos !== 'undefined') summary.scrollTop(pos); 116 | 117 | // highlight the TOC item that has same text as the heading in view as scrolling 118 | if (toc && toc.scroll_highlight !== false) (function() { 119 | // scroll the current TOC item into viewport 120 | var ht = $(window).height(), rect = li[0].getBoundingClientRect(); 121 | if (rect.top >= ht || rect.top <= 0 || rect.bottom <= 0) { 122 | summary.scrollTop(li[0].offsetTop); 123 | } 124 | // current chapter TOC items 125 | var items = $('a[href^="' + href + '"]').parent('li.chapter'), 126 | m = items.length; 127 | if (m === 0) { 128 | items = summary.find('li.chapter'); 129 | m = items.length; 130 | } 131 | if (m === 0) return; 132 | // all section titles on current page 133 | var hs = bookInner.find('.page-inner').find('h1,h2,h3'), n = hs.length, 134 | ts = hs.map(function(i, el) { return $(el).text(); }); 135 | if (n === 0) return; 136 | var scrollHandler = function(e) { 137 | var ht = $(window).height(); 138 | clearTimeout($.data(this, 'scrollTimer')); 139 | $.data(this, 'scrollTimer', setTimeout(function() { 140 | // find the first visible title in the viewport 141 | for (var i = 0; i < n; i++) { 142 | var rect = hs[i].getBoundingClientRect(); 143 | if (rect.top >= 0 && rect.bottom <= ht) break; 144 | } 145 | if (i === n) return; 146 | items.removeClass('active'); 147 | for (var j = 0; j < m; j++) { 148 | if (items.eq(j).children('a').first().text() === ts[i]) break; 149 | } 150 | if (j === m) j = 0; // highlight the chapter title 151 | // search bottom-up for a visible TOC item to highlight; if an item is 152 | // hidden, we check if its parent is visible, and so on 153 | while (j > 0 && items.eq(j).is(':hidden')) j--; 154 | items.eq(j).addClass('active'); 155 | }, 250)); 156 | }; 157 | bookInner.on('scroll.bookdown', scrollHandler); 158 | bookBody.on('scroll.bookdown', scrollHandler); 159 | })(); 160 | 161 | // do not refresh the page if the TOC item points to the current page 162 | $('a[href="' + href + '"]').parent('li.chapter').children('a') 163 | .on('click', function(e) { 164 | bookInner.scrollTop(0); 165 | bookBody.scrollTop(0); 166 | return false; 167 | }); 168 | 169 | var toolbar = config.toolbar; 170 | if (!toolbar || toolbar.position !== 'static') { 171 | var bookHeader = $('.book-header'); 172 | bookBody.addClass('fixed'); 173 | bookHeader.addClass('fixed') 174 | .css('background-color', bookBody.css('background-color')) 175 | .on('click.bookdown', function(e) { 176 | // the theme may have changed after user clicks the theme button 177 | bookHeader.css('background-color', bookBody.css('background-color')); 178 | }); 179 | } 180 | 181 | }); 182 | 183 | gitbook.events.bind("page.change", function(e) { 184 | // store TOC scroll position 185 | var summary = $('ul.summary'); 186 | gs.set('tocScrollTop', summary.scrollTop()); 187 | }); 188 | 189 | var bookBody = $('.book-body'), bookInner = bookBody.find('.body-inner'); 190 | var chapterTitle = function() { 191 | return bookInner.find('.page-inner').find('h1,h2').first().text(); 192 | }; 193 | var bookTitle = function() { 194 | return bookInner.find('.book-header > h1').first().text(); 195 | }; 196 | var saveScrollPos = function(e) { 197 | // save scroll position before page is reloaded 198 | gs.set('bodyScrollTop', { 199 | body: bookBody.scrollTop(), 200 | inner: bookInner.scrollTop(), 201 | focused: document.hasFocus(), 202 | title: chapterTitle() 203 | }); 204 | }; 205 | $(document).on('servr:reload', saveScrollPos); 206 | 207 | // check if the page is loaded in an iframe (e.g. the RStudio preview window) 208 | var inIFrame = function() { 209 | var inIframe = true; 210 | try { inIframe = window.self !== window.top; } catch (e) {} 211 | return inIframe; 212 | }; 213 | $(window).on('blur unload', function(e) { 214 | if (inIFrame()) saveScrollPos(e); 215 | gs.set('bookTitle', bookTitle()); 216 | }); 217 | 218 | $(function(e) { 219 | if (gs.get('bookTitle', '') !== bookTitle()) localStorage.clear(); 220 | var pos = gs.get('bodyScrollTop'); 221 | if (pos) { 222 | if (pos.title === chapterTitle()) { 223 | if (pos.body !== 0) bookBody.scrollTop(pos.body); 224 | if (pos.inner !== 0) bookInner.scrollTop(pos.inner); 225 | } 226 | if (pos.focused) bookInner.find('.page-wrapper').focus(); 227 | } 228 | // clear book body scroll position 229 | gs.remove('bodyScrollTop'); 230 | }); 231 | 232 | }); 233 | -------------------------------------------------------------------------------- /docs/libs/gitbook-2.6.7/js/plugin-fontsettings.js: -------------------------------------------------------------------------------- 1 | gitbook.require(["gitbook", "lodash", "jQuery"], function(gitbook, _, $) { 2 | var fontState; 3 | 4 | var THEMES = { 5 | "white": 0, 6 | "sepia": 1, 7 | "night": 2 8 | }; 9 | 10 | var FAMILY = { 11 | "serif": 0, 12 | "sans": 1 13 | }; 14 | 15 | // Save current font settings 16 | function saveFontSettings() { 17 | gitbook.storage.set("fontState", fontState); 18 | update(); 19 | } 20 | 21 | // Increase font size 22 | function enlargeFontSize(e) { 23 | e.preventDefault(); 24 | if (fontState.size >= 4) return; 25 | 26 | fontState.size++; 27 | saveFontSettings(); 28 | }; 29 | 30 | // Decrease font size 31 | function reduceFontSize(e) { 32 | e.preventDefault(); 33 | if (fontState.size <= 0) return; 34 | 35 | fontState.size--; 36 | saveFontSettings(); 37 | }; 38 | 39 | // Change font family 40 | function changeFontFamily(index, e) { 41 | e.preventDefault(); 42 | 43 | fontState.family = index; 44 | saveFontSettings(); 45 | }; 46 | 47 | // Change type of color 48 | function changeColorTheme(index, e) { 49 | e.preventDefault(); 50 | 51 | var $book = $(".book"); 52 | 53 | if (fontState.theme !== 0) 54 | $book.removeClass("color-theme-"+fontState.theme); 55 | 56 | fontState.theme = index; 57 | if (fontState.theme !== 0) 58 | $book.addClass("color-theme-"+fontState.theme); 59 | 60 | saveFontSettings(); 61 | }; 62 | 63 | function update() { 64 | var $book = gitbook.state.$book; 65 | 66 | $(".font-settings .font-family-list li").removeClass("active"); 67 | $(".font-settings .font-family-list li:nth-child("+(fontState.family+1)+")").addClass("active"); 68 | 69 | $book[0].className = $book[0].className.replace(/\bfont-\S+/g, ''); 70 | $book.addClass("font-size-"+fontState.size); 71 | $book.addClass("font-family-"+fontState.family); 72 | 73 | if(fontState.theme !== 0) { 74 | $book[0].className = $book[0].className.replace(/\bcolor-theme-\S+/g, ''); 75 | $book.addClass("color-theme-"+fontState.theme); 76 | } 77 | }; 78 | 79 | function init(config) { 80 | var $bookBody, $book; 81 | 82 | //Find DOM elements. 83 | $book = gitbook.state.$book; 84 | $bookBody = $book.find(".book-body"); 85 | 86 | // Instantiate font state object 87 | fontState = gitbook.storage.get("fontState", { 88 | size: config.size || 2, 89 | family: FAMILY[config.family || "sans"], 90 | theme: THEMES[config.theme || "white"] 91 | }); 92 | 93 | update(); 94 | }; 95 | 96 | 97 | gitbook.events.bind("start", function(e, config) { 98 | var opts = config.fontsettings; 99 | 100 | // Create buttons in toolbar 101 | gitbook.toolbar.createButton({ 102 | icon: 'fa fa-font', 103 | label: 'Font Settings', 104 | className: 'font-settings', 105 | dropdown: [ 106 | [ 107 | { 108 | text: 'A', 109 | className: 'font-reduce', 110 | onClick: reduceFontSize 111 | }, 112 | { 113 | text: 'A', 114 | className: 'font-enlarge', 115 | onClick: enlargeFontSize 116 | } 117 | ], 118 | [ 119 | { 120 | text: 'Serif', 121 | onClick: _.partial(changeFontFamily, 0) 122 | }, 123 | { 124 | text: 'Sans', 125 | onClick: _.partial(changeFontFamily, 1) 126 | } 127 | ], 128 | [ 129 | { 130 | text: 'White', 131 | onClick: _.partial(changeColorTheme, 0) 132 | }, 133 | { 134 | text: 'Sepia', 135 | onClick: _.partial(changeColorTheme, 1) 136 | }, 137 | { 138 | text: 'Night', 139 | onClick: _.partial(changeColorTheme, 2) 140 | } 141 | ] 142 | ] 143 | }); 144 | 145 | 146 | // Init current settings 147 | init(opts); 148 | }); 149 | }); 150 | 151 | 152 | -------------------------------------------------------------------------------- /docs/libs/gitbook-2.6.7/js/plugin-search.js: -------------------------------------------------------------------------------- 1 | gitbook.require(["gitbook", "lodash", "jQuery"], function(gitbook, _, $) { 2 | var index = null; 3 | var $searchInput, $searchLabel, $searchForm; 4 | var $highlighted, hi = 0, hiOpts = { className: 'search-highlight' }; 5 | var collapse = false; 6 | 7 | // Use a specific index 8 | function loadIndex(data) { 9 | // [Yihui] In bookdown, I use a character matrix to store the chapter 10 | // content, and the index is dynamically built on the client side. 11 | // Gitbook prebuilds the index data instead: https://github.com/GitbookIO/plugin-search 12 | // We can certainly do that via R packages V8 and jsonlite, but let's 13 | // see how slow it really is before improving it. On the other hand, 14 | // lunr cannot handle non-English text very well, e.g. the default 15 | // tokenizer cannot deal with Chinese text, so we may want to replace 16 | // lunr with a dumb simple text matching approach. 17 | index = lunr(function () { 18 | this.ref('url'); 19 | this.field('title', { boost: 10 }); 20 | this.field('body'); 21 | }); 22 | data.map(function(item) { 23 | index.add({ 24 | url: item[0], 25 | title: item[1], 26 | body: item[2] 27 | }); 28 | }); 29 | } 30 | 31 | // Fetch the search index 32 | function fetchIndex() { 33 | return $.getJSON(gitbook.state.basePath+"/search_index.json") 34 | .then(loadIndex); // [Yihui] we need to use this object later 35 | } 36 | 37 | // Search for a term and return results 38 | function search(q) { 39 | if (!index) return; 40 | 41 | var results = _.chain(index.search(q)) 42 | .map(function(result) { 43 | var parts = result.ref.split("#"); 44 | return { 45 | path: parts[0], 46 | hash: parts[1] 47 | }; 48 | }) 49 | .value(); 50 | 51 | // [Yihui] Highlight the search keyword on current page 52 | hi = 0; 53 | $highlighted = results.length === 0 ? undefined : $('.page-inner') 54 | .unhighlight(hiOpts).highlight(q, hiOpts).find('span.search-highlight'); 55 | scrollToHighlighted(); 56 | toggleTOC(results.length > 0); 57 | 58 | return results; 59 | } 60 | 61 | // [Yihui] Scroll the chapter body to the i-th highlighted string 62 | function scrollToHighlighted() { 63 | if (!$highlighted) return; 64 | var n = $highlighted.length; 65 | if (n === 0) return; 66 | var $p = $highlighted.eq(hi), p = $p[0], rect = p.getBoundingClientRect(); 67 | if (rect.top < 0 || rect.bottom > $(window).height()) { 68 | ($(window).width() >= 1240 ? $('.body-inner') : $('.book-body')) 69 | .scrollTop(p.offsetTop - 100); 70 | } 71 | $highlighted.css('background-color', ''); 72 | // an orange background color on the current item and removed later 73 | $p.css('background-color', 'orange'); 74 | setTimeout(function() { 75 | $p.css('background-color', ''); 76 | }, 2000); 77 | } 78 | 79 | // [Yihui] Expand/collapse TOC 80 | function toggleTOC(show) { 81 | if (!collapse) return; 82 | var toc_sub = $('ul.summary').children('li[data-level]').children('ul'); 83 | if (show) return toc_sub.show(); 84 | var href = window.location.pathname; 85 | href = href.substr(href.lastIndexOf('/') + 1); 86 | if (href === '') href = 'index.html'; 87 | var li = $('a[href^="' + href + location.hash + '"]').parent('li.chapter').first(); 88 | toc_sub.hide().parent().has(li).children('ul').show(); 89 | li.children('ul').show(); 90 | } 91 | 92 | // Create search form 93 | function createForm(value) { 94 | if ($searchForm) $searchForm.remove(); 95 | if ($searchLabel) $searchLabel.remove(); 96 | if ($searchInput) $searchInput.remove(); 97 | 98 | $searchForm = $('
    ', { 99 | 'class': 'book-search', 100 | 'role': 'search' 101 | }); 102 | 103 | $searchLabel = $('