自定义博客皮肤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练习

这个练习是让我们比较三种分类算法的性能,加上学习调试一些算法的参数。详情请看注释:代码中没有from sklearn import cross_validation,因为pycharm提示这个库在新版上sklearn已经被删掉了from sklearn import datasetsfrom sklearn.model_selection import KFoldfrom sklearn.na...

2018-06-16 20:24:54 302

原创 Jupyter 练习

anscombe里有四个datasetpart1要求算出四个dataset的x、y均值、算出四个dataset的x、y的相关系数、实现线性回归import randomimport numpy as npimport scipy as spimport pandas as pdimport matplotlib.pyplot as pltimport seaborn as snsi...

2018-06-11 22:27:40 468

原创 Scipy 练习

这道题要求使用最小二乘法找到这个x并且输出残差的范数,程序如下:import scipyfrom scipy import linalgfrom scipy.optimize import leastsqA = scipy.random.normal(size=[30, 20])b = scipy.random.normal(size=[30])def error(x, A, b)...

2018-06-04 23:52:22 517

原创 Matplotlib 练习

import matplotlib.pyplot as pltfrom pylab import *import numpyfrom scipy.stats import gaussian_kde#exercise 1x = np.linspace(0, 2)y = np.power(np.sin(x-2), 2)*np.power(np.e, -x*x)plt.plot(x, y...

2018-05-27 19:54:16 221 1

原创 Numpy 练习

先设置随机数种子:import numpy as npimport timeseed = np.int64(time.time())print(seed)np.random.seed(seed)Generate matrices A, with random Gaussian entries, B, a Toeplitz matrix, where A ∈Rn×m and B ∈Rm×m,...

2018-05-19 11:47:17 367

原创 Leetcode题解 813 Largest Sum of Averages 【Dynamic programming】

813. Largest Sum of AveragesWe partition a row of numbers A into at most K adjacent (non-empty) groups, then our score is the sum of the average of each group. What is the largest score we can achieve...

2018-05-04 01:02:21 168

原创 Leetcode题解 4. Median of Two Sorted Arrays 【Array】

题目:There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Example 1:nums1 = [1, 3]nu...

2018-04-29 12:08:36 177

原创 Leetcode题解 23. Merge k Sorted Lists【Linked List】

题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[  1->4->5,  1->3->4,  2->6]Output: 1->1->2->3->4-&g...

2018-04-26 22:27:51 89

原创 Leetcode题解 495.Teemo Attacking 【Array】

In LOL world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attacking ascending time series towards Ashe and the poisoning tim...

2018-04-23 20:18:13 117

原创 Python 第十一章部分习题

11-1 城市和国家:代码:homework.pydef city_fun(city, country): return city.title()+", "+countrytest_cities.pyimport unittestfrom homework import city_funclass CityTestCase(unittest.TestCase): def te...

2018-04-10 01:17:17 471

原创 Python第十章部分习题

10-1 Python学习笔记代码:filename = r'D:\homework.txt'with open(filename) as file_object: contents = file_object.read() print(contents)with open(filename) as file_object: for line in file_obj...

2018-04-05 14:20:43 275

原创 Python第九章部分习题

9-1 餐馆代码:class restaurant: def __init__(self, name, ctype): self.restaurant_name = name self.cuisine_type = ctype def discribe_restaurant(self): print("Restaurant ...

2018-04-02 19:17:34 268

原创 Python 第八章部分习题

8-1 消息代码:def display_message():    print("I learn how to write a function")    def main():    display_message()    if __name__ == '__main__':    main()输出:8-2 喜欢的图书代码:def favorite_book(book_name):    p...

2018-03-29 00:46:56 634

原创 Python 第七章部分练习

7.1 汽车租赁代码:car = input("Hello ,please tell which car you want to lease\n  car name:")print("Let me see if I can find you a " + car)输出(输入为Subarn):7-2 餐馆订位代码:num = input("Hello ,please tell me how many ...

2018-03-28 00:36:40 1557

原创 Python第六章部分习题

6-1 人输出:6-2喜欢的数字:输出:6-10 喜欢的数字#2输出:

2018-03-22 00:11:06 338

原创 Python第五章部分习题

5-2 更多的条件测试输出:输出:输出:输出:输出:5-3外星人颜色#1输出:输出:5-4外星人颜色#2输出:输出:5-11序数输出:

2018-03-21 23:57:13 502

原创 Python第四章部分习题

4-1 比萨:输出如下:4-2 动物:输出:4-3 数到20:输出:4-6 奇数:输出:4-7 3的倍数:输出:4-8 立方:输出:4-9 立方解析:输出:

2018-03-14 23:17:35 509

原创 Python 第三章部分练习

3-1姓名:将一些朋友的姓名存储在一个列表中,并将其命名为names。依次访问该列表中的每个元素,从而将每个朋友的姓名都打印出来。3-2问候语:3-4 嘉宾名单:3-5 修改嘉宾名单:3-6 添加嘉宾3-9 晚餐嘉宾...

2018-03-12 17:19:43 389

原创 Python编程从入门到实践 第二章部分习题练习

2-1 简单消息:将一条消息存储到变量中,再将其打印出来。2-2 多条简单消息:将一条消息存储到变量中,再将其打印出来;再将变量的值修改为一条新消息,并将其打印出来。2-3 个性化消息:将用户的姓名存到一个变量中,并向该用户显示一条消息。显示的消息应非常简单,如“Hello Eric, would you like to learn some Python today?"2-4 调整名字的大小写:...

2018-03-07 23:52:20 380

原创 初入python及目标

    打开python主页后,一眼就看到Download,十分简单就可以下载好windows环境下的python3.6.4,主页十分友好。可以让人找到想要的资料,比如在About里可以找到对新手的指引,在Documentation 里还能找到 python 3.6.4 documentation,进而可以找到一些tutorial,可以让人一步一步熟悉python,掌握python的特性。除了对新...

2018-03-07 23:10:42 133

空空如也

空空如也

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

TA关注的人

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