你是否好奇数据可以告诉你什么？你是否想在关于机器学习促进商业的核心方式上有深层次的理解？你是否想能同专家们讨论关于回归，分类，深度学习以及推荐系统的一切？在这门课上，你将会通过一系列实际案例学习来获取实践经历。在这门课结束的时候，

Loading...

来自 University of Washington 的课程

机器学习基础：案例研究

7696 个评分

你是否好奇数据可以告诉你什么？你是否想在关于机器学习促进商业的核心方式上有深层次的理解？你是否想能同专家们讨论关于回归，分类，深度学习以及推荐系统的一切？在这门课上，你将会通过一系列实际案例学习来获取实践经历。在这门课结束的时候，

从本节课中

Welcome

Machine learning is everywhere, but is often operating behind the scenes. <p>This introduction to the specialization provides you with insights into the power of machine learning, and the multitude of intelligent applications you personally will be able to develop and deploy upon completion.</p>We also discuss who we are, how we got here, and our view of the future of intelligent applications.

- Carlos GuestrinAmazon Professor of Machine Learning

Computer Science and Engineering - Emily FoxAmazon Professor of Machine Learning

Statistics

[MUSIC]

So, hopefully this gets you started with Python, the programming language

with the iPython Notebook, and a little bit of iterating the console.

We're gonna be using this console again and again, it's really a fun,

simple way to manage and interact with data.

And there's also tools for visualizing, for navigating, for

doing machine learning in this Python space.

So, it's really a great programming language for us.

And, in fact, there's been a lot of surveys

that say most recently Python is the programming language for data science and

that's why we picked it for this course.

As a final step, let's talk about creating functions in Python.

It's actually pretty easy to create a wide range of functions within Python and

it's pretty natural.

So there's two ways of doing it.

So let's go ahead and get started.

So, again ask m for a text box and

we're gonna talk about

creating functions in Python.

Okay, so the first way is using the def command.

So this is defining a function, let's say a fun function,

add 2 which takes an element x and adds 2 to it.

So we write def add2, and in parenthesis, you put the number of parameters you have,

there is this x, you could have x, y, z, and so on.

And then you put a colon at the end.

And just like with flukes, we want to align in vertically,

kinda tabulated, until we've written out all the function we want to do.

So for example, we could say y is equal to x

plus 2, and then we say return y.

So here we defined a function add 2.

So let's, remember integer value i, let's just set it to some number,

let's say we say that i is equal to 5, and we say

add 2 with the input i and we get 7.

Voila.

The second way to define functions is using what Python calls lambda's, and

these are for simple functions and it's useful to know it.

It's used in a variety of places where you just do a simple transformation,

even add to is a simple transformation so for example,

let's create a function called square.

So this is the square function,

which is a lambda that takes into input x and returns x times x.

So if I read this to you when defining a function, this land is a function,

takes x's input and returns x times x.

That's what it tells us after the column.

So we defined that and now we can apply square to anything we want, so

for example.

If we say what is the square of 3, it should say 9 and

there we go, two ways to define functions in Python.

Now we have the grasps of Python's basics, they can used for

all assignments we're gonna be building up in this first course.

[MUSIC]