AI 101
import matplotlib.pyplot as plt
def plot(films):
years = list(range(1976, 2027)) # Create a list of years from 1976 to 2024
plt.figure(figsize=(9,1)) # Adjust figure size for better visualization
plt.plot(years, [0] * len(years), color='black', linewidth=2) # Plot a horizontal line
def add_film(name, year, color="green"):
plt.annotate(
name,
xy=(year, 0.0),
xytext=(year, 0.2),
arrowprops=dict(color=color, shrink=0.05, width=1, headwidth=8),
horizontalalignment='center',
verticalalignment='bottom',
fontsize=10,
color=color
)
[add_film(*film) for film in films]
plt.yticks([]) # Remove y-axis ticks as they are not relevant for a horizontal line
plt.grid(True, axis='x', linestyle='--', alpha=0.7)
plt.xlim(1976, 2027) # Set x-axis limits slightly beyond the data range
plt.show()
films = [
["Alien", 1979,"red"],
["A's", 1986],
["A3", 1992],
["Res.", 1997],
["Prom.", 2012,"red"],
["Cov.", 2017,"blue"],
["Rom.", 2024,"purple"],
["AVP", 2004],
["AVPR", 2007],
["P", 1987],
["P2", 1990],
["P's", 2010],
["The", 2018],
["Prey", 2022,"purple"],
]
plot(films)
| Predicted condition | |||
|---|---|---|---|
| Positive (PP) | Negative (PN) | ||
| Actual | Positive (P) | True positive (TP) | False negative (FN) |
| Negative (N) | False positive (FP) | True negative (TN) | |
| Predicted condition | |||
|---|---|---|---|
| Positive (PP) | Negative (PN) | ||
| Actual | Positive (P) | Alien (1979) | Prey (2022) |
| Negative (N) | Covenant (2017) | Aliens (1986) | |
| Predicted condition | |||
|---|---|---|---|
| Positive (PP) | Negative (PN) | ||
| Actual | Positive (P) | 2 | 2 |
| Negative (N) | 1 | 9 | |
\[ \begin{align} \text{Precision} &= \frac{tp}{tp + fp} \\ \text{Recall} &= \frac{tp}{tp + fn} \, \end{align} \]
Amtrak is an ordered pairAmtrak = (Stations, Trains)
| ALBANY | EVERETT | PORTLAND | TUKWILA | EUGENE |
| BELLINGHAM | KELSO/LONGVIEW | SALEM | VANCOUVER BC | OREGON CITY |
| CENTRALIA | MOUNT VERNON | SEATTLE | VANCOUVER WA | TACOMA |
| EDMONDS | OLYMPIA/LACEY | STANWOOD |
| CENTRALIA | OLYMPIA/LACEY | SEATTLE | TUKWILA |
| KELSO/LONGVIEW | PORTLAND | TACOMA | VANCOUVER WA |
Order north-to-south:
Centralia and Keslo/Longview is an edge.
The others, like Seattle and Tacoma, are not edges.
| (SEATTLE, TUKWILA) | (CENTRALIA, KELSO) |
| (TUKWILA, TACOMA) | (KELSO, VANCOUVER) |
| (TACOMA, OLYMPIA) | (VANCOUVER, PORTLAND) |
| (OLYMPIA, CENTRALIA) |
Amtrak recently added lines, including the Hiawatha, with service from Milwaukee to the world’s greatest city, Chicago.
From the grandeur of Grant Park’s Buckingham Fountain to iconic museums and skyscrapers, see for yourself why Chicago was once dubbed “Paris on the Prairie.” Engage in retail therapy on the Magnificent Mile or root for the home team within the friendly confines of famed Wrigley Field.
v
[]e
e and v are “well-formed” if they may be used within a Colab code cell.