-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
898 changed files
with
241,053 additions
and
3,101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
title: "CS177-lecture-20220210" | ||
# date: 2022-02-10T16:04:06-08:00 | ||
draft: false | ||
bookToc: true | ||
tags: ["numpy", "pandas"] | ||
--- | ||
|
||
## NumPy | ||
|
||
We can use NumPy with | ||
|
||
```py | ||
import numpy as np | ||
``` | ||
|
||
We can create new arrays with | ||
|
||
```py | ||
a = np.array([1, 5, 7]) | ||
``` | ||
|
||
We can specify number of dimensions or data types: | ||
|
||
```py | ||
b = np.array([1, 2, 3], ndim=2) | ||
c = np.array([1, 2, 3, 4], dtype=complex) | ||
``` | ||
|
||
We can see the shape of an array via | ||
|
||
```py | ||
print(a) | ||
print(a.shape) | ||
``` | ||
|
||
You can set the shape of an array | ||
|
||
```py | ||
d = np.array([1, 2, 3], [4, 5, 6]) | ||
d.shape = (3, 2) | ||
``` | ||
|
||
To create an array in a range | ||
|
||
```py | ||
a = np.arange(24) | ||
``` | ||
|
||
We can reshape this new array: | ||
|
||
![image_2022-02-10-16-14-42](/notes/image_2022-02-10-16-14-42.png) | ||
|
||
If we already have a Python list, we can create a NumPy array from it: | ||
|
||
```py | ||
x = [1, 2, 3] | ||
a = np.asarray(x) | ||
``` | ||
|
||
![image_2022-02-10-16-16-26](/notes/image_2022-02-10-16-16-26.png) | ||
![image_2022-02-10-16-18-43](/notes/image_2022-02-10-16-18-43.png) | ||
|
||
## Pandas | ||
|
||
- High performance data manipulation and data analysis | ||
- `DataFrame` object, default and customized indexing | ||
- High efficient merging and joining of data | ||
- Columns from a data structure can be deleted or inserted | ||
- Label based slicing, indexing of large datasets | ||
|
||
### Structures | ||
|
||
- `Series`, 1D labeled homogenous array | ||
- `DataFrame`, 2D labeled hetergenously typed columns | ||
- `Panel`, 3D labeled, size mutable array | ||
|
||
![image_2022-02-10-16-22-17](/notes/image_2022-02-10-16-22-17.png) | ||
![image_2022-02-10-16-24-24](/notes/image_2022-02-10-16-24-24.png) | ||
![image_2022-02-10-16-25-21](/notes/image_2022-02-10-16-25-21.png) | ||
![image_2022-02-10-16-27-17](/notes/image_2022-02-10-16-27-17.png) | ||
![image_2022-02-10-16-28-22](/notes/image_2022-02-10-16-28-22.png) | ||
![image_2022-02-10-16-29-29](/notes/image_2022-02-10-16-29-29.png) | ||
![image_2022-02-10-16-29-57](/notes/image_2022-02-10-16-29-57.png) | ||
![image_2022-02-10-16-30-55](/notes/image_2022-02-10-16-30-55.png) | ||
![image_2022-02-10-16-32-04](/notes/image_2022-02-10-16-32-04.png) | ||
|
||
### Plotting | ||
|
||
![image_2022-02-10-16-33-14](/notes/image_2022-02-10-16-33-14.png) | ||
![image_2022-02-10-16-34-47](/notes/image_2022-02-10-16-34-47.png) | ||
![image_2022-02-10-16-34-57](/notes/image_2022-02-10-16-34-57.png) | ||
![image_2022-02-10-16-35-06](/notes/image_2022-02-10-16-35-06.png) | ||
![image_2022-02-10-16-35-24](/notes/image_2022-02-10-16-35-24.png) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
title: "CS177-lecture-20220215" | ||
# date: 2022-02-15T15:51:31-08:00 | ||
draft: false | ||
bookToc: true | ||
tags: ["data preprocessing"] | ||
--- | ||
|
||
## What is data? | ||
|
||
![image_2022-02-15-17-01-41](/notes/image_2022-02-15-17-01-41.png) | ||
![image_2022-02-15-17-04-43](/notes/image_2022-02-15-17-04-43.png) | ||
|
||
### Attributes | ||
|
||
![image_2022-02-15-17-04-58](/notes/image_2022-02-15-17-04-58.png) | ||
![image_2022-02-15-17-06-10](/notes/image_2022-02-15-17-06-10.png) | ||
![image_2022-02-15-17-08-10](/notes/image_2022-02-15-17-08-10.png) | ||
![image_2022-02-15-17-10-53](/notes/image_2022-02-15-17-10-53.png) | ||
|
||
### Difference between ratio and interval | ||
|
||
![image_2022-02-15-17-11-11](/notes/image_2022-02-15-17-11-11.png) | ||
![image_2022-02-15-17-11-17](/notes/image_2022-02-15-17-11-17.png) | ||
![image_2022-02-15-17-11-22](/notes/image_2022-02-15-17-11-22.png) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: "CS177-lecture-20220217" | ||
# date: 2022-02-17T15:56:23-08:00 | ||
draft: false | ||
bookToc: true | ||
tags: ["data preprocessing"] | ||
--- | ||
|
||
## Data preprocessing cont. | ||
|
||
### Attributes cont. | ||
|
||
![image_2022-02-17-16-27-46](/notes/image_2022-02-17-16-27-46.png) | ||
![image_2022-02-17-16-29-13](/notes/image_2022-02-17-16-29-13.png) | ||
![image_2022-02-17-16-30-11](/notes/image_2022-02-17-16-30-11.png) | ||
![image_2022-02-17-16-30-52](/notes/image_2022-02-17-16-30-52.png) | ||
![image_2022-02-17-16-31-26](/notes/image_2022-02-17-16-31-26.png) | ||
![image_2022-02-17-16-35-25](/notes/image_2022-02-17-16-35-25.png) | ||
![image_2022-02-17-16-36-52](/notes/image_2022-02-17-16-36-52.png) | ||
|
||
### Types of data sets | ||
|
||
![image_2022-02-17-16-36-59](/notes/image_2022-02-17-16-36-59.png) | ||
![image_2022-02-17-16-46-03](/notes/image_2022-02-17-16-46-03.png) | ||
![image_2022-02-17-16-47-33](/notes/image_2022-02-17-16-47-33.png) | ||
![image_2022-02-17-16-50-24](/notes/image_2022-02-17-16-50-24.png) | ||
![image_2022-02-17-16-53-27](/notes/image_2022-02-17-16-53-27.png) | ||
![image_2022-02-17-16-54-52](/notes/image_2022-02-17-16-54-52.png) | ||
![image_2022-02-17-16-56-40](/notes/image_2022-02-17-16-56-40.png) | ||
![image_2022-02-17-16-59-14](/notes/image_2022-02-17-16-59-14.png) | ||
![image_2022-02-17-16-59-20](/notes/image_2022-02-17-16-59-20.png) | ||
![image_2022-02-17-17-01-09](/notes/image_2022-02-17-17-01-09.png) | ||
|
||
### Data quality | ||
|
||
![image_2022-02-17-17-02-37](/notes/image_2022-02-17-17-02-37.png) | ||
![image_2022-02-17-17-03-04](/notes/image_2022-02-17-17-03-04.png) | ||
![image_2022-02-17-17-05-15](/notes/image_2022-02-17-17-05-15.png) | ||
![image_2022-02-17-17-05-53](/notes/image_2022-02-17-17-05-53.png) | ||
![image_2022-02-17-17-06-56](/notes/image_2022-02-17-17-06-56.png) | ||
![image_2022-02-17-17-08-32](/notes/image_2022-02-17-17-08-32.png) | ||
![image_2022-02-17-17-10-50](/notes/image_2022-02-17-17-10-50.png) | ||
![image_2022-02-17-17-13-12](/notes/image_2022-02-17-17-13-12.png) | ||
![image_2022-02-17-17-13-20](/notes/image_2022-02-17-17-13-20.png) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
title: "CS191-lecture-20220216" | ||
# date: 2022-02-16T17:56:30-08:00 | ||
draft: false | ||
bookToc: true | ||
tags: [] | ||
--- | ||
|
||
## Project showcase | ||
|
||
![image_2022-02-16-17-56-39](/notes/image_2022-02-16-17-56-39.png) | ||
|
||
## JIRA/Flying donut | ||
|
||
![image_2022-02-16-18-06-32](/notes/image_2022-02-16-18-06-32.png) | ||
![image_2022-02-16-18-08-49](/notes/image_2022-02-16-18-08-49.png) | ||
|
||
## Assignments | ||
|
||
![image_2022-02-16-18-28-05](/notes/image_2022-02-16-18-28-05.png) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
title: "MATH102-lecture-20220208" | ||
# date: 2022-02-08T08:57:44-08:00 | ||
draft: false | ||
bookToc: true | ||
tags: ["divisibility"] | ||
--- | ||
|
||
## Returning to an old problem | ||
|
||
![image_2022-02-08-09-05-07](/notes/image_2022-02-08-09-05-07.png) | ||
![image_2022-02-08-09-05-59](/notes/image_2022-02-08-09-05-59.png) | ||
|
||
## Quiz 1 sols | ||
|
||
![image_2022-02-08-09-06-09](/notes/image_2022-02-08-09-06-09.png) | ||
![image_2022-02-08-09-23-54](/notes/image_2022-02-08-09-23-54.png) | ||
![image_2022-02-08-09-32-03](/notes/image_2022-02-08-09-32-03.png) | ||
![image_2022-02-08-09-40-40](/notes/image_2022-02-08-09-40-40.png) | ||
![image_2022-02-08-09-53-39](/notes/image_2022-02-08-09-53-39.png) | ||
|
||
## 2Th review | ||
|
||
![image_2022-02-08-10-07-17](/notes/image_2022-02-08-10-07-17.png) | ||
![image_2022-02-08-10-14-40](/notes/image_2022-02-08-10-14-40.png) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
title: "MATH102-lecture-20220210" | ||
# date: 2022-02-10T08:58:35-08:00 | ||
draft: false | ||
bookToc: true | ||
tags: ["divisbility", "least common multiple"] | ||
--- | ||
|
||
## 3T solutions | ||
|
||
![image_2022-02-10-09-33-31](/notes/image_2022-02-10-09-33-31.png) | ||
|
||
### Least common multiples | ||
|
||
Consider {{<k>}} a = 2^2 \cdot 5^4 \cdot 7 \cdot 41^{10} {{</k>}} and {{<k>}} b = 5^2 \cdot 19 \cdot 41 \cdot 47^2 {{</k>}}. | ||
|
||
If {{<k>}} M {{</k>}} is a common multiple of {{<k>}} a {{</k>}} and {{<k>}} b {{</k>}}, that means that {{<k>}} a | M {{</k>}} and also {{<k>}} b | M {{</k>}}. | ||
|
||
So what can we say about the pf of {{<k>}} M {{</k>}}? | ||
|
||
The closed form of {{<k>}} M {{</k>}}: | ||
|
||
{{<k display>}} | ||
\begin{aligned} | ||
M &= 2^i \cdot 5^j \cdot 7^r \cdot 19^k \cdot 41^s \cdot 47^t \cdot u | ||
\end{aligned} | ||
{{</k>}} | ||
|
||
where | ||
|
||
{{<k display>}} | ||
\begin{aligned} | ||
i &\geq 2 \\ | ||
j &\geq 4 \\ | ||
k &\geq 1 \\ | ||
r &\geq 1 \\ | ||
s &\geq 10 \\ | ||
t &\geq 2 \\ | ||
u &\in \mathbb{Z} | ||
\end{aligned} | ||
{{</k>}} | ||
|
||
So the shortcut is the union of primes with the higher power in each number. | ||
|
||
<details open> | ||
<summary>Example</summary> | ||
<div class="markdown-inner"> | ||
{{<k>}} a = 2 \cdot 5^3 \cdot 19^4 {{</k>}} and {{<k>}} b = 2^4 \cdot 19 \cdot 41^7 {{</k>}} | ||
|
||
So our {{<k>}} \text{LCM} (a, b) = 2^4 \cdot 5^3 \cdot 19^4 \cdot 41^7 {{</k>}} | ||
</div> | ||
</details> | ||
|
||
<details open> | ||
<summary>Example</summary> | ||
<div class="markdown-inner"> | ||
{{<k>}} a = 2 \cdot 5^3 {{</k>}} and {{<k>}} b = 2^2 \cdot 5^4 \cdot 11^9 {{</k>}} | ||
|
||
So our {{<k>}} \text{LCM} (a,b) = 2^2 \cdot 5^4 \cdot 11^9 {{</k>}} | ||
|
||
Notice that the least common multiple is {{<k>}} b {{</k>}} ({{<k>}} b {{</k>}} is a multiple of {{<k>}} a {{</k>}}). | ||
</div> | ||
</details> | ||
|
||
<details open> | ||
<summary>Example</summary> | ||
<div class="markdown-inner"> | ||
{{<k>}} a = 2^2 \cdot 3^2 \cdot 7 {{</k>}}. | ||
|
||
Find {{<k>}} b {{</k>}} such that {{<k>}} \text{LCM} (a, b) = 2^2 \cdot 3^{15} \cdot 7 \cdot 19^3 {{</k>}} | ||
|
||
{{<k>}} b = 2^2 \cdot 3^{15} \cdot 7 \cdot 19^3 {{</k>}} | ||
</div> | ||
</details> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: "MATH102-lecture-20220215" | ||
# date: 2022-02-15T08:59:26-08:00 | ||
draft: false | ||
bookToc: true | ||
tags: ["least common multiple"] | ||
--- | ||
|
||
![image_2022-02-15-09-00-39](/notes/image_2022-02-15-09-00-39.png) | ||
|
||
## Quiz 2 solns | ||
|
||
![image_2022-02-15-09-01-37](/notes/image_2022-02-15-09-01-37.png) | ||
![image_2022-02-15-09-04-40](/notes/image_2022-02-15-09-04-40.png) | ||
![image_2022-02-15-09-11-30](/notes/image_2022-02-15-09-11-30.png) | ||
|
||
## 3Th solns | ||
|
||
![image_2022-02-15-09-13-41](/notes/image_2022-02-15-09-13-41.png) | ||
![image_2022-02-15-09-29-52](/notes/image_2022-02-15-09-29-52.png) | ||
|
||
## Some word problems | ||
|
||
![image_2022-02-15-09-33-46](/notes/image_2022-02-15-09-33-46.png) | ||
|
||
1. Yes | ||
2. No | ||
3. {{<k>}} \text{gcd} (220,308) {{</k>}} | ||
|
||
![image_2022-02-15-09-37-58](/notes/image_2022-02-15-09-37-58.png) | ||
![image_2022-02-15-09-58-20](/notes/image_2022-02-15-09-58-20.png) | ||
|
Oops, something went wrong.