自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(26)
  • 收藏
  • 关注

原创 十五周

from sklearn import datasetsfrom sklearn.model_selection import KFoldfrom sklearn.naive_bayes import GaussianNBfrom sklearn.svm import SVCfrom sklearn.ensemble import RandomForestClassifierfrom s...

2018-07-13 23:17:29 137

原创 十四周

1.print( 'The average of x is {:.2f}'.format(anascombe['x'].mean()))print( 'The average of y is {:.2f}'.format(anascombe['y'].mean()))print( 'The variance of x is {:.2f}'.format(anascombe['x'].var(...

2018-07-13 23:16:01 143

原创 十三周

1.最小二乘法import numpy as npm = 20n = 10A = np.random.rand(m,n)b = np.random.rand(m,1)x,_,_,_ = np.linalg.lstsq(A,b,rcond=None)b_ = np.dot(A,x)sum = 0for i in range(n): sum+=(b[i]-b_[i])**2prin...

2018-07-13 23:10:48 240

原创 第十二周

1.x = np.linspace(0,2,50)y = np.sin(x-2) * np.sin(x-2) * np.exp(-x**2)plt.figure(1)plt.xlabel("x")plt.ylabel("y")plt.ylim(-0.1, 1)plt.title(r"$f(x) = sin^2(x-2)e^{-x^2}$")plt.annotate('local ma...

2018-06-19 23:02:40 130

原创 numpy

创建随机矩阵Aimport numpy as np A = np.random.normal(size=[200, 500]) 9-1AA = A + A AAT = np.matmul(A, A.transpose()) ATA = np.matmul(A.transpose(), A) AB = np.matmul(A, B) def mul_A_B_I(A, B,...

2018-05-20 10:23:24 144

原创 169. 求众数

# -*-coding:utf-8-*-class Solution(object): def majorityElement(self, nums): """ :type nums: List[int] :rtype: int """ a = {} for i in nums:...

2018-05-12 11:33:07 162

原创 217. 存在重复元素

class Solution(object): def containsDuplicate(self, nums): """ :type nums: List[int] :rtype: bool """ for i in range(0,len(nums) - 1): a = nums[...

2018-05-12 11:11:19 293

原创 66. 加一

class Solution(object): def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ a = 1 for i in range(len(digits)-1, -1, -1): ...

2018-05-12 10:56:36 330

原创 29. 两数相除

import mathclass Solution(object): def divide(self, dividend, divisor): """ :type dividend: int :type divisor: int :rtype: int """ self.dividend = ...

2018-05-12 10:43:42 627

原创 第十一章练习题

11-1定义函数def get_city_country(city,country): return city+' '+country 测试函数import unittest from name_function import get_city_country class CityCountryTestCase(unittest.TestCase): def t...

2018-04-15 22:35:20 103

原创 第十章练习题

10-6# coding=utf-8while True: number_a = raw_input('请输入一个数字:') number_b = raw_input('请输入另一个数字:') try: numuber_sum = int(number_a) + int(number_b) print('您输入的两个数字之和...

2018-04-08 23:05:19 309

原创 第九章练习题

9-2class Restaurant():    def __init__(self,restaurant_name,cuisine_type):            self.restaurant_name=restaurant_name            self.cuisine_type=cuisine_type    def describe_restaurant(se...

2018-04-08 22:51:23 146

原创 第八章练习题

8-3def make_shirt(size, shape): """show the size and shape of the shirt""" print("The size of the shirt is " + str(size) + " and the shape of the shirt is " + shape +".") make_shirt

2018-04-01 21:27:00 188

原创 第七章练习题

7-1type = raw_input("Which car would you like?")print("Let me see if I can find you a " + type + ".")Which car would you like?bwmLet me see if I can find you a bwm.------------------(program exite...

2018-03-28 19:32:35 135

原创 第六章练习题

6-1person = {'first_name':'gu','last_name':'kx','age':'20','city':'tianjin'}print(person){'city': 'tianjin', 'first_name': 'gu', 'last_name': 'kx', 'age': '20'}------------------(program exited w...

2018-03-25 23:40:35 185

原创 第五章练习题

5-6age = 5if age < 2: print("He is a baby")elif age < 4: print("He is learning walking")elif age < 13: print("He is a child")elif age < 20: print("He is a teenager")elif age &

2018-03-20 08:44:50 174

原创 第四章练习题

4-5numbers = list(range(1,1000000))print(min(numbers))print(max(numbers))print(sum(numbers))4-6odd_numbers = list(range(1,20,2))for number in odd_numbers: print(number)4-9values = [value**3 for value ...

2018-03-18 18:50:54 179

原创 第三章练习题

3-1names = ['Chole','Lucy','Jack']for name in names: print(name)3-2names = ['Chole','Lucy','Jack']for name in names: print(name + ", how are you?")3-5names = ['Chole','Lucy','Jack']for name in names: ...

2018-03-14 19:34:40 132

原创 2-10

在加注释的时候出现了问题,第一次的代码如图运行后显示SyntaxError: Non-ASCII character '\xe6' in file test.py on line 2,but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details上网查找了一下发现是因为Python在默认状态下不支持源文件...

2018-03-11 08:31:08 169

原创 2-8

2018-03-11 08:16:37 103

原创 2-7

2018-03-11 08:14:18 95

原创 2-4

2018-03-09 09:22:55 79

原创 2-3

2018-03-09 09:19:41 66

原创 2-2

2018-03-09 09:15:00 99

原创 2-1

2018-03-09 09:12:00 102

原创 初识python

      这个学期初在选择专选课程的时候,看到了高级编程技术,就比较好奇,什么算是高级的技术呢,后来发现是学习python,因为这门语言我的好多非计算机专业的同学都有涉及,我的理解应该是比较简单,为什么叫高级呢?所以怀着这份好奇就选择了课程。      接触之后,发现那句话“人生苦短,我用python”真的是很有道理,极其简洁的语法,超强的可读性都让他配得上高级二字。      希望未来的我能够...

2018-03-09 09:07:50 78

空空如也

空空如也

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

TA关注的人

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