SE 132 Machine Learning For Structural Engineering J. S. Chen Spring 2021 Homework #1 Part 1 (10 Points)
SE 132 Machine Learning For Structural Engineering J. S. Chen Spring 2021 Homework #1 Part 1 (10 Points)
Chen
Spring 2021
Homework #1 Due April 6 (3:30 PM PST), 2021
1. Determine the values of for which the following system has a non-trivial solution:
3x 1 + x 2 − x3 = 0
4x 1 − x 2 − 3x 3 = 0
2x1 + 3x 2 + x 3 = 0
x1 + 2x2 = 1
x1 − x2 + x3 = 4
3x2 − x3 = c
3. Given a fair 6-sided dice that can take 6 possible outcomes {1,2,3,4,5,6}, let’s throw the dice
twice and define a random variable 𝑋 to tell how many 6 we can obtain. Show the probability
distribution of 𝑋, that is, the probabilities of all possible outcomes of 𝑋: 𝑃(𝑋 = 0), 𝑃(𝑋 = 1),
𝑃(𝑋 = 2). What is the expectation, variance, and standard deviation of 𝑋?
4. Given two fair coins (with a head and a tail), let 𝐻𝑖 denote “coin 𝑖 is head” and ∃𝐻 denote “at
least one head”. What is the conditional probability 𝑃(𝐻1 |∃𝐻)?
5. Given a vector, 𝒙 = [6, 2, 3, 5], calculate its mean 𝜇𝒙 and standard deviation 𝜎𝒙 . Standardize 𝒙
̂ = (𝒙 − 𝜇𝒙 )/𝜎𝒙 . What is the mean 𝜇𝒙̂ and standard deviation 𝜎𝒙̂ of the standardized vector 𝒙
by 𝒙 ̂?
1
Part 2 (10 Points)
Follow the instructions to install Anaconda, complete the problems under your Jupyter
notebook and submit it (named as “SE132_SP21_HW1_YourName”) to Gradescope.
Install Anaconda
You need to install the requisite programs that you will use in this course. Fortunately, you just
have to download one package from the internet which is Anaconda. You can find it at:
https://www.anaconda.com/products/individual
2
2) Install the latest version for your respective OS.
3
• Approach 2: via Anaconda Prompt
4
Type “jupyter notebook” and Enter.
5
• To save it, go to File → Save as or press ‘Ctrl’ + ‘s’. A file
“SE132_SP21_HW1_YourName.ipynb” will be saved in the directory where the
Jupyter notebook was created.
6
• Print the value of variables or expressions:
7
7) Practice the following commonly used commands
• Navigate between cells: press ‘up’ or ‘down’ arrow keys, or use the cursor to select
cells
• Create a cell below the current one: press ‘b’
• Create a cell above the current one: press ‘a’
• Delete a cell: press ‘dd’
• Execute the current cell: press 'Ctrl' + 'Enter'
• Execute the current cell and select the cell below: press 'Shift' + 'Enter'
• Execute all cells in the notebook: click on ‘Cell’ (in the top menu) > ‘Run All’
• Execute all cells Above the current cell: click on ‘Cell’ (in the top menu) > ‘Run
All Above’
• Execute all cells Below the current cell: click on ‘Cell’ (in the top menu) > ‘Run All
Below
8) Follow the Python tutorial in the Jupyter notebook of Lab 1 and complete the following
exercises.
• Create variables of basic data types discussed in the tutorial, including Numbers,
Booleans, Strings; Print the values and data type of these variables
• Create variables of data containers discussed in the tutorial, including Lists,
Dictionaries, Sets, and Tuples; Print the values of these variables
• Create a function that multiplies all elements of a given list by 5; Call the function
with the list [2, 5, 10, 3, 7] and print the resulting list.