1 of 164

CMSE802

0907--AvsN-pre-class-assignment

2 of 164

Where you able to clone the git repository for this course? If not, where did you get stuck?

  • Yes
  • "When you log in, it may ask you to created a password for accessing repositories via HTTPS, you should do this for the purposes of being able to push and pull repositories" I cannot find out where to create the password for repository
  • NO, Nill, N/A

3 of 164

Easy/Hard parts

Calculus

Pretty well - it was good review for a guy who hasn't had calculus in 20+ years.

4 of 164

Git Pull Error

MacBook-Pro:~ user$ git pull https://gitlab.msu.edu/cmse802-f20/cmse802-f20

fatal: not a git repository (or any of the parent directories): .git"

5 of 164

SSH keys in gitlab

I think I'm all good! The only resource I pulled in was this document from Gitlab on how to generate an ssh key. It was really useful if you want to use it for future students!

https://gitlab.msu.edu/help/ssh/README#generating-a-new-ssh-key-pair

6 of 164

Other Questions

Is there a preference for where we should be running the class files (ie. on our own computer or on the command line in GitLab)?

7 of 164

Other questions

Can we do a live tutorial or how to use git commands like pull and status in class?

I hope we could have some git demo in the future class.

8 of 164

0909-Optimization

9 of 164

Where you able to get the optimization library to work for the simple example?

No I couldn't figure out what method to use or what further information I could I have fed the minimize function to get to run. The documentation was a little hard to figure out and internet examples solved problems a bit more complex than the example we used.

I tried to solve for the local minimum with scipy optimization method and I got 1.666666 for the x which is really close to the analytical solution. I cannot say this optimization method does not work well for this problem but I would guess it would work better than other optimization methods in other situations. It might work better in the ones with more variables or the ones with many other constraints.

I didn't get the optimization library to work for the example as I wasn't able to determine which method from the optimization library was appropriate for the example.

10 of 164

(Most Challenging A) Optimization Issues

  • Following the documentation for the optimize library.
  • The usage of the scipy.optimize library. I realized there was optimize.minimize() and Optimize.minimize_scalar which took me sometime to figure out which one to use.
  • gradient descent self-coding
  • finding the right syntax to use the scipy.optimize.minimize function.
  • determining which method to use from the scipi optimize library
  • Reading through the optimization library and using it to solve the example problem

11 of 164

General Sentiment about Optimization

  • I would like more practical practice on the optimization library.
  • An actual example of the optimize library or maybe going through how to read the documentation
  • I tried to run the scipy optimization method on my own and I am not sure I did all of this part correctly. It would be helpful if we can go over this part during the clas.
  • maybe give an example code that uses the optimize.minimize function.
  • Going over some of the optimization methods such as machine learning, parameter optimization, ..

12 of 164

(Most challenging B) Git Issues

  • I didn't really have a hard time, but I was left with more questions about Git.
  • Git branch, Git!

  • When you do git add/git commit, are you overwriting the file in the git branch or does it do some sort of automatic merge of the files so that they become one but contain all the information of both versions? What I’m trying to say is ""Does git add/git commit take the newly edited local file and then overwrite the git file on the git servers or does it do something else?

13 of 164

Other Git Questions

  • Yes. When I type in 'git branch', it works correctly. But It does bot show anything on the screen, so I cannot see the branch I have created.
  • Could please provide more detail information on how one can submit a document to you for grading through git repository?
  • I know you can use git pull the add new files from a git repo, but when you're working from a branch how do you move those files from Master to the branch?

14 of 164

Other Interesting Questions

  • Not sure I know how to search pip install without knowing how to say what I was looking for.
  • Can you make a branch of a branch? (Branch inception!) I don't know why you might do this, but the thought crossed my mind.
  • When I tried to do the git pull on the test branch, it told me that there is no tracking information for this branch. So are we only allowed to do the git pull on the master branch? If there is no confilcts or difference between two branches, I should be able to do the git pull for either branch.

15 of 164

ADDITIONAL QUESTIONS

  • I was hoping you could quickly go over what's expected of us for the report Friday.

16 of 164

Lessons about this course

  • Good programmers are not good because they know how to use libraries.
  • Good programmers are good because they can debug and figure out code.
  • Figuring out code requires trial and error while exploring.
  • The best skill you can learn in this course is how to explore code.

  • I can not go into depth in all topics in this course. Mostly I can show you the path and give a hint at what you will find at the end.
  • Explore the topics you find really interesting.

17 of 164

0909-Optimization

18 of 164

Lessons about this course

  • Good programmers are not good because they know how to use libraries.
  • Good programmers are good because they can debug and figure out code.
  • Figuring out code requires trial and error while exploring.
  • The best skill you can learn in this course is how to explore code.

  • I can not go into depth in all topics in this course. Mostly I can show you the path and give a hint at what you will find at the end.
  • Explore the topics you find really interesting.

19 of 164

Where you able to get the optimization library to work for the simple example?

No I couldn't figure out what method to use or what further information I could I have fed the minimize function to get to run. The documentation was a little hard to figure out and internet examples solved problems a bit more complex than the example we used.

I tried to solve for the local minimum with scipy optimization method and I got 1.666666 for the x which is really close to the analytical solution. I cannot say this optimization method does not work well for this problem but I would guess it would work better than other optimization methods in other situations. It might work better in the ones with more variables or the ones with many other constraints.

I didn't get the optimization library to work for the example as I wasn't able to determine which method from the optimization library was appropriate for the example.

20 of 164

(Most Challenging A) Optimization Issues

  • Following the documentation for the optimize library.
  • The usage of the scipy.optimize library. I realized there was optimize.minimize() and Optimize.minimize_scalar which took me sometime to figure out which one to use.
  • gradient descent self-coding
  • finding the right syntax to use the scipy.optimize.minimize function.
  • determining which method to use from the scipi optimize library
  • Reading through the optimization library and using it to solve the example problem

21 of 164

General Sentiment about Optimization

  • I would like more practical practice on the optimization library.
  • An actual example of the optimize library or maybe going through how to read the documentation
  • I tried to run the scipy optimization method on my own and I am not sure I did all of this part correctly. It would be helpful if we can go over this part during the clas.
  • maybe give an example code that uses the optimize.minimize function.
  • Going over some of the optimization methods such as machine learning, parameter optimization, ..

22 of 164

(Most challenging B) Git Issues

  • I didn't really have a hard time, but I was left with more questions about Git.
  • Git branch, Git!

  • When you do git add/git commit, are you overwriting the file in the git branch or does it do some sort of automatic merge of the files so that they become one but contain all the information of both versions? What I’m trying to say is ""Does git add/git commit take the newly edited local file and then overwrite the git file on the git servers or does it do something else?

23 of 164

Other Git Questions

  • Yes. When I type in 'git branch', it works correctly. But It does bot show anything on the screen, so I cannot see the branch I have created.
  • Could please provide more detail information on how one can submit a document to you for grading through git repository?
  • I know you can use git pull the add new files from a git repo, but when you're working from a branch how do you move those files from Master to the branch?

24 of 164

Other Interesting Questions

  • Not sure I know how to search pip install without knowing how to say what I was looking for.
  • Can you make a branch of a branch? (Branch inception!) I don't know why you might do this, but the thought crossed my mind.
  • When I tried to do the git pull on the test branch, it told me that there is no tracking information for this branch. So are we only allowed to do the git pull on the master branch? If there is no confilcts or difference between two branches, I should be able to do the git pull for either branch.

25 of 164

ADDITIONAL QUESTIONS

  • I was hoping you could quickly go over what's expected of us for the report Friday.

26 of 164

CMSE802

0914--AvsN-pre-class-assignment

27 of 164

Understanding Local Package Installs

  • As silly as it sounds, it took awhile for me to understand that the -t flag merely determines the path where the package is installed
  • After installing the package, do we need to run "sys.path.append('./packages/')" every time when we using jupyter notebook?
  • What are the advantages to installing packages locally instead of a typical pip/conda install? I feel like that's what I would want to do most of the time, though I often run into errors or conflicts when I try to do this.

28 of 164

Understanding Conda

  • Conda create seemed to know the packages were for python, anaconda also houses other IDEs like rstudio how does it know what packages you're asking for?
  • Can packages mess each other up? Is the need for separate environments for packages just a matter of efficiency? Why would one need multiple separate environments for packages?
  • When the command of "conda activate environment" meet with "git branch", which one should be the first? how to combine these two? could you please show an example?

29 of 164

Debugging

I cannot get Conda working. I think it's a path issue. How do I find the path where my conda is to add to my zshrc?

pip install of mdtraj, had some errors. " command errored out with exit status 1"

Is there any recommended books or videos that we can try to practice on our own? Because this part is challenging for me and I think I need more examples and practice.

30 of 164

More Environment questions

I would really like to see if you could run an entire project in an environment and if you could "share" that environment with another individual on another machine. Is that allowed?

31 of 164

Data Fitting

The example showed in this assignment doesn't have too much data. What kind of methods will we use for large dataset and how to aviod overfitting problems?

32 of 164

Tricks to merging Jupyter files

33 of 164

Tricks Merging Jupyter Files

I was trying to merge my personal branch with the origin master. While doing that, I found that the 0910 in class assignment was in conflict with the file from the origin. To resolve the conflict, I opened the file in using vi, as suggested by the tutorial video. However, although in the tutorial video, editing the README.md file seemed easy to do, I found editing the long .ipynb file to be quite cumbersome using the terminal. Is there any easier way to resolve the conflict between two .ipynb files without editing the long file in the mac terminal vi mode?

https://github.com/jupyter/nbdime

34 of 164

PIP and Conda Installs

35 of 164

Global PIP Installs

pip install PACKAGE_NAME

Requires administrative (Root) access

Hides files someplace on your computer

36 of 164

User PIP Installs

pip install --user PACKAGE_NAME

Hides files inside your home directory

37 of 164

Local PIP Installs

pip install -t ./FOLDER/ PACKAGE_NAME

Requires adding ./FOLDER/ to path every time

sys.path.append('./FOLDER/')"

38 of 164

Environment PIP Installs

pip install PACKAGE_NAME

Requires having pip installed in your environment.

Requires activation of the environment

Installs files in the environment folder

39 of 164

Base Environment

Default environment

40 of 164

User Environment

conda create --name ENVIRONMENT_NAME

Creates an environment at the user’s default location

41 of 164

Local Environment

conda create --prefix ./ENVIRONMENT_NAME

Creates an environment folder at the current location

42 of 164

CMSE802

0916--LSF

43 of 164

Questions

The most challenging part was figuring out if I plotted the "DO THIS" last parabola part right. I hope we can see the solution in class.

I think I am still confused about the Pseudoinverse part and I need more explanation about this part.

Where are we trying to go with this new info?

When I try to use git pull command on the master branch, everything went smoothly. But I noticed that the test branch didn't have any updates as I did the git pull. If I want to have these updates in my test branch as well, which command should I use?

44 of 164

Other Questions

Can we finish the optimization lecture from the last class?

45 of 164

CMSE802

0921--Stats-pre-class-assignment

46 of 164

6. ANOVA

Now let us assume that your advisor wants you to run an ANOVA analysis.

47 of 164

Where you able to get ANOVA to work?

Not quite; I found an example that uses pandas and scipy, but I could not import one of the packages that the example uses (factorial).

I did not get this working. I am so freaking confused as to what an ANOVA table is an I need to hear it from a human I can ask questions to.

I was able to get an ANOVA model working with the statsmodel library. However, I can't say that I entirely fully comprehend what the program is doing or am I able to interpret the results.

so-so; my brain soaks up these types of tools best when I use them to answer real world questions; I really should have tried to use them in this way but I just make time to do it

48 of 164

Using Example Code and Programming to Learn

  • STOP: I don’t understand the method so I can’t understand the code.

  • START: If I can figure out the code I may be able to figure out the method.

  • CONTINUE: Asking Questions, using google and exploring.

49 of 164

What would you say is(are) the most important topic(s)/concept(s) covered in this assignment?

I think the most important topic was the emphasis on multiple ways to do things. You made it clear there are lots of packages and let us choose our own for ANOVA and I appreciate that freedom and information.

50 of 164

Questions

  • I would like to see some brief examples about thow to use statsmodels in class.
  • ANOVA will be the death of me. I thought I may have been avoiding it taking this class but it is back again.
  • A full, working example that showcases ANOVA analysis
  • I would like to know more on how to create a regression model with the stats module python has.

51 of 164

Other Questions

  • I think these methods can solve a lot of problems for numerical data. But can they still work well for categorical data?
  • I just want to say I am truly a weak student in stats. It is the only part of mathematics that is a foreign language to me. I love everything else, but stats is an enigma. I will do my best to ask questions, but I don't want to bring the class down in the stats section of class.

52 of 164

CMSE802

0923 Code Optimization

53 of 164

Problems logging into the HPC?

  • It would tell me there was an error after putting in my login information.
  • no, I cannot open the ondemand.hpcc.msu.edu website. The error was "Authorization Error Error 403: org_internal This client is restricted to users within its organization". I did not find a way to switch to msu.account
  • At some point a lot of my HPCC was modified in ways I don't understand by someone else so I may need help undoing it.

54 of 164

OpenOnDemand Issue

I could not clone the course repo to my OpenOnDemand account.

The terminal returned:

error: RPC failed; result=22, HTTP code = 404

fatal: The remote end hung up unexpectedly

I got a different error message when I input the wrong password, so I'm not sure if this is an authentication error or something else.

55 of 164

56 of 164

Problems Cloning the course repository?

  • The repository I cloned was a empty folder.
  • I did not get this done because I could not clone the repository. It kept timing out. The only solution I understood on Google said keep trying it will go through eventually so I kept trying to no avail.
  • I was able to log on to the HPCC and open a jupyter notebook. However, I wasn't sure how to clone the course repository.
  • I was able to access the HPCC using OpenOnDemand, but I could not clone the course repo (see below for details).

57 of 164

Website

https://gitlab.msu.edu/cmse802-f20/cmse802-f20

Ssh URL

git@gitlab.msu.edu:cmse802-f20/cmse802-f20.git

HTTP URL

https://gitlab.msu.edu/cmse802-f20/cmse802-f20.git

58 of 164

What did you learn?

  • This assignment was very helpful to me. I am running this algorithm on my local computer using Matlab. This assignment explained how I can do that on the HPCC to save memory on my local machine.

  • I now understand a simple way to use the "time" function to compare the time that it takes for different codes to run.

59 of 164

HPCC Questions

  • Is it a good idea to use the HPCC in our projects (in the software itself)? Or should we just use it as a tool to run it?

  • I'm not sure how much we are going to be using HPC this semester, but I was using it in my computational chemistry research. There are a lot of things that my old research partner set to be non-standard because he did not like it when it was different when he was helping me. If we are going to be using this tool frequently throughout the semester, is there any way you can sort of help me reset to basic?

60 of 164

Other Questions

  • I struggled to fully comprehend the matrix multiply and got tangled up in trying to understand it rather than focus on the optimization

61 of 164

CMSE802

0928-Graph_Theory

62 of 164

Installation trouble

Were you able to find a graphing library and get it to plot the provided graph? If not, where did you get stuck. Answer: I updated my MacOS today and the terminal commands are not working for git, pip etc. I get the following error message

"xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun".

63 of 164

Toubleshooting

I have searched this error message on the internet and apparently I am going to need to download and install xcode. I tried to download the xcode from terminal with the following command "xcode-select --install". But this is not working and I get the following error message-

"can't install software because it is not currently available from the software update server".

64 of 164

Continued search

I searched this on the internet too and the suggestion is to download xcode manually from apple developer website and then install it manually. However, the xcode12 version is almost 12GB in size.

I am currently downloading the xcode12 from the developer website, it will take around 5 hours to download and then hopefully I will be able to install xcode, then install pip, and then install the necessary library package to complete the assignment. I have found a couple of graph libraries searching on the internet. I currently have my eyes on something called "networkx" which looks promising. I am currently running the notebook using the anaconda interface and not from the terminal using command line.

65 of 164

Ideas for solving the problem

  1. Continue Trying to download and install xcode
  2. Reinstall Anaconda
  3. Try a different computer; HPC, jupyterhub, others...
  4. Check to see if conda is working.
  5. Check you path and see if you can add pip/conda to your path “echo $PATH”
  6. Spin up a VM or docker image.

66 of 164

Other Questions

  • how to read analyze large graphs with big datasets?
  • The recursion video notes that, according to a theorem, all recursive functions can be written iteratively. Is there a rule of thumb about when iterative routines are more efficient than recursive ones?

67 of 164

CMSE802

0930 Web Scraping

68 of 164

Your Questions

  • How does HTML work and general web scraping
  • Lots of questions about Regular Expressions,

69 of 164

Quick Overview of HTML

<war>Fighting</war>

70 of 164

Tag Attributes

<a href=”http://cmse.msu.edu/cmse802”>Course Website</a>

The “href” part is an attribute. Tags can have all kinds of attributes.

71 of 164

A few Common Tags

  • <xml> - Extensible Markup language
  • <html> - Hypertext markup language
  • <header> - Header
  • <body>- Body of the page
  • <div> - Section Divider
  • <br> - Line break
  • <a> - Link
  • <table> - Table

72 of 164

Table Example

<table style="background-color:Green">

<tr>

<th>Month</th>

<th>Savings</th>

</tr>

<tr>

<td>January</td>

<td>$100</td>

</tr>

</table>

73 of 164

Regular Expression Overview

74 of 164

Other Questions

I would like to know the difference between urllib and selenium. I believe they are both used to get webpages but you can parse through the webpage with selenium; similar to parsing through html web pages with beautiful soup.

75 of 164

CMSE802

1006-Graphs

76 of 164

How did you do on the pre-class?

I know I have worked on it before but I could only find K nearest-neighbor when searching and I couldn't figure out if this was different or the same or what was happening.

I was able to find the KNN between the random generated points but was not able to generate the graph plot.

I was able to iterate through the 50 fake towers, plot them, and find the closest tower for each. I was not able to determine how to implement the adjacency graph using a dictionary of lists and plot the connections.

77 of 164

I wish I had more support this time. A video explaining how the nearest neighbor algorithm would have been helpful because I had such a hard time with this part.

I was using 'plt.plot' to plot NNG, simplly loop over each points and plot a straight line to its nearest point. I am curious that can I use 'NetworkX' to plot NNG with directed edges at once.

78 of 164

Calculating Nearest Neighbor

79 of 164

80 of 164

81 of 164

82 of 164

83 of 164

84 of 164

Nearest Neighbor Algorithm

Loop over all of the points:

Loop over all of the other points

Calculate current_distance

If current_distance < minimum_distance

Set minimum-distance to current_distance

Set index to current_distance_index

Save index and minimum_distances for this point.

85 of 164

K Nearest Neighbor Algorithm

What is different?

86 of 164

Other Questions

In the website where towers data is downloaded form, I just saw the range in there is 3 miles rather than 4 miles.

For the nearest neighbor graph part, the graph reminds me of k-means clustering method to classify the data into several groups. So I would like to ask is there any method to run k-means with Python?

From the assignment, we were task to download for all of the towers in a 4.0 Mile radius from the MSU engineering building but the site gives 3.0 mile radius.

87 of 164

CMSE802

1007--PullRequest-pre-class-assignment

88 of 164

Upcoming Workshop On Python (Free)

UPCOMING HPC WORKSHOPS

OCTOBER 2020

PC2HPC WEBINAR: Python on HPCC

Oct 12, 10:00 a.m. -12:00 p.m.

Learn best practices to improve the performance of your Python code on HPCC.

https://icer.msu.edu/education-events/pc-hpc-python-hpcc

89 of 164

Questions

  • After I made a change in a branch and pushed it to the repository, there was no 'pull request' in the browser, but a 'merge request'. And after the branch was merged to master branch, that branch disappeared.
  • Could you give a short definition of what you mean when you say "upstream"? I have a vague idea, but you used it a lot in this set of videos and a clear meaning would help.
  • when do the forking, is that possible to use the same branch names for various projects, when "git push origin Branchname" ? In other words, do we need to create a new branch name for each fork item?

90 of 164

Automatic Documentation (Due Friday)

91 of 164

CMSE802

1012 - Pre-class assignment - Unit Testing

92 of 164

Todays Modified agenda

  • (20 minutes) Review Pre-Class Assignment
  • (10 minutes) Matrix Indexing
  • (20 minutes) Answercheck Code-Review
  • (20 minutes) Finish Tower Exercise
  • (20 minutes) Review Project Git Repositories
  • (20 minutes) Getting Started with Merging

93 of 164

Pytest vs doctest

  • "Why do you prefer pytest above the other unit tests? Could you give an example of what makes it so useful?
  • Doctest is amazing if you want to give example code to a user. They will see this code when you use pdoc3 and can give them hints as to how the code is used.
  • PyTest allows for much richer tests in a testing framework. If we have time I will show an example.

94 of 164

How do I decide what makes an effective test to use in unittest?"

  • Library installation testing
  • Input format testing
    • Size of input
    • Type of input
    • Range of inputs (positive numbers, max value, min value, etc).
  • Testing for proper errors.

95 of 164

Random Testing

  • In my project (which is a Monte Carlo simulation approach), I have a number of functions that use different random number generators to return random values. Since these returned values are to be different in different runs of the code, I was wondering if there is any way to check their functionalities. It seems to be a problem because by using the unit testing methods specified in this assignment, I can only check for deterministic/fixed returned values.

96 of 164

Answercheck Example

97 of 164

Unwrapping Loops

Understanding the mod %

98 of 164

Questions

  • In part one, it introduced us with a Label to Indices function which can convert linear label of grid to indices of row and column. And I have tried to change the lables (default 3675) to different values. But the outcome is always (2,1) and I wonder why does it always be (2,1).

99 of 164

What is name==”main”?

How do you use argv?

100 of 164

Understanding Argv and name=”main”

  • Why do we need the statement "if __name__ == '__main__':"
  • In the statement "unittest.mian()", what is the role of

argv=['first-arg-is-ignored'], exit=False

101 of 164

Review Tower Exersice

102 of 164

String Comparison

Hack-a-thon

103 of 164

What did you find?

104 of 164

What did you find - Winner Difflib

  • difflib (https://docs.python.org/3/library/difflib.html) which offers a variety of tools for analyzing the similarity of text sequences.
  • I found a class that gives a ratio for how similar two strings are. Link: https://docs.python.org/2/library/difflib.html#difflib. SequenceMatcher.ratio
  • I used ' squencematcher from difflab'. It had an object called ratio which gave me a number after comparing 2 strings. I see that kms is a better match.
  • I am not sure whether this library will be a very good fit for this particular project, I guess we can find out. This is the link- https://docs.python.org/2/library/difflib.html

105 of 164

What would you say is(are) the most important topic(s)/concept(s) covered in this assignment?

  • efficiency
  • No
  • Researching code for a specific purpose.
  • All
  • There is no specific topics/concepts for this assignment
  • I'm excited for a hackathon!
  • researching solutions cloning git repositories
  • go through the project idea
  • difflab
  • The researching process for a new idea, it is exciting!
  • searching for potentially useful papers and libraries to compare different sequences.

106 of 164

Questions

  • Not quite understand how the distance is computed in the "editDistance" function
  • If we could go over more in depth (which I assume we will) over what their research is about.

107 of 164

CMSE802

Introduction to Classes

108 of 164

Class Questions

  • Can you clarify what goes in a good docstring for a class specifically?
  • When do you use a one-line versus a multi-line docstring?
  • I would like to know if classes in python still have the same kind of inheritance they do in c++ (private, public, and I protected (I think is the third one)). Also, I've heard that "everything in python is already an object" which is why there aren't any explicit pointers. Is that true?

109 of 164

CMSE802

Agent Based Modeling

110 of 164

Agent Based modeling

An agent-based model (ABM) is a class of computational models for simulating the actions and interactions of autonomous agents (both individual or collective entities such as organizations or groups) with a view to assessing their effects on the system as a whole.

-- Source - Wikipedia

111 of 164

Questions about the code

  • I don't understand the meaning of "smell[x, y] = smell[x, y] + 100" (right after prevent ants from going out of bound part). It looks like it will define the smell level. But what does the 100 mean? Does it mean the ant could smell the food within 100 units?
  • how does the code/figure capture the evaporation rate of pheromone?
  • In the code, when we are checking to see if there is pheromone around, why are we only checking the right and upwards direction for pheromone and not the left and the downwards direction?

112 of 164

CMSE802

Pep8 and linting

113 of 164

Import Question

In part 2, after running the linter, it told me that "example.py:1:0: W0611: Unused import sys (unused-import)" and "example.py:2:0: W0611: Unused import os (unused-import)". My code rating has been decreased because of these two sentences, But if I delete these two sentences, the code will be broken. What should I do about this part?

114 of 164

Character question?

I couldn't distinguish between the correct form and the wrong form of the Immediately before a comma, semicolon, or colon from the documentation page. They all look the same.

115 of 164

Another import question

Does the linting library/ program depends on the library you are using? Because i tried it on my code and I receive a message to change one of my imported libraries to another library.

116 of 164

CMSE802

Machine Learning

117 of 164

Datasets

My research is not in Machine Learning but I wish to learn more of Machine Learning.

None of these datasets relate to my own research. I am guessing that is because my research is related to the RF accelerator technology and not many experimental data is available publicly on this topic. However, the generated datasets section seem to be interesting. Maybe I could try to generate something useful playing with that tool.

118 of 164

Uploading Documents to the HPCC

I would like to know if we could go over how to ssh upload a document to HPC because I cannot remember and didn’t get anything I understood fully on Google. I would rather ask you than break something on accident by using code I didn’t understand on HPC.

scp sourcepath destinationpath

path USERNAME@URL:~/LOCALPATH

119 of 164

Quick check-in

120 of 164

CMSE802

Introduction to Neural Networks

121 of 164

UNIVERSAL APPROXIMATION THEOREM

Great cosmic power…. Itty bitty living space.

122 of 164

NN Questions

  • Why do we need to apply the sigmoid function. What is the significance of the activation function.
  • an explanation on the last mathematical equation will be helpful.
  • When you say normalize, do you mean the linear algebra way or what was shown in the video? I am a little confused because I get a one-value answer when I use np.linalg.norm() and I don’t think this is right, but I don’t know exactly what is going on then.
  • How can we modify the code such that we can get a better result?

123 of 164

Exploring a network

124 of 164

Programming Questions

  • When I was working through the NN code, I kept getting things of different dimensions than what you had as outputs in the notebook originally. I triple checked my dimensions against what is in the video so I am not sure what is happening. It happens specifically at Z3 though.

125 of 164

CMSE802

Back Propagation

126 of 164

Final Project Due Dates

127 of 164

Clarifications from last time

Why is the activation function sigmoid?

  • Helps with the proof
  • May also be necessary for back propagation

Neural Networks can not model any function. They can approximate any function. Slight but important difference.

Learning, m and b from y=mx+b turns out to be much thicker than I thought. It is a good exercise if you want to try it.

128 of 164

Neural Networks are Great

  • Can approximate any function
  • Simple to implement
  • Easily adjusted to new problems

129 of 164

Neural Networks have issues

  • Require a lot of training data
  • Have no guarantee of convergence*
  • Are black boxes

* To be fair. This is true with almost all machine learning.

130 of 164

Some current research in Neural Networks

Note, these are your instructor’s terms. I am not fully versed in the current NN terminology so ideas may vary...

  • Meta-Learning
  • Building “transparent” networks
  • Transfer Learning
  • Cascading Neural Networks
  • Data manipulation (bootstrapping)

131 of 164

Other Questions?

132 of 164

CMSE802

Tensorflow on the HPCC

133 of 164

Installing Anaconda and Tensorflow

  • I was able to install Anaconda but not tensorflow. I got errors for the wrong version of numpy to install tensorflow.
  • Why are there two different versions of "python", one for the built-in software, the other for the anaconda version?
  • Should software be installed in a virtual environment on the HPC or in the root directory?
  • I had trouble getting a concise report or article on introduction to TensorFlow?
  • I do not know how to get access to HPCC from local terminal using SSH?

134 of 164

Setting up Conda Environments

135 of 164

The Google Colab

136 of 164

Where you able to get the example working?

  • Yes, i was able to run the digits example on the cpu, gpu, and tpu
  • I couldn't get it to work on my local machine.
  • Yes. But I found TPU needed more time than GPU. Maybe I missed something..

137 of 164

Challenging Parts

  • I am not very clear how to use GPU/TPU on Colab.
  • How do you deal with the examples that are cannot be open in Colabratory from the AI Hub Google Seed.

138 of 164

The Downsides to using Colab?

  • System is evolving and changing
  • You become dependent on an external system
  • Makes teaching using colab really difficult over the long term

139 of 164

User Interfaces

Graphical User Interfaces (GUI)

Command Line Interfaces (CLI)

Advanced Programming Interfaces (API)

Easier for software users

Easier for programmers

140 of 164

How often does this code be used?

  • Only a few times
  • Until the experiment is complete
  • Until my degree is complete
  • For all time***

141 of 164

Who is your user?

  • Your future self
  • Other members of your lab
  • Colleagues at other institutions
  • Novice Programmers
  • Advanced Programmers

142 of 164

Goal: Make it as easy as possible to automate

Whenever possible interface design should be done in layers:

  1. Default values with no user input.
  2. Direct Library and programming calls through an API
  3. Command line arguments into the program (Linux Method)
  4. User prompting for input though the Command Line Interface
  5. User prompting for input though the Graphical User Interface

If done correctly, each level gets easier to program. We can also make the code modular and therefore more flexible.

143 of 164

Modular Interface Design

Data interface

Read/Write Data

Convert Data

Check for errors

Etc.

Computation interface

Run statistics

Model Simulation

Calculate Results

Etc.

User interface

Generating Graphs / Charts

Asking for feedback

Etc.

144 of 164

Ordinary Differential Equations

145 of 164

Ordinary Differential Equations

it was a great start but i'm not entirely sure how to determine when an ODE is the best way to model a phenomenon

How can we know which equation are we needed for our project? How to build up ODE for our project?

146 of 164

Windows vs Linux

File Paths

147 of 164

Questions

I cannot set-up the correct directory for "!python searchnb.py -s "beautiful" --directory "~/"" . the input "~/" did not work in my windows laptop.

148 of 164

File Paths

Windows

  • Root Directory: A:/ B: C:/ D:/
  • Use the backward slash syntax “\”
  • Current Directory: .
  • Parent Directory: ..
  • May behave differently in Powershell and CMD
  • Escape character: \

C:\\Documents\ and\ Settings\\User\\sdcard.img

C:/Documents\ and\ Settings/User/sdcard.img

Mac / LInux

  • Root Directory: /
  • Use forward slach syntax “/”
  • Current Directory: .
  • Parent Directory: ..
  • Previous Directory: -
  • Home Directory: -
  • Escape character: \

/mnt/home/my\ Documents/

149 of 164

from pathlib import Path

The pathlib library is designed to help fix problems with paths inside of python.

We should get into the habit of always using it with relative paths. For example

from pathlib import Path

mypath = Path(‘./thisfile’)

with open(str(mypath) as file:

contents = file.readlines()

This library seems to prefer the linux/mac path syntax (it is considered more standard).

150 of 164

File Formats

151 of 164

152 of 164

Encoding problems

In "4. Practice", the code was not working and returned error as follows:

Traceback (most recent call last):

File "searchnb.py", line 22, in <module>

for line in fp:

File "D:\Software\Python3.7\setup\lib\encodings\cp1252.py", line 23, in decode

return codecs.charmap_decode(input,self.errors,decoding_table)[0]

UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1070: character maps to <undefined>

To fix that, I add "encoding="utf8"" to line 21 so that it became:

"with open(filename,'r', encoding="utf8") as fp:"

This modification did fix the error even though I do understand the logic behaind.

153 of 164

Not all “Text” is created equal

ASCII

UTF8

Many others

154 of 164

Scientific Image Understanding

155 of 164

Questions

I used the Jupyterhub and failed to install environment for see-segment project with the error "[Errno 122] Disk quota exceeded".

I am having problem with cloning repositories by getting an error message that. So I was not able to do that.

Yes, however the conda environment created and activated didn't have 2 packages despite the terminal suggesting they'd been installed properly. Once they were installed the example file worked well.

156 of 164

Code Review

157 of 164

Code Review Comments

The checklist was helpful but i wonder whether i'm qualified to evaluate all of the things i should.

It feels like we’ve already done this in practice during the semester. So this is kind of redundant.

If I haven't finished my code yet, do I still have a change to do the code review?

158 of 164

Today’s Agenda

  • Break up into groups of 2 or 3.
  • Immediately share your repository with the members of your group.
    • Put your clone command in the chat window.
  • Clone your partner’s Git repository.
  • Read the README.md file and note any special instructions.
  • Create your partner’s environment (if needed)
    • Local environments are the best but consider trying the HPCC if you run into problems.
  • Run the unit tester on your partner’s project.
  • Run linter on your partner’s repository and review the results
  • Run automatic documentation on your partner’s project

159 of 164

setup.py

Sharing your package with the world!

160 of 164

Problems with setup.py

  • I stucked in Step 4. Could not find a version that satisfies the requirement cudatoolkit>=10.1. Besides, in Step1, I have to change "from distutils.core import setup" to "from setuptools import setup" in my windows setup.
  • In step B, after runnng "python setup.py sdist", the file"pavemet-response-0.1dev.tar.gz" shows this error: "pavemet-response-0.1dev.tar.gz". I think this is a issue of UTF-8. I did some research in google but failed to solve the problem

161 of 164

What is a package?

  • I almost finished the packaging, but where you had package=[‘see’] I wasn’t quite sure what to put for my code. Is that the whole folder the thing goes into? like my folder called “TeachingTools”?

162 of 164

Find a url to generate a python package

163 of 164

  • Where you able to get a pypi installer built. If not, where did you get stuck? No, I was not.

164 of 164

Github.io