27 thoughts on “Data Science Hwk”

  1. I'm not able to access the link to the google collab or the dropbox. What can I do about it?

    1. Opening the link using google chrome will allow you to see and edit the notebook. Other browsers like firefox and edge will give you the error.

  2. Can you provide some details on this? Do you get an error message when you try to access? If so, what does the message say? Any details would be helpful.

    1. I do indeed get an error message when I try to access them. The google Collab gives me the following error:

      Notebook not found
      There was an error loading this notebook. Ensure that the file is accessible and try again.
      Ensure that you have permission to view this notebook in GitHub and authorize Colaboratory to use the GitHub API.

      https://github.com/ebilionis/core-me-data-science-activitiespublic/blob/master/me274/activity_01.ipynb

      Also, the dropbox gives me the following error:
      That didn't work for some reason
      If it's a fluke, it might work if you refresh the page. You can also ask us for help.

      1. Thanks for the information. We have heard from one person that not all browsers work well with the link. Chrome was identified as one that does work. Give that a try, and let us know.

        1. Thank you for that information. I've been using google chrome, and it wasn't working. However, using Incognito mode on chrome allowed me to access the file. I don't know why that worked, but it did.

  3. There appears to be an issue with some of the print statements so you may need to rewrite some of the code. Also, try changing the variables used in the frequency statement (involving <) to find the frequency that values fall below your max speed with the inputted speed limit.

  4. While completing the python task I found that there are some parts that need an equation changed to match that of what was solved in the textbook. I also noticed that most of the print statements don't work so I deleted them and rewrote them in a correct format. I was able to find print statement examples online.

  5. For question 10 we are given the values for the radius of curvature as 200 m and the angle to be 10 degrees. We can use the code from before to find the max speed around the corner. But we need data to find a speed limit where 99 percent of people will follow that. How are we supposed to get the data as the data we have is only for 100 m but the same angle of 10 degrees?

  6. To confirm, the speed limit for question 10 will have to be selected from the existing 10 kph values in the data set? Additionally, for questions 6 and 7 is it reasonable justification to choose a value that would result in being below the maximum speed limit 75% of the time?

  7. Anyone else having a problem getting it to save as a pdf? Every time I try and save it as a pdf it either: 1) doesn't load the graphs, 2) doesn't load all the code.

    1. Hi, I am also facing the same issue. Is there a fix for it, or is it ok to screenshot and submit as pdf?

    2. Me too, also there is no question 8 on the hw, so what do we do with matching question 8 on gradescope?

      1. I set the last page of question 7 also as question 8 just to assign the problem on Gradescope to a page, but I do not know what they expect us to do.

    3. What worked for me was to save the code locally as a Jupyter Notebook. If you export it to an html file using whatever IDE that supports Jupyter Notebooks (as far as I know you can't do this directly via collab) and then "print" that html to PDF you should have everything format nicely.

    4. Add a code section to the bottom of your notebook and copy and paste this code and run it:
      # Colab2PDF v1.0.4 by Drengskapur (github.com/drengskapur/colab2pdf) (License: GPL-3.0-or-later)
      # @title {display-mode:"form"}
      # @markdown ⬇️ Download PDF
      def colab2pdf():
      ENABLE=True # @param {type:"boolean"}
      if ENABLE:
      !apt-get install librsvg2-bin
      import os, datetime, json, locale, pathlib, urllib, requests, werkzeug, nbformat, google, yaml, warnings
      locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
      NAME = pathlib.Path(werkzeug.utils.secure_filename(urllib.parse.unquote(requests.get(f"http://{os.environ['COLAB_JUPYTER_IP']}:{os.environ['KMP_TARGET_PORT']}/api/sessions").json()[0]["name"])))
      TEMP = pathlib.Path("/content/pdfs") / f"{datetime.datetime.now().strftime('%Y%m%d_%H%M%S')}_{NAME.stem}"; TEMP.mkdir(parents=True, exist_ok=True)
      NB = [cell for cell in nbformat.reads(json.dumps(google.colab._message.blocking_request("get_ipynb", timeout_sec=600)["ipynb"]), as_version=4).cells if "--Colab2PDF" not in cell.source]
      warnings.filterwarnings('ignore', category=nbformat.validator.MissingIDFieldWarning)
      with (TEMP / f"{NAME.stem}.ipynb").open("w", encoding="utf-8") as nb_copy: nbformat.write(nbformat.v4.new_notebook(cells=NB or [nbformat.v4.new_code_cell("#")]), nb_copy)
      if not pathlib.Path("/usr/local/bin/quarto").exists():
      !wget -q "https://quarto.org/download/latest/quarto-linux-amd64.deb" -P {TEMP} && dpkg -i {TEMP}/quarto-linux-amd64.deb > /dev/null && quarto install tinytex --update-path --quiet
      with (TEMP / "config.yml").open("w", encoding="utf-8") as file: yaml.dump({'include-in-header': [{"text": r"\usepackage{fvextra}\DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaksymbolleft={},showspaces=false,showtabs=false,breaklines,breakanywhere,commandchars=\\\{\}}"}],'include-before-body': [{"text": r"\DefineVerbatimEnvironment{verbatim}{Verbatim}{breaksymbolleft={},showspaces=false,showtabs=false,breaklines}"}]}, file)
      !quarto render {TEMP}/{NAME.stem}.ipynb --metadata-file={TEMP}/config.yml --to pdf -M latex-auto-install -M margin-top=1in -M margin-bottom=1in -M margin-left=1in -M margin-right=1in --quiet
      google.colab.files.download(str(TEMP / f"{NAME.stem}.pdf"))
      colab2pdf()

  8. Just wanted to let you all know that both the videos under the additional resources are the same, the dropbox and youtube, and that the youtube one worked for all the browsers I had.

    1. I parsed through the different speed limits from questions 7 and 9 until I found a probability of less than 1% at the max speed I calculated previously and used that specific speed limit as my data for the rest of the problem.

  9. Whenever I try to save my document as a PDF, the code and graph I have for Question 10 either cuts of or displays really weirdly. What have people done to successfully save this?

    1. I had this same problem. Try adding a bunch of blank rows beneath your final text of value, it worked for me.

    2. Adding text or blanks as mentioned helped me get a proper pdf. And if you still have issues, it may help to mess around with the scale or even the paper size.

  10. I had trouble accessing the website link on my computer (tried Chrome, Firefox, Edge, Incognito Chrome). Oddly enough, it worked on the first try on the Edge app on my iPad. Not sure if this is useful but thought I’d share.

  11. When it says "write the code...", are we actually supposed to modify the code or is it just saying what was done?

  12. When creating into pdf I found it useful to lower the scale and convert it from portrait to landscape. This fixed my issue of
    the pdf cutting off most of my question ten.

Comments are closed.