- 博客(21)
- 收藏
- 关注
原创 python第20次作业(15周)-sklearn
题目: 该题目需要生成一个数据集,用三种不同的机器学习算法进行训练,由此来评估这三种算法的性能(根据给出的标准)。根据提示的步骤来一步步实现。1.人工生成数据集根据给出的参数提示,生成数据集。 参考: http://scikit-learn.org/stable/modules/generated/sklearn.datasets.make_classification....
2018-06-19 20:17:15 318
原创 python第19次作业(14周)-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-12 01:14:39 361
原创 Exercise10-Scipy
Exercise10.1 Least squares分析:使用numpy.linalg.lstsq来计算。相关说明:numpy.random.randint low、high、size三个参数。默认high是None,如果只有low,那范围就是[0,low)。如果有high,范围就是[low,high)。 np.random.randint(2, size...
2018-06-03 18:50:32 191
原创 Exercise11-Matplotlib
Exercise 11.1: Plotting a function分析:要绘制这样的函数图像,用点来描绘,选择给定区间较密集的点(用numpy.arange实现其x坐标在该区域的等距选取),y用给定的表达式给出,使用plot绘制即可。相关说明:pylab将pyplot与numpy合并为一个命名空间。这对于交互式工作很方便,但是对于编程来说,建议将名称空间分开。 例:画 y...
2018-05-28 22:59:39 201
原创 Exercise9-Numpy
Premise:分析:要生成两个矩阵,A为高斯(正态分布)矩阵,可以numpy.random.normal获得;B为Toeplitz矩阵,可用scipy.linalg 中的toeplitz获得。内置函数等介绍:numpy.random.normal(loc=0.0, scale=1.0, size=None) 对应于高斯分布的概率密度函数,第一,二个参数分别为均值和...
2018-05-21 18:56:51 190
原创 LeetCode-array2
Title:Two Sum II - Input array is sortedRelated Topics:Array , Binary Search, Two PointersDescribe:Given an array of integers that is already sorted in ascending order, find two numbers such...
2018-05-13 15:56:23 104
原创 LeetCode-LinkedList1
Title:T83.Remove Duplicates from Sorted ListRelated Topics:LinkedListDescribe:Given a sorted linked list, delete all duplicates such that each element appear only once.Sample Input&out...
2018-05-01 09:45:04 164
原创 LeetCode-string1
Title:T58. Length of Last WordRelated Topics:stringDescribe:Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the stri...
2018-05-01 09:39:47 100
原创 LeetCode-array1
Related Topics: Array , Binary SearchDescribe:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or...
2018-05-01 09:29:27 106
原创 python第十次练习(第十一章)
例题11-1 城市和国家& 11-2 人口数量描述: 编写一个函数,它接受两个形参:一个城市名和一个国家名。这个函数返回一个格式为City, Country 的字符串,如Santiago, Chile 。将这个函数存储在一个名为city_functions.py的模块中。创建一个名为test_cities.py的程序,对刚编写的函数进行测试(别忘了...
2018-04-15 17:09:28 323 1
原创 python第九次练习
例题10-2 C语言学习笔记 描述:读取你刚创建的文件learning_python.txt中的每一行, 将其中的Python都替换为另一门语言的名称,如C。 &am
2018-04-07 23:27:08 291
原创 python第八次练习
例题9-1 餐馆 描述:创建Restaurant 类, init() 设置两个属性:restaurant_name 和cuisine_type 。  
2018-04-07 23:16:48 257
原创 python第七次练习
例题8-13 用户简介 描述:任意数量的关键字实参创建用户简介,名和姓加描述键值对。 代码:def build_profile(first, last, **user_info): profile = {} profile['first_name'] = first profile['last_name'] = l...
2018-04-01 15:48:47 216
原创 python第六次练习
例题7-4 描述:编写一个在用户输入quit后结束的循环。 代码:prompt = 'Please enter the pizza toppings 'prompt += '\n(Enter "quit" if you finish):'while True: toppings = input(prompt) if ...
2018-03-26 23:25:08 153
原创 python第五次练习
例题6-5 描述:创建字典,存储三条大河流及其流经国家。 打印指定消息,分别打印全部河流和国家。 代码:river_country = { 'yellow
2018-03-25 17:31:37 333
原创 python第四次练习
例题5-6 人生的不同阶段 描述:设置变量age 的值,再编写一个if-elif-else 结构, 根据age 的值判断处于人生的哪个阶段。 代码:age = 1
2018-03-25 16:57:25 482
原创 python第三次练习
例题4-2 动物 描述:建立一个包含3种动物的列表,用for循环针对每种打印一个句子, 再额外打印一句总结语。 代码:animals = ['dog', 'c
2018-03-17 13:41:49 287
原创 python第二次练习
例题3-10 尝试使用各个函数 描述: 建立一个列表,对本章的每个函数,至少使用一次来处理。 代码:#coding=utf-8attractions = ['Spain', 'Turkey', 'Morocco', 'Japan', 'Finland']attractions.append('France') #使...
2018-03-15 17:39:25 226
原创 python第一次练习
例题2-1 简单消息: 描述: 将一条消息存储到变量中,再将其打印出来。 代码:message = "Hello world!"print(message)例题2-2 多条简单消息: 描述:将一条消息存储到变量中,将其打印出来;
2018-03-10 00:07:03 531
原创 在python.org的初次接触与目标
python的主页就好像一片等待探索的大草原,在较为细致的浏览过后, 我了解到了python这个语言的几个特点,对它有了更深入的认识。python有强大的库:从python主页上,我了解到python有很多方面的应用,其列出的Python Package Index更让我看到Python第三方模块的强大。 Web and Internet Developme...
2018-03-08 23:19:41 1668
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人