58 Matching Annotations
  1. Feb 2023
  2. Jan 2023
  3. Sep 2022
  4. Dec 2021
  5. Nov 2021
    1. To do this we will follow these steps: Pick a random value for m and b Compute the MSE for all our known points Repeat the following steps 1000 times 1. Make m slightly bigger and recompute the MSE does that make it smaller? If so then use this new value for m. If it doesn’t make MSE smaller than make m slightly smaller and see if that helps. 1. Make b slightly bigger and recompute the MSE does that make it smaller? If so then use this new value for b and go back to step 3a. If not then try a slightly smaller b and see if that makes the MSE smaller if so keep this value for b and go back to step 3a. After repeating the above enough times we will be very close to the best possible values for m and b. We can now use these values to make predictions for other pizzas where we know the diameter but don’t know the price.

      Do this in Activity 5, not Activity 4.

  6. Oct 2021
    1. Make a bar chart that shows the total amount of money loaned in each country. Save & RunLoad HistoryShare Code

      One will need to preprocess the data to determine the totals first before feeding it into Altair here (or use color).

  7. Sep 2021
    1. Write code that asks the user to input a year and output True if it’s a leap year, or False otherwise. Use if statements.

      Rewrite: you are provided with a list years of integers; create another list is_leap_year of boolean variables telling whether the corresponding integers in years are leap years or not. You don't need to ask the user for input.

  8. Apr 2021
    1. import pandas as pd stations = pd.read_csv("https://media.githubusercontent.com/media/RunestoneInteractive/httlads/master/Data/bikeshare_stations.csv") stations.head()

      Upload the bikeshare.db file into Colab first, then use the following:

      import pandas as pd stations = pd.read_sql_query("""select * from bikeshare_stations where latitude is not NULL""",'sqlite:///bikeshare.db') stations.head()

    1. stations = pd.read_csv("https://media.githubusercontent.com/media/RunestoneInteractive/httlads/master/Data/bikeshare_stations.csv")

      The link is broken; just use the code above to create the stations DataFrame.

    1. nx

      Need to "import networkx as nx" first.

      On Colab, I needed to run the following:

      import networkx as nx

      from networkx.drawing.nx_agraph import graphviz_layout

      !apt install libgraphviz-dev

      !pip install pygraphviz

    1. alt.Chart(undf).mark_bar().encode(x=X('sentiment', bin=True), y='count()')

      If running in Colab, use the following code alt.data_transformers.disable_max_rows() alt.Chart(undf[['year','sentiment']]).mark_bar().encode(x=alt.X('sentiment', bin=True), y='count()')

  9. Mar 2021
    1. Paste the following URL in your web browser: https://restcountries.eu/rest/v2/alpha/usa and make a request

      No need to do this - just paste the code below into Jupyter lab. (Pasting this in the browser will retrieve the same data that you retrieve in the code block below.)

  10. Feb 2021
    1. How many movies with a budget of over a million dollars and whose title starts with an “A” or a “B” are there?

      If you get 881, you've used "original_title" as your index. Instead use "title".

    1. Q-3: Which two factors have the largest negative correlation?

      Note that both words in the titles need to be capitalized (even if not capitalized in the sheet).

    2. Q-2: Which two factors have the largest positive correlation (not including the diagonal)?

      Must be in a particular order (the reverse order is marked as wrong)

  11. Mar 2020
  12. Feb 2020
    1. less than 10 minutes (you can’t get into it if it’s too short) or longer than 3 hours

      Has to be >= 10 and <= 180 (or <180) to get an answer that the books considers correct

    1. Q-2: Which two factors have the largest positive correlation (not including the diagonal)?

      Must be put in order (i.e., if in "reverse" order, Runestone marks it as incorrect).