自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(20)
  • 收藏
  • 关注

原创 sklearn

Code:from sklearn import datasetsfrom sklearn import cross_validationfrom sklearn.naive_bayes import GaussianNB from sklearn.svm import SVCfrom sklearn.ensemble import RandomForestClassifierfrom ...

2018-06-20 11:30:45 230

原创 Anscombe's quartet

%matplotlib inlineimport randomimport numpy as npimport scipy as spimport pandas as pdimport matplotlib.pyplot as pltimport seaborn as snsimport statsmodels.api as smimport statsmodels.form...

2018-06-08 00:30:38 476

原创 10 Scipy

Code:Exercise 10.1: Least squares import scipyimport numpy as npfrom scipy.optimize import minimize def error(x0, A, b): return np.linalg.norm(np.dot(A, x0) - b, ord = 2)m = 15n = 10A = np...

2018-05-31 22:51:00 189

原创 11 Matplotlib

11 MatplotlibExercise 11.1: Plotting a functionPlot the functionf(x) = sin2(x - 2)e-x2over the interval [0; 2]. Add proper axis labels, a title, etc.Exercise 11.2: DataCreate a data matrix X with 20 o...

2018-05-25 15:45:15 298

原创 9 Numpy

Generate matrices A, with random Gaussian entries, B, a Toeplitz matrix, where A 2 Rn×m and B 2 Rm×m,for n = 200, m = 500.Exercise 9.1: Matrix operationsCalculate A + A, AA>; A>A and AB. Write a...

2018-05-22 21:10:47 190

原创 String to Integer (atoi)

Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this ...

2018-05-03 03:45:38 231

原创 Remove Duplicates from Sorted List

Given a sorted linked list, delete all duplicates such that each element appear only once.Example 1:Input: 1->1->2Output: 1->2Example 2:Input: 1->1->2->3->3Output: 1->2->...

2018-04-29 16:27:36 167

原创 Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is defined a...

2018-04-26 13:23:19 178

原创 665. Non-decreasing Array

Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.We define an array is non-decreasing if array[i] <= array[i + 1] holds for eve...

2018-04-24 00:59:01 127

原创 第十一章

11-1#city_functions.pydef city_and_country(city, country): string = city.title() + ', ' + country.title() return string#test_cities.pyimport unittestfrom city_functions import city_and_country...

2018-04-09 17:28:01 150

原创 第十章

10-1with open('learning_Python.txt') as pro: article = pro.read() print(article)with open('learning_Python.txt') as pro: for line in pro: print(line.rstrip())lines = [] with open('learning_...

2018-04-06 14:41:12 173

原创 第九章

9-1class Restaurant(): def __init__(self, name, type_,number_served = 0 ): self.restaurant_name = name self.cuisine_type = type_ self.number_served = number_served def describe_restaurant(s...

2018-04-02 13:38:56 172

原创 第八章

8-1def display_message(): print('I have learnt how to use function in this chapter.') display_message()8-2def favourite_book(title): print('One of my favourite book is ' + title + '.') fa...

2018-03-28 14:01:13 138

原创 第七章

7-1car = input('Please tell me which kind of car you want:\n')print('Let me see if I can find you a ' + car + ' .')7-2seats = int(input('How many seats do you want?\n'))if seats > 8: print('Sorr...

2018-03-26 02:03:20 149

原创 第六章

6-1friend = {'fist_name':'John','last_name':'Steve','age':15,'city':'Guangzhou'}print(friend)6-5rivers = {'nile':'egypt','Changjiang_River':'China','Rhine River':'Germany' }for river,country in...

2018-03-21 20:06:19 142

原创 第五章

5-2print('car'=='car')print('car'=='caa')print('car'!='car')print('car'!='caa')print('car'=='Car'.lower())print('car'=='Caa'.lower())print(2 == 1)print(2 != 1)print(2 > 1)print(2 < 1)p...

2018-03-19 13:23:57 234

原创 第四章

4-2animals = ['cat','dog','bird']for animal in animals: print(animal) print('A ' + animal + ' would make a great pet.')print('Any of these animals would make a great pet.')4-3for num in range(1,21...

2018-03-15 13:26:33 215

原创 第三章作业

3-1names = ['Joker','James','Key']print(names[0])print(names[1])print(names[2])3-2names = ['Joker','James','Key']for name in names: print('Hello, '+name)3-3vehicles = ['car','bike','boat','plane'...

2018-03-12 17:04:03 179

原创 No.2

2-1message = 'hello,world'print(message)2-2message = 'hello,bit'print(message)2-3name = 'Eric'print('"Hello '+name+', would you like to learn some Python today?"')2-4name = "huang zilin"print(name...

2018-03-11 17:29:40 169

原创 No.1

    浏览python主页后的发现及收获:    在python主页浏览的主要是python的一些基本信息,特点、编译环境、语法等等,发现python主要有以下特点:    python的语法非常简洁,许多语句的写法非常接近人的思维,很容易理解,且因为是动态语言,连变量的声明都不需要,实现相同的功能时,代码量明显少于c或者c++,但是为此python也付出了代价,python程序的运行时间是远超...

2018-03-11 16:15:02 225

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除