- 博客(20)
- 收藏
- 关注
原创 6.13 sklearn
\机器学习相关内容(不是特别懂)简单的来说就自己随机生成一个数据集,然后用3种拟合算法拟合,然后评估这个模型拟合的效果。代码如下from sklearn import datasets from sklearn import model_selection from sklearn.naive_bayes import GaussianNB from sklearn.svm import SVC ...
2018-06-20 00:20:41
234
原创 5.30python scipy
import scipy.linalg import numpy as np m = 20 n = 10 A = np.random.normal(size = (m,n)) b = np.random.normal(size = (m,1)) x, residual, _, __ = scipy.linalg.lstsq(A, b) print("x:",x) print("residual...
2018-06-03 17:36:53
272
原创 5.23 Matplotlib
import matplotlib.pyplot as plt import numpy as np import math x = np.linspace(0,2,1000) y = np.power(np.sin(x-2),2) * np.power(math.exp(1),-np.power(x,2)) plt.plot(x,y) plt.xlabel("x-axis") plt.yla...
2018-05-29 14:07:27
289
原创 5.16 numpy exercise
toep = list(i for i in range(1,501)) A = np.random.normal(size= (200, 500))
2018-05-20 17:20:20
289
原创 5.2python leetcode 120
120. TriangleGiven a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4],...
2018-05-06 17:42:39
187
原创 4.28python Leetcode 213
213. House Robber IIYou are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle. That means...
2018-05-06 13:41:58
237
原创 4.25python Leetcode 45
45. Jump Game IIGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.You...
2018-04-30 23:20:27
378
原创 4.23python Leetcode array 41
Leetcode41. First Missing PositiveGiven an unsorted integer array, find the smallest missing positive integer.Example 1:Input: [1,2,0] Output: 3 Example 2:Input: [3,4,-1,1] Output: 2 Example 3:Input: ...
2018-04-29 22:01:16
201
原创 4.9python作业
# 11-1city_funcitons.pydef city_function(city, country): return city + ', ' + countryimport unittest from city_functions import city_function class TestCityFunction(unittest.TestCase): def te...
2018-04-15 14:26:32
264
原创 4.4python作业
# 10-4 file_name = 'guest_book.txt' with open(file_name, 'a') as file: while(True): name = input("Please enter your name:") if(name == 'quit'): break file.writ...
2018-04-08 12:39:15
205
原创 4.2python作业
# 9-1 & 9-4 class Restaurant(): def __init__(self, name, type_): self.restaurant_name = name self.cuisine_type = type_ self.number_served = 0 def describe_restaura...
2018-04-04 20:38:13
298
原创 3.28python作业
# 8-2 def favorite_book(book_name): print("One of my favorite book is "+ book_name) favorite_book('Sherlock') # 8-5 def describe_city(city, country = 'China'): print(city + " is in " + coun...
2018-04-01 14:31:08
187
原创 3.26python作业
# 7-2 num = input("How many people do you have?") num = int(num) if (num >= 8): print("Sorry, there are no desk available.") else: print("Welcome. This way please.") # 7-5 while True: ...
2018-03-28 20:41:04
247
原创 3.21python作业
# 6-1 friend1 = { 'first_name' : 'Donald', 'last_name' : 'Trump', 'age' : '71', 'city' : 'New York', } for key in friend1: print(key + ' is '+friend1[key]) # 6-5 rivers = { ...
2018-03-24 00:25:01
286
原创 3.19python作业
# 5-3 alien_color = 'green' if alien_color == 'green': print('You get 5 points!') # 5-4 alien_color = 'red' if 'green' == alien_color: print('You get 5 points!') else: print('You get 10 p...
2018-03-24 00:24:43
197
原创 3.14python作业
# 4-2 animals = ['cat', 'dog', 'tiger'] for animal in animals: print(animal) for animal in animals: print('A ' + animal + ' would make a great pet') print('Any of these animals has a mouth!'...
2018-03-15 16:45:44
502
原创 3.12python作业
# 3-1 names = ['James', 'Trump', 'Mike', 'John'] print(names[0]) print(names[1]) print(names[2]) print(names[-1]) # 3-4 names = ['James', 'Trump', 'John'] print(names[0] + ', I invite you to my dinn...
2018-03-14 00:30:12
435
原创 3.7python作业
# 2-1 msg = "aa" print(msg) # 2-2 msg = 'aaa' print(msg) msg = 'bbb' print(msg)#2-3 name = "Control_xu" print("Hello " + name + ", how are you?")#2-4 name = 'Donald trump' print(name.upper()) print(...
2018-03-10 17:16:58
437
原创 3.5python作业
1、看了python主页,看到python版本的发布还是非常快的,基本一个月就有一个新版本,而且还是3.6和3.7同时进行的,说明这个语言的更新非常快,在目前具有强大的生命力,而且有横向的竞争。在主页看到一些基本的语法,应该是比c/c++方便的,定义变量不需要声明类型,直接用就可以,而且不用考虑溢出,十分友好。2、如果学了python,应该会试着开发一些程序。最希望的还是开发一些人工智能、机器学习...
2018-03-07 10:39:53
238
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人