Practical Data Science¶

この授業は、2021年に新設したもので、講義担当者にとっては実験的なものを含みます。提案、質問は歓迎します。

This lecture has newly opened in 2021. It includes some experimental contents and so, feel free to ask questions.

昨年、英語のみで履修する学生の履修希望があり、授業資料の最初の方は、和英両方で記述してあります。

On the course of preparation (in the first year 2021), I found web browsers can translate the page well. If you prefer to studying this course in English, please use the function of translation in the web browsers.

Preparation to test examples and work on exercises¶

Installing a development environment for python and its libraries for data analysis¶

演習は、pythonの開発環境のひとつであるjupyter notebookを利用するので、各自のコンピュータに利用環境を整備してください。

Samples written by python will be given in this class. So, you need to install python interpreter, its libraries, and the development environment "Jupyter Notebook". If you cannot do it, please take the class in the computer room No.2 or No. 3 at "Multimedia Hall".

インストール方法はWeb上にたくさんあるが

https://ai-inter1.com/jupyter-notebook/

あたりが簡単で良いと思う。

An instruction is given in the above URL.

可視化、機械学習、数値計算などライブラリが充実し多くのユーザがいるPythonの開発環境Anaconda (https://www.anaconda.com/) のインストールを推奨します。

(注) Windowsでのユーザ名(正確にはホームフォルダの名前)が日本語だとインストールがうまくいきません。その場合は他のフォルダへインストールしてください。

A well-known package Anadonda is strongly recommended.

alternative environments for learning¶

できない人は、

  • この授業用の情報処理教室(第2実習室か第3実習室)で行ってください。
  • あるいは、Googleの"Colab notebooks"を使って実習することもできます。今年度はこれも推奨します。https://colab.research.google.com/notebooks/intro.ipynb

moodle page¶

  • この講義のmoodleページは (Lecture notes and sample codes are given in this page and the moodle site:)

    https://moodle.yamanashi.ac.jp/2023/course/view.php?id=1975

    です。このページとmoodleのページを行ったり来たりしますので、両方をWebブラウザの別タブか別ウィンドウで開いておくのが便利でしょう。

Contents¶

第1週¶

  • Introduction: Data Science in Natural Science and Engineering https://bdpserv.yamanashi.ac.jp/~toyoki/lectures/PracDataSci/introduction2PracDataSci.html

    • 自然科学、自然科学を基礎とした工学とデータサイエンスの対象、対象へのアプローチの仕方を対比的に述べる。
  • Elements of python : pythonの基本 (if you have already learned python, you can skip this)

    • 今年は、プレ授業で話したので、省略する。各自、必要に応じて自習してほしい。
    • プレ授業のビデオは閲覧できるようにしてある。
    • 使用したテキストについてはmoodleのページに書いてある(東大情報教育センターが作成したもの)。
  • 図示ライブラリ matplotlib の簡単な利用例

  • For reference: 数値計算、データ処理向けライブラリnumpyの利用 授業では話さないが参考ページを紹介しておく

    • http://www.turbare.net/transl/scipy-lecture-notes/intro/numpy/index.html
    • こちらの解説の方が簡単かも https://qiita.com/wellflat/items/284ecc4116208d155e01
    • 補足:巨大な行列などの繰り返し計算をforやwhile文で行うと多大な時間がかかる。そのような計算はnumpyなどのメソッドに任せるのがよい。高速化についての補足 (Tips for speedup)

Exercise 1¶

For beginners at python¶

  • python利用環境 (Jupyter Notebookあるいはcolab)のセット
  • 上記、「pythonの基本」などを自分のJupyter Notebookで実行するとともに、行ったことのメモをMarkdown形式で書き込む

For students with some skills in using python¶

  • matplotlibの簡単な利用例を実行してみる
  • サンプルとして利用したい各自の2次元データがあればそれを読み込んで図示するプログラムを用意する。

For students who use python almost everyday¶

  • Prepare sample numerical data from your everyday work
  • Try to use "ipywidgets" (inline GUI) in 図示ライブラリ matplotlib の簡単な利用例 and make a note on ipywidgets.
  • Make some useful tips on your Jupyter and python development environment and show us them.

第2週¶

https://bdpserv.yamanashi.ac.jp/~toyoki/lectures/PracDataSci/function_fitting.html (Exercise 2 is included.)

  • Polynomial Curve Fitting

    • minimizing root-mean-square (RMS) error
    • overfitting
  • Multiple linear regression

    • An example: Boston data https://bdpserv.yamanashi.ac.jp/~toyoki/lectures/PracDataSci/multiple_regression.html
    • to learn the relation between "nonlinear simple regression" and "multiple linear regression" and its generalization

第3週¶

  • regularization (methods to avoid over-fitting)

    • ridge and Lasso regressions

      https://bdpserv.yamanashi.ac.jp/~toyoki/lectures/PracDataSci/function_fitting2.html (incl. Exercise 3)

  • treating outliers (Huber regression example in the following site is included the above.)

    https://scikit-learn.org/stable/auto_examples/linear_model/plot_huber_vs_ridge.html#sphx-glr-auto-examples-linear-model-plot-huber-vs-ridge-py

  • common cases in experiments and estimation of errors

    https://bdpserv.yamanashi.ac.jp/~toyoki/lectures/PracDataSci/function_fitting3.html

第4週¶

Bayes statistics

https://bdpserv.yamanashi.ac.jp/~toyoki/lectures/PracDataSci/BayesApproach.html (incl. Exercise 4)

https://bdpserv.yamanashi.ac.jp/~toyoki/lectures/PracDataSci/prml3.3.html

第5週¶

Support Vector Machine and its application to regression problems

https://bdpserv.yamanashi.ac.jp/~toyoki/lectures/PracDataSci/svc_svm_in_scikit-learn.html (incl. Exercise 5)

Supplement:

  • on SVM and Kernel method https://bdpserv.yamanashi.ac.jp/~toyoki/lectures/PracDataSci/svc_note.html
  • mathematical note on SVR (based on PRML) https://bdpserv.yamanashi.ac.jp/~toyoki/lectures/PracDataSci/svr_note.html

第6週¶

Neural Network and Random Forest methods in regressions

https://bdpserv.yamanashi.ac.jp/~toyoki/lectures/PracDataSci/other_ML_methods.html

第7週¶

  • Logistic Regression In the case where the range of target values is limited, its probability distribution is not Gaussian. We will see "Logistic Regression" as an example.
  • Mixture of Linear Regression Models

第8週¶

  • Effective Preprocessing (Standardization, Principal Component Analysis, etc.)
  • Summary and integrated exercise https://bdpserv.yamanashi.ac.jp/~toyoki/lectures/PracDataSci/summary.html
  • questionnaire on this lecture
In [2]:
%%html
<link rel="stylesheet" type="text/css" href="custom.css">