What do Python? Python's three major application direction


If you are ready to start learning Pythonor you have to start learning Python, then you will be willing to ask themselves: "I use Pythonwhat can you do?"

Ah, this is a difficult question, because there are many applications Python direction. But over time, I found that Python has three main applications direction:

  • Web development
  • Scientific data - including machine learning, data analysis and data visualization
  • script

Let's talk about each in turn.

Web development

Based on recent PythonWeb frameworks (such as the Djangoand Flask) became very popular in Web development.

These Web framework that helps you Pythoncreate server-side code (code-behind) in. This is the code that runs on your server, rather than the user's device and browser (front-end code). If you are not familiar with the difference between the front-end code and back-end code, please see the following footnote.

But wait, why do I need a Web framework?

This is because the Web framework to build a common back-end logic easier. This includes different URL mapping to Python code blocks, processing, database, and generating user sees on his browser HTML file.

Which Python Web framework should I use?

DjangoAnd Flaskare the two most popular Python Web framework. If you are just getting started, I suggest you use one of them.

The main contrast:

FlaskIt provides a simple, flexible and fine-grained control. It is undesirable (it lets you decide how to implement it). DjangoProvides an all-encompassing experience: you can get management panel, database interface, ORMthe directory structure [object-relational mapping] and out of the box applications and projects.

You should choose:

FlaskIf you focus on experience and learning opportunities, or if you want more control over which components to use (such as which database you want to use and how to interact with them).

DjangoIf you focus on the end product. Especially if you are developing a direct application, such as news sites, e-shops or blog, you want to always have an obvious way of doing things.

In other words, if you are a beginner, Flaskit might be a better choice because it has fewer components need to be addressed. Also, if you want more customization, Flaskit is a better choice.

On the other hand, if you want to build something directly, Djangoit may make you get there faster.

Now, if you want to learn Django, I recommend a book called "Django for Beginners" is.

Well, we look at a topic now!

Scientific data - including machine learning, data analysis and data visualization

1. Machine Learning

First, let's review what is machine learning

I think the best way to explain the machine learning is to give you a simple example. Suppose you want to develop a program to automatically detect the content of the picture.

Therefore, the following chart (Figure 1), you want the program to recognize it is a dog.

What do Python?  Python's three major application direction

Given below another (FIG. 2), it is identified that you want to program a table.

What do Python?  Python's three major application direction

You might say, well, I can write some code to do this. For example, if there are many light brown pixels in the picture, then we can say it is a dog.

Or, you can figure out how to detect edges in the picture. Then, you might say, if there are a lot of straight edges, then it is a table.

However, this approach quickly becomes tricky. If the photo does not have a brown-haired white dog how to do? If the picture shows only how the circular portion of the table to do?

That's where machine learning.

Typically realize a machine learning, automatic detection algorithm for a given input mode.

You can give the machine learning algorithms to 1000 photos of dogs and 1,000 photos table. Then, it will learn the difference between a dog and a table. When you give it a dog or a new picture of the table, it will be able to identify which one it is.

I think this is somewhat similar to the way babies learn new things. One thing to know how the baby looks like a dog, the other looks like a table? It may come from a bunch of examples.

You may not have to explicitly tell the baby, "If there is something furry, light brown hair, then it could be a dog."

You might say, "That's a dog. It is also a dog. This is a table. That is a table."

Roughly the same work machine learning algorithms.

You can apply the same ideas apply to:

  • 推荐系统(如YouTube,亚马逊和Netflix
  • 人脸识别
  • 语音识别

等其他场景。

你可能听说过的流行的机器学习算法包括:

  • 神经网络
  • 深度学习
  • 支持向量机
  • 随机森林

你可以使用上述任何算法来解决我之前解释过的图片标注问题。

用于机器学习的 Python

针对机器学习有流行的机器学习库和Python框架。

其中两个最受欢迎的是scikit-learnTensorFlow

scikit-learn附带了一些内置的更流行的机器学习算法。 我在上面提到了其中一些。 TensorFlow更像是一个低级库,允许你构建自定义机器学习算法。

如果你刚刚开始使用机器学习项目,我建议你先从scikit-learn开始。

如果你开始遇到效率问题,那么我会开始研究TensorFlow

我该如何学习机器学习?

要学习机器学习基础知识,请注意,你需要微积分和线性代数的基本知识才能理解这些课程中的一些材料。

2. 数据分析和数据可视化又是怎样呢?

为了帮助你了解这些可能是什么样子,让我在这里给你一个简单的例子。

假设你正在为一家在线销售某些产品的公司工作。

然后,作为数据分析师,你可以绘制这样的条形图。

What do Python?  Python's three major application direction

用Python生成的条形图

从这张图中,我们可以看出,男性购买了超过400个单位的产品,女性在这个特定的星期天购买了约350个单位的产品。

作为数据分析师,你可能会对这种差异提出一些可能的解释。

一个明显可能的解释是,这种产品比男性更受男性欢迎。 另一种可能的解释可能是样本量太小而且这种差异只是偶然造成的。 而另一种可能的解释可能是,男性倾向于仅在周日因某种原因购买该产品。

要了解哪些解释是正确的,你可能会绘制另一个这样的图表。

What do Python?  Python's three major application direction

我们不是仅显示星期日的数据,而是查看整整一周的数据。 如你所见,从这张图中,我们可以看到这种差异在不同的日子里非常一致。

从这个小小的分析中,你可以得出结论,对这种差异最有说服力的解释是,这种产品更容易受到男性的欢迎,而不是女性。

另一方面,如果你看到像这样的图表怎么办?

What do Python?  Python's three major application direction

那么,是什么解释了周日的差异?

你可能会说,也许男人往往只是因为某种原因在周日购买更多的这种产品。 或者,也许只是巧合,周日男人买了更多。

因此,这是数据分析在现实世界中可能看起来像的简化示例。

我在谷歌和微软工作时所做的数据分析工作与这个例子非常相似 - 只是更复杂。 我实际上在谷歌使用Python进行这种分析,而我在微软使用JavaScript

我在这两家公司使用SQL来从我们的数据库中提取数据。 然后,我会使用PythonMatplotlib(在谷歌)或JavaScriptD3.js(在微软)来可视化和分析这些数据。

Python进行数据分析和数据可视化

Matplotlib是最受欢迎的数据可视化库之一。 这是一个非常适合开始学习的库,原因如下:

  • 容易上手
  • 其他一些库如seaborn就是基于它的。 因此,学习Matplotlib将帮助你稍后学习这些其他库。

脚本

什么是脚本?

脚本通常是指编写旨在自动执行简单任务的小程序。

那么,让我举一个我个人经历的例子。

我曾经在日本的一家小型创业公司工作,我们有一个电子邮件支持系统。 这是一个系统,让我们回复客户通过电子邮件发送给我们的问题。

当我在那里工作时,我的任务是计算包含某些关键字的电子邮件的数量,以便我们分析收到的电子邮件。

我们可以手动完成它,但是,我编写了一个简单的程序/简单脚本来自动执行此任务。

实际上,我们当时使用Ruby,但Python也是这类任务的好语言。 Python适合这种类型的任务,主要是因为它具有相对简单的语法并且易于编写。 用它写一些小东西并测试它也很快。

嵌入式应用程序呢?

我不是嵌入式应用程序方面的专家,但我知道Python可以与Rasberry Pi一起使用。 它似乎是硬件爱好者中的一种流行应用。

游戏又如何呢?

你可以使用名为PyGame的库来开发游戏,但它并不是最流行的游戏引擎。 你可以用它来建立一个爱好项目,但如果你认真对待游戏开发,我个人不会选择它。

相反,我建议开始使用UnityC#,这是最受欢迎的游戏引擎之一。 它允许你为许多平台构建游戏,包括Mac,Windows,iOS和Android。

桌面应用又怎样?

你可以使用Tkinter制作一个Python,但它似乎也不是最受欢迎的选择。

相反,似乎Java,C#和C ++等语言更受欢迎。

最近,一些公司也开始使用JavaScript来创建桌面应用程序。

例如,Slack的桌面应用程序是用Electron构建的。 它允许你使用JavaScript构建桌面应用程序。

就个人而言,如果我正在构建一个桌面应用程序,我会使用JavaScript选项。 它允许你重用Web版本中的一些代码(如果有的话)。

但是,我也不是桌面应用程序方面的专家,所以如果你不同意或同意我的意见,请在评论中告诉我。

如果你依然在编程的世界里迷茫,可以加入我们的Python学习扣qun:784758214,看看前辈们是如何学习的。交流经验。从基础的python脚本到web开发、爬虫、django、数据挖掘等,零基础到项目实战的资料都有整理。送给每一位python的小伙伴!分享一些学习的方法和需要注意的小细节,点击加入我们的 python学习者聚集地

Python 3 or Python 2?

I would recommend Python 3, because it is more modern, but at this point it is a more popular option.

Footnote: For an explanation of front-end code and back-end code (in case you are not familiar with these terms):

Suppose you want to make like Instagramstuff like that.

Then, you need to create a front-end code for each type of device you want to support.

You can use, for example:

For iOS Swift JavaScript code for each set of Java for the Web browser for Android will run on each type of device / browser. This will be a set of code, how to determine the layout of the application, appearance and so when the button is clicked.

However, you still need to be able to store user information and photos. You need to store them on a server, not just stored on the user's device, so that each user's followers can see his / her photos.

This back-end code is useless / server-side code. You need to write some back-end code to do the following:

Track who is concerned about who compress photos, so as not to take up too much storage space in the discovery function to each user photos and recommend new account So this is the difference between the front-end and back-end code code.

By the way, Python is not written in the back-end / the only good choice for server-side code. There are many other popular options, including Node.js, it is based on JavaScript.

Guess you like

Origin blog.51cto.com/14510224/2437134