cool hit counter Here, start using Jupyter_Intefrankly

Here, start using Jupyter

I've been watching the Machine Learning course by Enda Wu on B-site recently. After watching the course for 6 weeks I felt that I benefited from the fact that although it was a basic course geared towards non-mathematics majors, the advanced mathematics and linear algebra covered were taught in a way that was easy to understand.

When it comes to machine learning, it naturally involves doing a lot of computation on data, and python provides a very rich resource for this. With the large amount of open source code contributed, the need for a convenient python environment that is not only for development but also for easy testing of algorithms and computation of data is needed to quickly use the wheels that others have built and validate their own data.

Perfect for use when learning python without having to crackle commands in the terminal and write scripts with the IDE editor open specifically to test a snippet of code. It is very easy to use as the code is written and run directly on the web side and the data can be easily drawn by drawing graphs and also supported. As a beginner who is just starting to understand python, after tossing it around, here's a quick note on how to use it.

Installation Instructions

The official website strongly recommends is to install the Anaconda integration suite as Jupyter is already integrated and can be run directly, but my environment does not have Anaconda installed, so I use the most primitive installation method. The specific method can be seen on the official website instructions, in fact, it is very simple, is the most simple pip installation command:

Note that I use pyenv to support multiple versions of python, so pip points to the current python version 3.6.x, whereas without pyenv installed, pip and pip3 might correspond to python2 and python3 on the system, respectively.

It is recommended to use python3, if the local environment also needs to use Node.js, then running node-gyp when installing some npm packages will be an error, because gyp only supports python2, then you need to define the version of python, run the following command to set npm to use n your local python2

If everything goes smoothly, Jupyter has been installed. If there are some modules missing during the installation process, you may need to add them manually and then run the install command.

Start Service

Before starting Jupyter's services, install a couple of extension packages to make it easier to configure and use Jupyter. Run the command.

When finished, run the command :

A default configuration file will be generated, open this file and remove the comments to modify the corresponding parameters. It is recommended to change the path where Jupyter's notebook is stored first. Modify the parameter to a path of your own definition, the default is empty, which is the current user's directory.

Run the command to start the Jupyter service and open the browser access automatically, this is the default Jupyter service binding port, you can change the corresponding binding IP address and port value in the configuration file.

Configuration Services

After entering the Jupyter service home page, you can see the directory where you are currently located, if there is a file with the suffix is the file of the notebook, you can open it directly, if not, click the button on the right side to create a new python3 notebook.

Before creating a new notebook, you can take a look at the tab page, this is the tool that appears after installing the extension package earlier, click on it and you can find a lot of useful extensions inside, just select the ones you need to enable, then go back to the open notebook and refresh it to use it. I have listed some extensions that I personally find useful.



Live Markdown Preview

Python Markdown

Export Embedded HTML

Snippets Menu


Table of Contents (2)

There are many more extensions to use depending on the needs of each individual

Using Jupyter

Write and run the code

Jupyter Notebook is very easy to use, basically follow the buttons and menus on the toolbar and you'll understand it, here is a brief introduction to some areas that are easy to figure out at first

If you are familiar with VIM commands, it will be easy to operate in Notebook, simply press to enter the command line mode, and then press or double-click the mouse to enter the edit mode, there are corresponding shortcut keys in the command line mode for easy operation. But it doesn't matter if you can't figure out anything other than that, all the actions can be found on the menus and toolbars and won't interfere with use.

The New button creates a "cell", which is the default, so to write it you need to toggle it, which can be easily found in the toolbar.

All the input in the unit is code that is run to get the result, and each unit can be run individually, the default is to run the current block and jump the cursor to the next block, with the extension installed there is a new toolbar which has more run options available. If the input is Markdown, then again it needs to be run to see the results. You can see the actual effect immediately after typing Markdown with a shortcut that runs the current unit but still stays in place. If the extension is installed, you can see the effect of Markdown in real time, which is very visual and effective. Markdown also supports LaTeX mathematical formulas, please study them yourself

Execute system commands

If the unit needs to run the OS command, you can prefix the command with run, but please note that it does not change the current running directory, i.e. execution after switching paths several times always shows the notebook_dir path we defined in the configuration file.

Magic Command

And some. Magic Command belongJupyter Notebook The operation itself, The commands all use the beginning, Run to see all the Magic Command, Please also consult the official documentation for specific applications, in usematplotlib When drawing a picture, Errors may occur, Follow the online recommendations, Is tellingJupyter Get allmatplotlib Generated graphics, and embed them all in thenotebook in。 accordingly, Simply enter the following command:

This statement may take a while to execute, but it only needs to be executed once when you open the notebook

I didn't run this magic command in my initial attempts at drawing, so it may have something to do with the installation environment or the code I'm running, and the concurrency requisites


The variables throughout the Notebook are in a namespace, so any variables that have been asserted in the first unit or imported into the module can be used directly in later units, allowing the code to be written in pieces that are easy to debug and view.

After installing the extension, there will be an extra on the menu with code snippets for some common modules, such as generating a multi-dimensional array of data with NumPy, which is great for learning python. Also Markdown syntax snippet, need to insert images, tables when forgetting the syntax is not afraid.

Once you install the extension, you can use it in a Markdown unit to call the variable values in the previous python unit

entrance number

You can also use the code completion shortcut when editing code in the unit. The Tab key is the normal edit indent operation in Markdown, but you can complete the command or prompt code inside Code, which operates the same as the command completion method in Linux.

Cells can use the up and down buttons in the toolbar if they want to adjust their position, while if you want to insert a new block in front of an existing cell, you need to select it in the menu or use the shortcut key

For more shortcuts you can see-

Save Download

What if I hang up after working so hard to write a bunch of content?

Jupyter Noteb has autosave and also executes itself -

Under the menu there are many other formats that can be converted and downloaded, but the corresponding conversion is required to have the corresponding module support, export to does not require a special module, export to also requires the support of other modules, you can try it yourself. After installing the extension, you can export all the content in the current Notebook (including the output) into a static Html page with embedded styles and images for easy placement on other websites.

Adding a new kernel

Jupyter Notebook can use not only python, but also other development languages as kernels. The list of supported kernels is listed in Jupyter's github wiki, so you can choose to install a development language you are familiar with, for example, you can create a Node.js type of Notebook if you install it.

Note that each Notebook can only use one language kernel. In addition to deciding on a kernel when creating a new one, you can also switch kernels after creating a Notebook in Menu - Switch Kernels.

The above is all written in, which is not bad for a web-based Markdown editor, but recommended for everyday use (like writing this text), WYSIWYG, can be exported to various styles, and has cross-platform support for Windows and Mac.

The saved files can be previewed directly on github, which is awesome. What was said before is based on the build, so files that can be created locally can be uploaded directly to Colab for use.

1、Multicloud management tools 6 features organizations may need
2、DAOstacks product launch for the blockchain technology project will take place this spring and the token presale will begin on May 1
3、WebAPP programming model and IO strategy
4、Python standard library 09 current process information os package
5、HDUOJ4004TheFrogx27sGamessecond part simple greed

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送