diff --git a/doc/Programs/JupyterFiles/Examples/.DS_Store b/doc/Programs/JupyterFiles/Examples/.DS_Store new file mode 100644 index 000000000..5008ddfcf Binary files /dev/null and b/doc/Programs/JupyterFiles/Examples/.DS_Store differ diff --git a/doc/Projects/2020/Project1/.DS_Store b/doc/Projects/2020/Project1/.DS_Store new file mode 100644 index 000000000..0bdffe6df Binary files /dev/null and b/doc/Projects/2020/Project1/.DS_Store differ diff --git a/doc/src/Projects/2020/Project3/Project2.do.txt b/doc/src/Projects/2020/Project3/Project2.do.txt new file mode 100644 index 000000000..bfc55d13f --- /dev/null +++ b/doc/src/Projects/2020/Project3/Project2.do.txt @@ -0,0 +1,255 @@ +TITLE: Project 2 on Machine Learning, deadline November 13 (Midnight) +AUTHOR: "Data Analysis and Machine Learning FYS-STK3155/FYS4155":"http://www.uio.no/studier/emner/matnat/fys/FYS3155/index-eng.html" {copyright, 1999-present|CC BY-NC} at Department of Physics, University of Oslo, Norway +DATE: today + + +===== Classification and Regression, from linear and logistic regression to neural networks ===== + +The main aim of this project is to study both classification and +regression problems by developing our own feed-forward neural network (FFNN) code. We can reuse the regression algorithms studied +in project 1. We will also include logistic regression for classification +problems and write our own FFNN code for studying +both regression and classification problems. The codes developed in +project 1, including bootstrap and/or cross-validation as well as the +computation of the mean-squared error and/or the $R2$ or the accuracy score (classification problems) functions can +also be utilized in the present analysis. + + +The data sets that we propose here are (the default sets) + +* Regression (fitting a continuous function). In this part you will need to bring back your results from project 1 and compare these with what you get from your Neural Network code to be developed here. The data sets could be + o Either the Franke function or the terrain data from project 1, or data sets your propose. +* Classification. Here you will also need to develop a Logistic regression code that you will use to compare with the Neural Network code. The data set we propose are the so-called "MNIST":"https://en.wikipedia.org/wiki/MNIST_database" data set of images representing hand-written numbers from zero to nine. These are discussed intensively in the lecture notes on neural networks, see for example the slides from "week 41":"https://compphysics.github.io/MachineLearning/doc/pub/week41/html/week41.html" + +However, if you would like to study other data sets, feel free to +propose other sets. What we listed here are mere suggestions from our +side. If you opt for another data set, consider using a set which +has been studied in the scientific literature. This makes it easier +for you to compare and analyze your results. Comparing with existing results from the scientific literature is also an essential +element of the scientific discussion. + +In particular, when developing your own Neural Network and Logistic Regression codes for classification problems, the so-called Wisconsin Cancer data (which is a binary problem, benign or malignant tumors) may be studied. You can find more information about this at the "Scikit-Learn site":"https://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_breast_cancer.html" or at the "University of California at Irvine":"https://archive.ics.uci.edu/ml/datasets/breast+cancer+wisconsin+(original)". + +We will start with a regression problem and we will reuse our codes from project 1 starting with writing our own Stochastic Gradient Descent (SGD) code. + +=== Part a): Write your own Stochastic Gradient Descent code, first step === + +In order to get started, we will now replace in our standard ordinary +least squares (OLS) and Ridge regression codes (from project 1) the matrix inversion +algorithm with our own SGD code. You can choose whether you want to +add the momentum SGD optionality or other SGD variants such as RMSprop +or ADAgrad. The lecture notes from "week 40 contain more +details":"https://compphysics.github.io/MachineLearning/doc/pub/week40/html/week40.html" + +Perform an analysis of the results for OLS and Ridge regression as +function of the chosen learning rates, the number of mini-batches and +epochs as well as algorithm for scaling the learning rate. You can +also compare your own results with those that can be obtained using +for example _Scikit-Learn_'s various SGD options. Discuss your +results. For Ridge regression you need now to study the results as functions of the hyper-parameter $\lambda$ and +the learning rate $\gamma$. Discuss your results. + +You will need your SGD code for the setup of the Neural Network and Logistic Regression codes. + +=== Part b): Writing your own Neural Network code === + +Your aim now, and this is the central part of this project, is to +write your own Feed Forward Neural Network code implementing the back +propagation algorithm discussed in the lecture slides from "week 41":"https://compphysics.github.io/MachineLearning/doc/pub/week41/html/week41.html". + +We will focus on a regression problem first and study either the +Franke function or terrain data (or both or other data sets) from +project 1. Discuss again your choice of cost function. + +Write an FFNN code for regression with a flexible number of hidden +layers and nodes using the Sigmoid function as activation function for +the hidden layers. Initialize the weights using a normal +distribution. How would you initialize the biases? And which +activation function would you select for the final output layer? + +Train your network and compare the results with those from your OLS and Ridge Regression codes from project 1. +You should test your results against a similar code using _Scikit-Learn_ (see the examples in the above lecture notes from week 41) or _tensorflow/keras_. + +Comment your results and give a critical discussion of the results +obtained with the Linear Regression code and your own Neural Network +code. Compare the results with those from project 1. +Make an analysis of the regularization parameters and the learning rates employed to find the optimal MSE and $R2$ scores. + +A useful reference on the back progagation algorithm is "Nielsen's +book":"http://neuralnetworksanddeeplearning.com/". It is an excellent +read. + + + +=== Part c): Testing different activation functions === + +You should now also test different activation functions for the hidden layers. Try out the Sigmoid, the RELU and the Leaky RELU functions and discuss your results. You may also study the way you initialize your weights and biases. + +=== Part d): Classification analysis using neural networks === + + + +With a well-written code it should now be easy to change the +activation function for the output layer. + +Here we will change the cost function for our neural network code +developed in parts b) and c) in order to perform a classification analysis. + +We will here study the MNIST data set of hand-written numbers as +discussed in the lecture notes from "week +41":"https://compphysics.github.io/MachineLearning/doc/pub/week41/html/week41.html". Use +the _Softmax_ function as activation function. Your code should +however also be able to use a binary activation function as well. + +To measure the performance of our classification problem we use the +so-called *accuracy* score. The accuracy is as you would expect just +the number of correctly guessed targets $t_i$ divided by the total +number of targets, that is + + +!bt +\[ +\text{Accuracy} = \frac{\sum_{i=1}^n I(t_i = y_i)}{n} , +\] +!et + +where $I$ is the indicator function, $1$ if $t_i = y_i$ and $0$ +otherwise if we have a binary classification problem. Here $t_i$ +represents the target and $y_i$ the outputs of your FFNN code and $n$ is simply the number of targets $t_i$. + +Discuss your results and give a critical analysis of the various parameters, including hyper-parameters like the learning rates and the regularization parameter $\lambda$ (as you did in Ridge Regression), various activation functions, number of hidden layers and nodes and activation functions. + + +As stated in the introduction, it can also be useful to study other +datasets. In particular, the so-called Wisconsin Cancer +data (which is a binary problem, benign or malignant tumors) may be +studied. You find more information about this at the "Scikit-Learn +site":"https://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_breast_cancer.html" or at the "University of California +at Irvine":"https://archive.ics.uci.edu/ml/datasets/breast+cancer+wisconsin+(original)". + + + + +Again, we strongly recommend that you compare your own neural Network +code for classification and pertinent results against a similar code using _Scikit-Learn_ or _tensorflow/keras_ or _pytorch_. + + + + + +=== Part e): Write your Logistic Regression code, final step === + +Finally, we want to compare the FFNN code we have developed with +Logistic regression, that is we wish to compare our neural network +classification results with the results we can obtain with another +method. + +Define your cost function and the design matrix before you start writing your code. +Write thereafter a Logistic regression code using your SGD algorithm. Study the results as functions of the chosen learning rates. +Add also an $l_2$ regularization parameter $\lambda$. Compare your results with those from your FFNN code as well as those obtained using _Scikit-Learn_'s logistic regression functionality. + +The weblink here URL:"https://medium.com/ai-in-plain-english/comparison-between-logistic-regression-and-neural-networks-in-classifying-digits-dc5e85cd93c3"compares logistic regression and FFNN using the MNIST data set. You may find several useful hints and ideas from this article. + + +=== Part f) Critical evaluation of the various algorithms === + +After all these glorious calculations, you should now summarize the +various algorithms and come with a critical evaluation of their pros +and cons. Which algorithm works best for the regression case and which +is best for the classification case. These codes can also be part of +your final project 3, but now applied to other data sets. + + + + +===== Background literature ===== + +o The text of Michael Nielsen is highly recommended, see "Nielsen's book":"http://neuralnetworksanddeeplearning.com/". It is an excellent read. + +o The textbook of "Trevor Hastie, Robert Tibshirani, Jerome H. Friedman, The Elements of Statistical Learning, Springer":"https://www.springer.com/gp/book/9780387848570", chapters 3 and 7 are the most relevant ones for the analysis here. + +o "Mehta et al, arXiv 1803.08823":"https://arxiv.org/abs/1803.08823", *A high-bias, low-variance introduction to Machine Learning for physicists*, ArXiv:1803.08823. + + + + +===== Introduction to numerical projects ===== + +Here follows a brief recipe and recommendation on how to write a report for each +project. + + * Give a short description of the nature of the problem and the eventual numerical methods you have used. + + * Describe the algorithm you have used and/or developed. Here you may find it convenient to use pseudocoding. In many cases you can describe the algorithm in the program itself. + + * Include the source code of your program. Comment your program properly. + + * If possible, try to find analytic solutions, or known limits in order to test your program when developing the code. + + * Include your results either in figure form or in a table. Remember to label your results. All tables and figures should have relevant captions and labels on the axes. + + * Try to evaluate the reliabilty and numerical stability/precision of your results. If possible, include a qualitative and/or quantitative discussion of the numerical stability, eventual loss of precision etc. + + * Try to give an interpretation of you results in your answers to the problems. + + * Critique: if possible include your comments and reflections about the exercise, whether you felt you learnt something, ideas for improvements and other thoughts you've made when solving the exercise. We wish to keep this course at the interactive level and your comments can help us improve it. + + * Try to establish a practice where you log your work at the computerlab. You may find such a logbook very handy at later stages in your work, especially when you don't properly remember what a previous test version of your program did. Here you could also record the time spent on solving the exercise, various algorithms you may have tested or other topics which you feel worthy of mentioning. + + + + + + +===== Format for electronic delivery of report and programs ===== + +The preferred format for the report is a PDF file. You can also use DOC or postscript formats or as an ipython notebook file. As programming language we prefer that you choose between C/C++, Fortran2008 or Python. The following prescription should be followed when preparing the report: + + * Use Canvas to hand in your projects, log in at URL:"https://www.uio.no/english/services/it/education/canvas/" with your normal UiO username and password. + + * Upload _only_ the report file or the link to your GitHub/GitLab or similar typo of repos! For the source code file(s) you have developed please provide us with your link to your GitHub/GitLab or similar domain. The report file should include all of your discussions and a list of the codes you have developed. Do not include library files which are available at the course homepage, unless you have made specific changes to them. + + * In your GitHub/GitLab or similar repository, please include a folder which contains selected results. These can be in the form of output from your code for a selected set of runs and input parameters. + + +Finally, +we encourage you to collaborate. Optimal working groups consist of +2-3 students. You can then hand in a common report. + + + +===== Software and needed installations ===== + +If you have Python installed (we recommend Python3) and you feel pretty familiar with installing different packages, +we recommend that you install the following Python packages via _pip_ as +o pip install numpy scipy matplotlib ipython scikit-learn tensorflow sympy pandas pillow +For Python3, replace _pip_ with _pip3_. + +See below for a discussion of _tensorflow_ and _scikit-learn_. + +For OSX users we recommend also, after having installed Xcode, to install _brew_. Brew allows +for a seamless installation of additional software via for example +o brew install python3 + +For Linux users, with its variety of distributions like for example the widely popular Ubuntu distribution +you can use _pip_ as well and simply install Python as +o sudo apt-get install python3 (or python for python2.7) +etc etc. + +If you don't want to install various Python packages with their dependencies separately, we recommend two widely used distrubutions which set up all relevant dependencies for Python, namely +o "Anaconda":"https://docs.anaconda.com/" Anaconda is an open source distribution of the Python and R programming languages for large-scale data processing, predictive analytics, and scientific computing, that aims to simplify package management and deployment. Package versions are managed by the package management system _conda_ +o "Enthought canopy":"https://www.enthought.com/product/canopy/" is a Python distribution for scientific and analytic computing distribution and analysis environment, available for free and under a commercial license. + +Popular software packages written in Python for ML are + +* "Scikit-learn":"http://scikit-learn.org/stable/", +* "Tensorflow":"https://www.tensorflow.org/", +* "PyTorch":"http://pytorch.org/" and +* "Keras":"https://keras.io/". +These are all freely available at their respective GitHub sites. They +encompass communities of developers in the thousands or more. And the number +of code developers and contributors keeps increasing. + + + + diff --git a/doc/src/Projects/2020/Project3/Project3.do.txt b/doc/src/Projects/2020/Project3/Project3.do.txt new file mode 100644 index 000000000..da45b94b9 --- /dev/null +++ b/doc/src/Projects/2020/Project3/Project3.do.txt @@ -0,0 +1,278 @@ +TITLE: Project 3 on Machine Learning, deadline December 14 +AUTHOR: "Data Analysis and Machine Learning FYS-STK3155/FYS4155":"http://www.uio.no/studier/emner/matnat/fys/FYS3155/index-eng.html" {copyright, 1999-present|CC BY-NC} at Department of Physics, University of Oslo, Norway +DATE: today + + +======= Paths for project 3 ======= + +===== Defining the data sets to analyze yourself ===== + +For project 3, you can propose own data sets that relate to your research interests or just use existing data sets from say +o "Kaggle":"https://www.kaggle.com/datasets" +o The "University of California at Irvine (UCI) with its machine learning repository":"http://archive.ics.uci.edu/ml/datasets.html" + +The approach to the analysis of these new data sets should follow to a large extent what you did in projects 1 and 2. That is: +o Whether you end up with a regression or a classification problem, you should employ at least two of the methods we have discussed among _linear regression (including Ridge and Lasso)_, _Logistic Regression_, _Neural Networks_, _Convolution Neural Networks_, _Recurrent Neural Networks_, _Support Vector Machines_ and _Decision Trees, Random Forests_, _Bagging and Boosting_. You could for example explore all of the approaches from decision trees, via bagging and voting classifiers, to random forests, boosting and finally XGboost. If you wish to venture into _convolutional neural networks_ or _recurrent neural networks_, or extensions of neural networkds, feel free to do so. + +For Boosting, feel also free to write your own codes. + +o For project 3, you should feel free to use your own codes from projects 1 and 2, eventually write your own for SVMs and/or Decision trees/random forests/bagging/boosting' or use the available functionality of _Scikit-Learn_, _Tensorflow_, etc. + +o The estimates you used and tested in projects 1 and 2 should also be included, that is the $R2$-score, _MSE_, confusion matrix, accuracy score, information gain, ROC and Cumulative gains curves and other, cross-validation and/or bootstrap if these are relevant. + +o Similarly, feel free to explore various activations functions in deep learning and various approachs to stochastic gradient descent approaches. + +o If possible, you should link the data sets with exisiting research and analyses thereof. Scientific articles which have used Machine Learning algorithms to analyze the data are highly welcome. Perhaps you can improve previous analyses and even publish a new article? + +o A critical assessment of the methods with ditto perspectives and recommendations is also something you need to include. + +All in all, the report should follow the same pattern as the two previous ones, with abstract, introduction, methods, code, results, conclusions etc.. + +We propose also an alternative to the above. This is a project on using machine learning methods (neural networks mainly) to the solution of ordinary differential equations and partial differential equations, with a final twist on how to diagonalize a symmetric matrix with neural networks.. + +This is a field with a large interest recently, spanning from studies of turbulence in fluid mechanics and meteorology to the solution of quantum mechanical systems. As reading background you can use the slides "from week 43":"https://compphysics.github.io/MachineLearning/doc/pub/week43/html/week43.html" and/or the textbook by "Yadav et al":"https://www.springer.com/gp/book/9789401798150". + +===== The basic structure of your project ===== + +Here follows a set up on how to structure your report and analyze the data you have opted for. + +=== Part a) === + +The first part deals with structuring and reading the data, much along the same lines as done in projects 1 and 2. Explain how the data are produced and place them in a proper context. + +=== Part b) === + +You need to include at least two central algorithms, or as an alternative explore methods from decisions tree to bagging, random forests and boosting. Explain the basics of the methods you have chosen to work with. This would be your theory part. + + +=== Part c) === + +Then describe your algorithm and its implementation and tests you have performed. + +=== Part d) === + +Then presents your results and findings, link with existing literature and more. + +=== Part e) === + +Finally, here you should present a critical assessment of the methods you have studied and link your results with the existing literature. + +===== Solving partial differential equations with neural networks ===== + +For this variant of project 3, we will assume that you have some +background in the solution of partial differential equations using +finite difference schemes. We will study the solution of the diffusion +equation in one dimension using a standard explicit scheme and neural +networks to solve the same equations. + +For the explicit scheme, you can study for example chapter 10 of the lecture notes in "Computational Physics":"https://github.com/CompPhysics/ComputationalPhysics/blob/master/doc/Lectures/lectures2015.pdf" or alternative sources. For the solution of ordinary and partial differential equations using neural networks, the lectures by "Kristine Baluka Hein":"https://compphysics.github.io/MachineLearning/doc/pub/odenn/html/odenn-bs.html" at this course are highly recommended. + +For the machine learning part you can use your own code from project 2 or the functionality of for example _Tensorflow/Keras_.. + +=== Part a), setting up the problem === + +The physical problem can be that of the temperature gradient in a rod of length $L=1$ at $x=0$ and $x=1$. +We are looking at a one-dimensional +problem + +!bt +\begin{equation*} + \frac{\partial^2 u(x,t)}{\partial x^2} =\frac{\partial u(x,t)}{\partial t}, t> 0, x\in [0,L] +\end{equation*} +!et +or + +!bt +\begin{equation*} +u_{xx} = u_t, +\end{equation*} +!et +with initial conditions, i.e., the conditions at $t=0$, +!bt +\begin{equation*} +u(x,0)= \sin{(\pi x)} \hspace{0.5cm} 0 < x < L, +\end{equation*} +!et +with $L=1$ the length of the $x$-region of interest. The +boundary conditions are + +!bt +\begin{equation*} +u(0,t)= 0 \hspace{0.5cm} t \ge 0, +\end{equation*} +!et +and + +!bt +\begin{equation*} +u(L,t)= 0 \hspace{0.5cm} t \ge 0. +\end{equation*} +!et +The function $u(x,t)$ can be the temperature gradient of a rod. +As time increases, the velocity approaches a linear variation with $x$. + +We will limit ourselves to the so-called explicit forward Euler algorithm with discretized versions of time given by a forward formula and a centered difference in space resulting in +!bt +\begin{equation*} +u_t\approx \frac{u(x,t+\Delta t)-u(x,t)}{\Delta t}=\frac{u(x_i,t_j+\Delta t)-u(x_i,t_j)}{\Delta t} +\end{equation*} +!et +and + +!bt +\begin{equation*} +u_{xx}\approx \frac{u(x+\Delta x,t)-2u(x,t)+u(x-\Delta x,t)}{\Delta x^2}, +\end{equation*} +!et +or + +!bt +\begin{equation*} +u_{xx}\approx \frac{u(x_i+\Delta x,t_j)-2u(x_i,t_j)+u(x_i-\Delta x,t_j)}{\Delta x^2}. +\end{equation*} +!et + +Write down the algorithm and the equations you need to implement. +Find also the analytical solution to the problem. + +=== Part b) === + +Implement the explicit scheme algorithm and perform tests of the solution +for $\Delta x=1/10$, $\Delta x=1/100$ using $\Delta t$ as dictated by the stability limit of the explicit scheme. The stability criterion for the explicit scheme requires that $\Delta t/\Delta x^2 \leq 1/2$. + +Study the solutions at two time points $t_1$ and $t_2$ where $u(x,t_1)$ is smooth but still significantly curved +and $u(x,t_2)$ is almost linear, close to the stationary state. + + +=== Part c) Neural networks === + +Study now the lecture notes on solving ODEs and PDEs with neural +network and use either your own code from project 2 or the +functionality of tensorflow/keras to solve the same equation as in +part b). Discuss your results and compare them with the standard +explicit scheme. Include also the analytical solution and compare with +that. + + +=== Part d) Solving eigenvalue problems === + +Follow the discussion in the work of Yi *et al.* in the article from +"Computers and Mathematics with Applications 47, 1155 (2004)":"https://www.sciencedirect.com/science/article/pii/S0898122104901101", and +use your differential equation solver with neural networks, set up a +simple square, real and symmetric $6\times 6$ matrix and find the +eigenvalues. Compare with the solution from numerical diagonalization with standard eigenvalue solvers from linear algebra. + +=== Part e) === + +Finally, present a critical assessment of the methods you have studied and discuss the potential for the solving differential equations and eigenvalue problems with machine learning methods. + + +===== Introduction to numerical projects ===== + +Here follows a brief recipe and recommendation on how to write a report for each +project. + + * Give a short description of the nature of the problem and the eventual numerical methods you have used. + + * Describe the algorithm you have used and/or developed. Here you may find it convenient to use pseudocoding. In many cases you can describe the algorithm in the program itself. + + * Include the source code of your program. Comment your program properly. + + * If possible, try to find analytic solutions, or known limits in order to test your program when developing the code. + + * Include your results either in figure form or in a table. Remember to label your results. All tables and figures should have relevant captions and labels on the axes. + + * Try to evaluate the reliabilty and numerical stability/precision of your results. If possible, include a qualitative and/or quantitative discussion of the numerical stability, eventual loss of precision etc. + + * Try to give an interpretation of you results in your answers to the problems. + + * Critique: if possible include your comments and reflections about the exercise, whether you felt you learnt something, ideas for improvements and other thoughts you've made when solving the exercise. We wish to keep this course at the interactive level and your comments can help us improve it. + + * Try to establish a practice where you log your work at the computerlab. You may find such a logbook very handy at later stages in your work, especially when you don't properly remember what a previous test version of your program did. Here you could also record the time spent on solving the exercise, various algorithms you may have tested or other topics which you feel worthy of mentioning. + + + + + + + +===== Introduction to numerical projects ===== + +Here follows a brief recipe and recommendation on how to write a report for each +project. + + * Give a short description of the nature of the problem and the eventual numerical methods you have used. + + * Describe the algorithm you have used and/or developed. Here you may find it convenient to use pseudocoding. In many cases you can describe the algorithm in the program itself. + + * Include the source code of your program. Comment your program properly. + + * If possible, try to find analytic solutions, or known limits in order to test your program when developing the code. + + * Include your results either in figure form or in a table. Remember to label your results. All tables and figures should have relevant captions and labels on the axes. + + * Try to evaluate the reliabilty and numerical stability/precision of your results. If possible, include a qualitative and/or quantitative discussion of the numerical stability, eventual loss of precision etc. + + * Try to give an interpretation of you results in your answers to the problems. + + * Critique: if possible include your comments and reflections about the exercise, whether you felt you learnt something, ideas for improvements and other thoughts you've made when solving the exercise. We wish to keep this course at the interactive level and your comments can help us improve it. + + * Try to establish a practice where you log your work at the computerlab. You may find such a logbook very handy at later stages in your work, especially when you don't properly remember what a previous test version of your program did. Here you could also record the time spent on solving the exercise, various algorithms you may have tested or other topics which you feel worthy of mentioning. + + + + + + +===== Format for electronic delivery of report and programs ===== + +The preferred format for the report is a PDF file. You can also use DOC or postscript formats or as an ipython notebook file. As programming language we prefer that you choose between C/C++, Fortran2008 or Python. The following prescription should be followed when preparing the report: + + * Use Canvas to hand in your projects, log in at URL:"https://www.uio.no/english/services/it/education/canvas/" with your normal UiO username and password. + + * Upload _only_ the report file or the link to your GitHub/GitLab or similar typo of repos! For the source code file(s) you have developed please provide us with your link to your GitHub/GitLab or similar domain. The report file should include all of your discussions and a list of the codes you have developed. Do not include library files which are available at the course homepage, unless you have made specific changes to them. + + * In your GitHub/GitLab or similar repository, please include a folder which contains selected results. These can be in the form of output from your code for a selected set of runs and input parameters. + + +Finally, +we encourage you to collaborate. Optimal working groups consist of +2-3 students. You can then hand in a common report. + + + +===== Software and needed installations ===== + +If you have Python installed (we recommend Python3) and you feel pretty familiar with installing different packages, +we recommend that you install the following Python packages via _pip_ as +o pip install numpy scipy matplotlib ipython scikit-learn tensorflow sympy pandas pillow +For Python3, replace _pip_ with _pip3_. + +See below for a discussion of _tensorflow_ and _scikit-learn_. + +For OSX users we recommend also, after having installed Xcode, to install _brew_. Brew allows +for a seamless installation of additional software via for example +o brew install python3 + +For Linux users, with its variety of distributions like for example the widely popular Ubuntu distribution +you can use _pip_ as well and simply install Python as +o sudo apt-get install python3 (or python for python2.7) +etc etc. + +If you don't want to install various Python packages with their dependencies separately, we recommend two widely used distrubutions which set up all relevant dependencies for Python, namely +o "Anaconda":"https://docs.anaconda.com/" Anaconda is an open source distribution of the Python and R programming languages for large-scale data processing, predictive analytics, and scientific computing, that aims to simplify package management and deployment. Package versions are managed by the package management system _conda_ +o "Enthought canopy":"https://www.enthought.com/product/canopy/" is a Python distribution for scientific and analytic computing distribution and analysis environment, available for free and under a commercial license. + +Popular software packages written in Python for ML are + +* "Scikit-learn":"http://scikit-learn.org/stable/", +* "Tensorflow":"https://www.tensorflow.org/", +* "PyTorch":"http://pytorch.org/" and +* "Keras":"https://keras.io/". +These are all freely available at their respective GitHub sites. They +encompass communities of developers in the thousands or more. And the number +of code developers and contributors keeps increasing. + + + + diff --git a/doc/src/Projects/2020/Project3/clean.sh b/doc/src/Projects/2020/Project3/clean.sh new file mode 100755 index 000000000..2e5da2c72 --- /dev/null +++ b/doc/src/Projects/2020/Project3/clean.sh @@ -0,0 +1,3 @@ +#!/bin/sh +doconce clean +rm -rf *.pdf *.tex ipynb*.tar.gz *.html ._*.html *~ reveal.js Trash README.txt diff --git a/doc/src/Projects/2020/Project3/make.sh b/doc/src/Projects/2020/Project3/make.sh new file mode 100755 index 000000000..3f72d9808 --- /dev/null +++ b/doc/src/Projects/2020/Project3/make.sh @@ -0,0 +1,87 @@ +#!/bin/sh +set -x + +function system { + "$@" + if [ $? -ne 0 ]; then + echo "make.sh: unsuccessful command $@" + echo "abort!" + exit 1 + fi +} + +if [ $# -eq 0 ]; then +echo 'bash make.sh slides1|slides2' +exit 1 +fi + +name=$1 +rm -f *.tar.gz + +opt="--encoding=utf-8" +opt= + +rm -f *.aux + + + +# Plain HTML documents +html=${name} +system doconce format html $name --pygments_html_style=default --html_style=bloodish --html_links_in_new_window --html_output=$html $opt +system doconce split_html $html.html --method=space10 + +# Bootstrap style +html=${name}-bs +system doconce format html $name --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=$html $opt +system doconce split_html $html.html --method=split --pagination --nav_button=bottom + +# IPython notebook +system doconce format ipynb $name $opt + + +# Ordinary plain LaTeX document +system doconce format pdflatex $name --print_latex_style=trac --latex_admon=paragraph $opt +system doconce ptex2tex $name envir=verbatim +# Add special packages +doconce subst "% Add user's preamble" "\g<1>\n\\usepackage{simplewick}" $name.tex +doconce replace 'section{' 'section*{' $name.tex +pdflatex -shell-escape $name +pdflatex -shell-escape $name +mv -f $name.pdf ${name}.pdf +cp $name.tex ${name}.tex + +# Publish +dest=../../../../Projects/2020 +if [ ! -d $dest/$name ]; then +mkdir $dest/$name +mkdir $dest/$name/pdf +mkdir $dest/$name/html +mkdir $dest/$name/ipynb +fi +cp ${name}*.tex $dest/$name/pdf +cp ${name}*.pdf $dest/$name/pdf +cp -r ${name}*.html ._${name}*.html $dest/$name/html + +# Figures: cannot just copy link, need to physically copy the files +if [ -d fig-${name} ]; then +if [ ! -d $dest/$name/html/fig-$name ]; then +mkdir $dest/$name/html/fig-$name +fi +cp -r fig-${name}/* $dest/$name/html/fig-$name +fi + +cp ${name}.ipynb $dest/$name/ipynb +ipynb_tarfile=ipynb-${name}-src.tar.gz +if [ ! -f ${ipynb_tarfile} ]; then +cat > README.txt <