- 博客(18)
- 收藏
- 关注
原创 高级编程作业 机器学习
题目如下: 解题思路如下: 依据pdf资料的函数建立数据集,并分别使用三种方法进行分析。 通过实验结果发现: RandomForestClassifier的方法效果最佳 SVC的方法效果次之from sklearn import datasets from sklearn import cross_validationfrom sklearn import metrics...
2018-06-18 17:18:58 352
原创 高级编程作业 jupyter:Anscombe's quartet
作业题目如下: 第一题: 代码如下:import numpy as npimport scipy.statsimport pandasimport matplotlib.pyplot as pltimport seaborn as snsimport statsmodels.api as smdef get_var(X): length = len(X)...
2018-06-11 17:27:37 301
原创 高级编程作业 scipy
本次作业是如下三题: 10.1:代码如下:import numpy as npimport scipy.optimizedef solve_1(m,n): A = np.random.randn(m, n) b = np.random.randn(m) x = scipy.optimize.lsq_linear(A, b) print(x.fun...
2018-06-05 15:30:21 529
原创 高级编程 Matplotlib 作业
本次作业题目如下: 11.1 代码如下:import matplotlibimport numpy as npimport matplotlib.pyplot as pltimport numpy as npx = np.linspace(0, 2, 100)y = np.sin(x-2)*np.sin(x-2)*np.exp(-(x*x))plt.plot(x, ...
2018-05-29 15:56:26 253
原创 高级编程作业 Numpy系列
本次作业题目如下: 首先,先生成矩阵A,B:from numpy import *from scipy.linalg import toeplitzn = 200m = 500A = random.randn(n,m)col = random.normal(size=m)row = random.normal(size=m)B = toeplitz(col,row)...
2018-05-22 14:55:12 655
原创 高级编程5.2日作业
组合总和 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。candidates 中的数字可以无限制重复被选取。说明:所有数字(包括 target)都是正整数。 解集不能包含重复的组合。 import copyclass Solution: def sumof(...
2018-05-03 15:49:07 199
原创 高级编程作业 leetcode (三次作业三题合并) 五一节前 所有作业
第一题 : 283. 移动零 给定一个数组 nums, 编写一个函数将所有 0 移动到它的末尾,同时保持非零元素的相对顺序。例如, 定义 nums = [0, 1, 0, 3, 12],调用函数之后, nums 应为 [1, 3, 12, 0, 0]。注意事项:必须在原数组上操作,不要为一个新数组分配额外空间。 尽量减少操作总数。class Solution: def ...
2018-05-01 13:56:21 190
原创 第十一次高级编程作业
11-1 城市和国家 city_functions.py 部分def city_functions(city,country): full_name = city.title() + ", "+country.title(); return full_name测试程序部分:import unittestfrom city_functions import ...
2018-04-16 09:31:39 241
原创 第十次高级编程作业
10-1 Python 学习笔记filename = 'Python remark.txt';with open(filename) as file_object: contents = file_object.read() print(contents); for statement in file_object: print (statemen...
2018-04-06 13:58:53 136
原创 第九次高级编程作业
9-1餐馆class Restaurant(): def __init__(self,restaurant_name,cuisine_type): self.restaurant_name = restaurant_name; self.cuisine_type = cuisine_type; def describe_restaurant(...
2018-04-06 10:33:06 199
原创 第八次高级编程作业
8-2 喜欢的图书def favourite_book(_title): print("My favourite book is "+ _title.title());favourite_book("The three body problem");8-4大号T恤def make_shirt(size,str = "I love Python"): prin...
2018-03-29 20:44:57 208
原创 第七次高级编程作业
7-2餐馆定位num = input("How many people have dinner in this resturant?");num = int(num);if num > 8: print("There is no empty desk");else: print("There are still some empty desks");7-4比...
2018-03-29 19:24:46 157
原创 第六次高级编程高级作业
6-2 喜欢的数字favourite_number ={ 'Bob' : '12', 'Tom' : '6', 'Lucy': '7', 'Coco': '9', 'Pat' : '22'}my_friends = ['Bob','Tom','Lucy','Coco','Pat'];for my_friend in my_friends...
2018-03-24 09:01:51 195
原创 第五次高级编程作业
5-3 外星人颜色#1alien_color = 'green';if alien_color == 'green': print('you get five point');alien_color = 'red';if alien_color == 'green': print('you get five point');5-4 外星人颜色#3alien_c...
2018-03-23 19:38:46 187
原创 第四次高级编程作业
4-1披萨pizzas = ['chicken', 'beef' , 'pork'];msg = "pizza is so delicious~";for pizza in pizzas: print(pizza + ' ' +msg);print('all these pizza are deilcious');4-6奇数sinum=[];for i in r...
2018-03-17 10:34:00 275 2
原创 高级编程第三次作业
3-2问候语name = ['Tim', 'Tom', 'Pat']msg = 'hello, 'print(msg + name[0])print(msg + name[1])print(msg + name[2])3-5 修改嘉宾名单guest = ['Tom','Tim','Harry']msg = 'Hello, can you have dinner tog...
2018-03-17 09:17:48 223
原创 高级编程第二次作业
2-1 简单消息:msg = "hello world"print(msg)2-2 多条简单消息msg = "hello world"print(msg)msg = "hello world!!!"print(msg)2-3 个性化消息user_name = "lala, "msg1 = "hello, "msg2 = "have a dinner?&qu
2018-03-10 20:38:56 216
原创 高级编程第一次作业
一.浏览python的发现与收获 在浏览了Python主页后,我对Python语言的整体特点有了大概的了解。 总体而言,相对于C语言,C++语言,python语言更为“高级”,更多地使用“轮子”,高度封装。并且我还了解到,很多Python的函数库函数,都是用C语言,C++实现的。有句话说:“人生苦短,请用Python”,这也体现了Python的一个特性:用尽可能短的代码...
2018-03-10 17:23:31 208
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人