Skip to content

Jupyter Notebook Tutorials for Data Extraction, Translation and Loading

License

Notifications You must be signed in to change notification settings

Stimson-Center/stimson-tutorials

Repository files navigation

stimson-tutorials

Table of Contents

Machine Learning Basics

Projects derived from Priya Dwivedi, Data Scientist:

Getting Started on Mac OS

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    xcode-select --install
    brew update
    brew upgrade

    brew install git
    git --version
	git version 2.21.1 (Apple Git-122.3)
    open https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

    brew install python3
    python3 --version 
        Python 3.7.7
        
    pip3 install -U pytest
    py.test --version
        This is pytest version 5.0.1, imported from /usr/local/lib/python3.7/site-packages/pytest.py

    Get tokens from vendors and add the following environment variables
	export GOOGLE_SECRET_API_KEY="38AlphaNumericalCharacters"
	export GOOGLE_SECRET_CUSTOM_SEARCH_ID="21Numerals:11AlphaNumericCharacters"
        export GOOGLE_APPLICATION_CREDENTIALS=~/your_google_application_credential_files.json
        # https://account.mapbox.com/auth/signup/?route-to=%22https://account.mapbox.com/access-tokens/%22
	export MAPBOX_ACCESS_TOKEN="pk.86AlphaNumericCharacters"

get project files

    cd ~
    git clone https://github.com/praktikos/stimson-tutorials.git

Optionally Run Locally in a Terminal or Command Window

    cd ~/stimson-tutorials
    pip3 install -r requirements.txt
    python -m spacy download en_core_web_sm
    python3 -m spacy validate
    ./run_jupyter

Your browser will automatically open to the notebooks folder, click on any iPython tutorial i.e.: LDA_Newsgroup.ipynb

Optionally Run in a Docker Container

    brew install docker
    docker --version

    cd ~/stimson-tutorials
    docker build -t stimson-tutorials .
    docker run --user $(id -u):$(id -g) -p 8888:8888 -v $(PWD):/tf -it stimson-tutorials
You will see:

You are running this container as user with ID 502 and group 20,
which should map to the ID and group for your user on the Docker host. Great!

[I 19:20:00.541 NotebookApp] Writing notebook server cookie secret to /.local/share/jupyter/runtime/notebook_cookie_secret
/usr/local/lib/python3.6/dist-packages/IPython/paths.py:67: UserWarning: IPython parent '/' is not a writable location, using a temp directory.
  " using a temp directory.".format(parent))
[I 19:20:00.733 NotebookApp] Serving notebooks from local directory: /tf
[I 19:20:00.733 NotebookApp] The Jupyter Notebook is running at:
[I 19:20:00.733 NotebookApp] http://5af6308a0461:8888/?token=cc20f287a0db34a4e8303111de9b63d0ad169d1ae2e3fc41
[I 19:20:00.733 NotebookApp]  or http://127.0.0.1:8888/?token=cc20f287a0db34a4e8303111de9b63d0ad169d1ae2e3fc41
[I 19:20:00.733 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 19:20:00.736 NotebookApp] 
    
    To access the notebook, open this file in a browser:
        file:///.local/share/jupyter/runtime/nbserver-1-open.html
    Or copy and paste one of these URLs:
        http://5af6308a0461:8888/?token=cc20f287a0db34a4e8303111de9b63d0ad169d1ae2e3fc41
     or http://127.0.0.1:8888/?token=cc20f287a0db34a4e8303111de9b63d0ad169d1ae2e3fc41     

Open your browser to http://127.0.0.1:8888/?token=..., navigate to notebooks -> tutorials and click LDA_Newsgroup.ipynb

Debugging

Debugging ipython file

  pip3 install -U pytest
  pip3 install -U nbval
  py.test --nbval notebooks/analyze_surveymonkey_results.ipynb
  open https://jsonformatter.curiousconcept.com/

You can copy the contents of a ipynb file and paste into the following JSON validator and Reformatter to fix any issues.

  open https://jsonformatter.curiousconcept.com/

Debugging Docker Virtual Machine

docker run -u $(id -u):$(id -g) -it -v `pwd`:/mnt --entrypoint=/bin/bash  stimson-tutorials
    (you are automatically put into: /mnt )

Contributing

  • Fork it
  • Create your feature branch (git checkout -b your_github_name-feature)
  • Commit your changes (git commit -am 'Added some feature')
  • Make sure to add tests for it. This is important so we don't break it in a future version unintentionally.
  • File an Issue
  • Push to the branch (git push origin your_github_name-feature)
  • Create new Pull Request

About

Jupyter Notebook Tutorials for Data Extraction, Translation and Loading

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages