A newcomer to the Python machine learning password

Source: Internet
Author: User
Tags install pandas

Machine learning the fire has been so well known lately. In fact, the landlord's current research direction is the hardware implementation of elliptic curve cryptography. So, I've always thought that this is unrelated with python, neural networks, but there is no shortage of great gods who can open the ground for evidence and to serve sentient beings. Give me a chestnut. This article learing the Enigma with recurrent neural Networks. is an article published in AAAI in 2017, AAAI 2017 refers to the 31st session of the Artificial Intelligence conference AAAI-17, is one of the most heavyweight in the field of artificial intelligence. So the landlord is also very curious, here is the rnn of a century before us a simple multi-table substitution password Enigma do what, will be so valuable. Speaking of Enigma, I also strongly push a wave of luck temperament Turing great God version of the film "Imitation Game", mainly about the World War II, Hitler led by the Nazi state relies on Enigma cryptographic devices encrypted communications, the war winds up the wind. The so-called magic tall feet, the allies appeared to Turing-led scientific research team, a variety of plot transforms may have lost the truth, but the outcome is very surprise, Turing successfully cracked the password machine. Well, to the next, this paper, I looked carefully, and translated it into Chinese with rnn learning Enigma. And then, according to the paper, I went to GitHub to download the code.
As a python full of small white, the next is impatient to try to try out these code really as described in the article so witty.

Python development Environment Building

Today we mainly talk about the problem of environment configuration. That's really the place that gives me headaches. Tried a lot of options have failed.
As for the environment in fact, the author also told in detail, in order to successfully run through other people's code, or honest in accordance with the environment of others to configure. But for those of us who normally use the Python environment, the following scenarios are available. The specific use of which, according to their own needs to decide.

Scenario One: Simple and rude direct download Python3.6

Download Python3.6python official website directly. Specific process installation such as:
1, download, take Windows system as an example.

2, it is best to put the software installation package organized in other than the system disk, each software installed on the computer to create a separate folder, the best name is English, especially technical software, to avoid unnecessary trouble later. Clear classification, but also conducive to future clearance. Immediately after you double-click the downloaded Python36 application, enter the following interface: (Recommended custom installation, the software installs itself, and if you do not want to manually add environment variables, hereAdd Python 3.6 to PATHBe sure to check it out)

3, check the custom installation, the following is the next.

4, choose your own installation of the program folder, it is best to install the path to build their own install folder, you can put all the installation of the configuration files included in a folder.

5, wait for the installation to complete.

6. After the installation is complete, turn off the page. Shortcut key win+r, enter CMD to open the Command window, enter Python, you can see the following Python version information, the installation was successful.

7. If the input Python returns, the following window appears. Is the step 2 in the Wood check automatically add the path, you need to add the path.

8, the method of adding a path on the Internet a lot, I simply describe the picture is not put. Desktop--right--computer--Properties--Advanced system settings--advanced--environment variables--User variable-->path (added here in the user variable's path, before I install other software, There is a problem to see there is said to add the path in the system variable path, in fact, the computer search software when the first search system environment variables, if not found to search user variables, so directly fill in the path of the user variable path can be)--edit. At this point, go back to the Python installation path and enter scipts to find Python.exe to copy its path. Paste to the path path to the front note the semicolon is separated from the next drive letter.
9. At this point, we can start with a simple start-up statement by opening the Python shell, starting with all Programs-->python-->python idle. This is a python-brought IDE, it is simple and fast, learning Python test or writing small software is very convenient, small footprint. As for the various package, can be installed according to the needs of their own projects. That in the management of the package, Anaconda really useful, the following will focus on.

Scenario Two: Eclipse+pydev for Python project development

When it comes to eclipse, it is well known that Java project Development, Eclipse is the Java IDE, powerful, and eclipse write Python or Java can, support cross-platform on Mac, Linux, Windows can run. The normal operation of Eclipse must be preceded by a Java JDK environment. So let's configure it in the following steps.
1, install the JDK, choose to match their own computer version download, installation is relatively simple, you can refer to the relevant instructions. The method of adding environment variables is the same as above. Version can be selected according to their own computer system, how you are Windows 64-bit, then you can download 64-bit or 32-bit. But the next eclipse will install the corresponding version, either 64 or 32. If the computer is 32-bit, install the 32-bit JDK and eclipse. After the JDK installation is complete, after the environment variable is configured, the shortcut key Wina+r,cmd Open the Command window and enter Java, for example, to install successfully.

You can then enterjava -versionView the version of the JDK that is on my computer display:
2. Download the eclipse version that is appropriate for your computer system and consistent with your JDK. The following prompts will appear when you wait for a change.

2, after the successful download, click Unzip to double-click Eclipse.exe directly using Eclipse, it does not need to install and free to use.
3. Install Python, this is exactly the same as the Python installation method in scenario one.
3, then is the plugin pydev download installs. Start Eclipse, click help->install? New? Software ...? In the popup dialog box, click the Add button. Name fill in pydev,location: Http://pydev.org/updates,
-->ok, in the popup dialog box tick pydev.-->next. Be patient and wait.
4. Configure the Python interpreter. After installing Pydev, you need to configure the Python interpreter. Open eclipse,windows-->preferences-->
Pydev->interpreter->python? Interpreter

Then click on the New button on the right, pop up the dialog box, add the interpreter, name can choose according to their preferences.

Clicking Ok,pydev will load the lib file with the Python interpreter itself. Click OK---The >apply configuration takes effect.
At this point, you can start the development of a simple Python program.

Scenario Three: Anaconda+pycharm for Python project development

Anaconda is the package Manager and Environment manager. Anaconda's English is meant to be "python," so we see Anaconda's logo like a encircle python.

We see the Anaconda logo below, The Most Popular Python Data Science Platform OK, why say Anaconda is the most popular Python data science platform? Because Anaconda comes with a large number of common data science packages and their dependencies. So we can use it to process data very conveniently and efficiently. For example, management Packages,anaconda is developed on Conda (a Package Manager and Environment manager). In our project development, we will need to use a lot of third-party Pkg,conda can be very convenient to install and manage these pkg on the computer. There is also a management environment, because the Python2 and Python3 syntax still differs, different projects may require different versions of Python, while installing 2 may cause confusion, Conda can create different operating environments for different projects. So I recommend using Anaconda. Anaconda can be used across platforms (Windows, Mac, Linux).

Installation of Anaconda

1. Download Anaconda. Note that the corresponding version is selected according to the system of your computer, for example, My computer is Windows 64-bit:

2, if the installation of Python,anaconda installed on your computer will not affect, in fact, the use of scripts and programs default Python is Anaconda included with Python. If you are a Windows 10 system, be aware that the right key is running as an administrator when installing the software. Start the installation below, double-click Open. exe file,

3. Agree to the terms:

4, just for me all the way next

5. Choose your favorite single folder, next

6, here Note check, you do not have to install and then manually add the path of Python.

7, then is the rest waits for ING, the time may be slightly longer.



8. After the installation is complete, click Start-All Programs-->anaconda-->anaconda prompt terminal.

9, enter conda list , you can view the content just installed.

10, attention, in order to avoid after the inexplicable error. Here you can enter conda upgrade --all all the software to update. There is a hint in the middle whether the update is input Y. Because the initial installation of the file version is generally older, so the early update can avoid unnecessary trouble.

Conda Management Packages

1, such as we install pandas, open Anaconda Prompt, Syntax format: conda install package_name , so input conda install pandas ,,
To choose a specific version, such as an example, you can enter conda install package_name=1.1 , Conda also automatically installs the dependencies of the required packages, which is really perfect for beginners.

2. Uninstall the unused package. The same is the Anaconda prompt inputconda remove package_name
3, update package, mentioned above update all the files are conda upgrade --all , if you just want to update a specific file,
conda update package_name
4. View the packages that have been installed conda list . This can also be accessed from your own Anaconda installation path, shift+ Right-click here to open the Command window, or you can open and enter conda list :

5, for the environment in this paper, we need to install here is tensorflow1.1,numpy, Open anaconda Prompt, input conda install tensorflow=1.1 , installation see:

You can see that Conda will automatically install the required dependencies for TensorFlow.

6, at this point, Anaconda installation is complete. It has its own integrated installation of Python3,conda and we have installed the required packages, so the next step is to install and configure the development platform Pycharm.

Installation and configuration of Pycharm

1, the official website download Pycharm, chooses with own computer system for the version. You can see that Pycharm has 2 versions, professional full-featured, but requires a fee, but free trial.

2, double-click the installation,


3, install installation, finish.

4. Open Pycharm-->accept-->ok

Trial 30 days, cracked words we can go to search methods, I now use is a trial.


The ok,pycharm can be tested normally.
5, the following are some pycharm configuration problems. Because the initial version of the Pycharm is very small, many places may make us feel uncomfortable looking. So the appropriate adjustment to more in line with our custom style also helps us to learn. The configuration can be done without opening or creating a new project:

A. Theme Settings
Access to Settings-->appearance & Behavior-->appearance

Darcula dark gray background, eye protection.
B, font settings
You can quickly search by entering a font directly in the search box, and then set relevant parameters according to your own relevant settings.

Settings can also set a variety of styles, the method is this way, the rest of us can be set according to their own preferences.

Project Commissioning

For the project in this paper, the development of the environmental scheme three has been set to complete. Then let's run this program briefly.
1. After downloading the code from Githu, place the. py file in a project folder with the name of any folder (except Chinese). Open Pycharm, after launching, click Open directly to find the project file you downloaded opens.

2. I am a project page that I have run through before. If you are open for the first time, don't be busy running the main program, start by setting up the interpreter. Still departing from settings, as shown.

3, add the Interpreter: Click the box out the Settings button--->add and then select the Anaconda installation folder Python36, which is pycharm will automatically load its included packages, As we have just installed the tensorflow1.1 version, the last item is the latest version, you can choose to upgrade or not. After the Python interpreter is selected, OK is OK.

4, return to the main page, the top of the box above the inverted triangle point to open the editing configuration, otherwise the green running symbol is gray, unavailable state.

5, click the Green + in the box, choose Python, the rest as shown in the figure can be.

6. After returning to the main page, click the run symbol in the red box directly, the program is running.

The program ran into a problem: The codec problem in Python, is looking for data, will continue to update. Everyone has a good opinion and solutions, welcome message to learn together.

Note: 1, everyone in the encounter inexplicable error, not in Anaconda promptconda upgrade --allUpdate all the library files, really can solve a lot of unnecessary trouble.
2. Python2.7 only supports TensorFlow under Mac and Linux. Windows system, PYTHON3 support. The Python core team plans to stop supporting Python 2 in 2020. The NumPy project has supported Python 2 and Python 3 since 2010 and found that supporting Python 2 adds a burden to our limited resources, so the plan will stop supporting Python 2. Now that the Python core team has entered the last few years of community-supported Python 2, the NumPy project unveiled its schedule to phase out the Python 2 support plan to help the downstream ecosystem plan and complete the transition. Until December 31, 2018, all NumPy versions will fully support Python2 and Python3. Starting January 1, 2019, any new feature version will only support Python3. Therefore, for the current Python beginners, do not have to tangle with the two grammatical differences, package support and other issues, directly to the 3-bit standard learning certainly no problem.
Note: The author is also a beginner, there are many omissions in the text, welcome to propose improvements, mutual exchange of learning.

A newcomer to the Python machine learning password

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.