- 博客(20)
- 收藏
- 关注
原创 week15
Assignment from sklearn import datasetsfrom sklearn.naive_bayes import GaussianNBfrom sklearn import cross_validationfrom sklearn.svm import SVCfrom sklearn import metrics# 生成数据集data = datas...
2018-06-16 02:04:37 162
原创 week14
Part IFor each of the four datasets…%matplotlib inlineimport randomimport numpy as npimport scipy as spimport pandas as pdimport matplotlib.pyplot as pltimport seaborn as snsimport sta...
2018-06-09 00:22:39 248
原创 第十三周作业
Exercise 10.1: Least squaresExercise 10.2: OptimizationExercise 10.3: Pairwise distancesExercise 10.1: Least squaresfind x=argmin||Ax−b||x=argmin||Ax−b||x=argmin||Ax-b|| 代码import nump...
2018-05-30 23:10:24 154
原创 第12周作业
Plotting a functionDataHistogram and density estimationPlotting a function写函数画图即可 代码import matplotlib.pyplot as plt import numpyx = numpy.linspace(0, 2, 100);y = pow((numpy.sin(x-...
2018-05-25 15:47:32 141
原创 第11周-Python-hw
Exercise 9.1: Matrix operationsGenerate matrices AAA, with random Gaussian entries, BBB, a Toeplitz matrix, where A∈Rn×mA∈Rn×mA \in R^{n \times m} and B∈Rm×mB∈Rm×mB \in R^{m \times m}, for n = 200, ...
2018-05-18 19:32:36 361
原创 第九周-Python-leetcode-hw2
题目283. Move Zeroes解题思路代码题目283. Move ZeroesGiven an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For ...
2018-05-06 13:38:34 98
原创 第九周-Python-leetcode-hw1
题目167. Two Sum II - Input array is sorted思路代码题目167. Two Sum II - Input array is sortedGiven an array of integers that is already sorted in ascending order, find two numbers such t...
2018-05-06 13:31:08 121
原创 第八周-Python-leetcode-hw2
题目485. Max Consecutive Ones解题思路代码题目485. Max Consecutive OnesGiven a binary array, find the maximum number of consecutive 1s in this array.解题思路遍历整个数组,用t计算连续的1的个数。如果遇到1,t加1;如果遇到...
2018-04-25 20:36:07 103
原创 第8周-Python-leetcode-hw1
题目26. Remove Duplicates from Sorted Array解题思路代码题目26. Remove Duplicates from Sorted ArrayGiven a sorted array nums, remove the duplicates in-place such that each element appear onl...
2018-04-25 20:31:17 121
原创 第六周-Python-hw
11-1 城市和国家11-2 人口数量11-3 雇员11-1 城市和国家代码#city_functionsdef city_country(city, country): return city.title() + ", " + country.title();#test_cities.pyimport unittestfrom city_...
2018-04-16 06:57:42 218
原创 第五周-python-hw2
10-1 Python学习笔记10-3 访客10-7 加法计算器10-1 Python学习笔记代码#读取整个文件打印with open('learning_python.txt') as file_object: contents=file_object.read() print(contents)#遍历文件对象打印with open('...
2018-04-07 14:35:53 170
原创 第五周-python-hw1
作业9-1 餐馆9-6 冰淇淋小店9-10 导入Restaurant类9-14 骰子作业9-1 餐馆创建一个名为Restaurant的类,包括restaurant_name和cuisine_type属性,describe_restaurant()和open_restaurant()方法代码class Restaurant(): """...
2018-04-07 14:01:13 166
原创 第四周-python-hw2
作业8-1 消息8-3 T恤8-9 魔术师作业8-1 消息编写一个打印一条信息的函数代码def display_messages(): print("I learned something about function calls in this chapter.")display_messages();输出I learne...
2018-03-28 19:06:46 133
原创 第四周-python-hw1
作业7-1 汽车租赁7-2 餐馆订位7-3 10的整数倍7-8 熟食店作业7-1 汽车租赁询问用户要什么样的汽车,并打印信息代码car=input("What kind of cars do you want to rent?\n")print("Let me see if I can find you a " + car)输出Wh...
2018-03-28 18:58:22 108
原创 第三周-python-hw2
作业6-1 使用一个字典来存储一个熟人的信息6-2 存储数字6-6 修改6.3.1的程序6-10 修改6-2的代码,使得一个人可以有多个喜欢的数字作业6-1 使用一个字典来存储一个熟人的信息包括名、姓、年龄和居住的城市,将所有信息输出在做这一题的时候犯的一些错误: 1. 这里的键应该是字符串类型,但是我忘了加引号,所以解释器报错说没有这个变量 ...
2018-03-23 20:29:16 137
原创 第三周-python-hw1
反思作业5-1 编写一系列条件测试,将预测和结果打印出来5-3 检查外星人颜色是否为绿色5-8 以特殊方式和管理员打招呼5-9 处理没有用户的情形反思 再看上周的作业,看起来欠缺不少。需继续努力学习怎么写一篇好看的博客。作业5-1 编写一系列条件测试,将预测和结果打印出来代码color='white'print ("Is color =...
2018-03-19 17:42:13 206
原创 第二周-python-hw2
反思作业4-3 使用for循环打印数字1~20(含20)4-4 输出整数1到1000 0004-6 输出 [1,21] 中的奇数打印 [3,30] 中3的倍数4-9 用列表解析生成前10个整数的立方反思 再看上次的作业,比第一周的作业好了一些。但是相比起我看过的其他的博客来说,还是很难看。我觉得这不仅仅是Markdown运用熟练程度的问题,更重要的是审...
2018-03-14 19:52:04 175
原创 第二周-python-hw1
上次作业反思:本章作业3-1 将一些朋友的名字存储在一个列表中并依次输出3-2 为3-1中的人每人打印一条相同的问候语3-5 修改3-4的嘉宾名单3-9 指出3-4~3-7中邀请的嘉宾人数上次作业反思: 再次查看上周的作业,发现上周的作业真的很丑,丑到甚至自己都不想看。我认为这样不能起到“促进反思”的作用,然后了解到CSDN支持Markdown排版,...
2018-03-12 16:57:38 171
原创 20180308-python_hw2
说明:按网上的教程配置好Sublime Text 3,http://blog.csdn.net/u011475210/article/details/78168341 按照教程配置,F4切换至python解释器,F5直接执行当前python脚本。本次作业全用Sublime Text 3编写好程序后,F5执行程序出结果.2-12-22-32-42-52-62-72-82-92-102-11...
2018-03-08 00:26:59 183
原创 20180305-python-hw1
1.官网上的资源非常丰富。 除了提供python下载和说明文档,还有社区和新手帮助手册。这些都是python能拥有今天这样广泛的影响力的重要因素。 作为一名新手,我认为说明文档非常有效,几乎任何问题都能从上面找到答案,因此多多阅读说明文档非常有益于提高python编程能力。庞大的社区蕴含丰富的资源,相互交流学习也是提高的有效方式。2.写个高效、好用的爬虫,界面友好。只要输入关键词,能快速收集数...
2018-03-05 13:27:31 731
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人