自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 sklearn作业

Steps 1 Create a classification dataset (n samples 1000, n features 10) 2 Split the dataset using 10-fold cross validation 3 Train the algorithms I GaussianNB I SVC (possible C values [1e-02, 1e-01, 1e...

2018-06-19 10:24:10 200

原创 Jupyter作业

1.In [1]:%matplotlib inlineimport randomimport numpy as npimport scipy as spimport pandas as pdimport matplotlib.pyplot as pltimport seaborn as snsimport statsmodels.api as smimport statsmo...

2018-06-10 17:38:54 331

原创 Scipy习题

Exercise 10.1: Least squares Generate matrix A ∈ Rm×n with m > n. Also generate some vector b ∈ Rm. Now find x = argminxkAx−bk2. Print the norm of the residual.

2018-06-05 11:14:59 170

原创 matplotlib习题

1.Plotting a functionPlot the functionf(x) = sin2(x - 2)e-x2over the interval [0; 2]. Add proper axis labels, a title, etc. 在区间[0,2]间取10个值,绘制函数图像,代码如下 import numpy as np import matplotlib.pyplot as...

2018-05-28 21:18:51 486

原创 第十一章习题

11-1 城市和国家def city_country(city, country): return city.title() + ', ' + country.title() import unittest class TestCites(unittest.TestCase): def test_city_country(self): ...

2018-05-20 12:48:39 232

原创 第十章习题

10-3 访客filename="program.txt"with open(filename,'w') as file_object: name=input("Please input your name") file_object.write(name)10-5 关于编程的调查filename="why.txt"with open(filename,'r+') as file_obje...

2018-05-20 12:39:21 497

原创 Numpy的6道习题

首先,生成一个服从标准正太分布的200*500矩阵A,并生成一个500*500的teoplitz矩阵B,标准正太分布矩阵可通过输出均值和方差来确定。import numpy as np import time seed = np.int64(time.time()) print(seed) np.random.seed(seed) A = np.random.normal(siz...

2018-05-20 11:39:01 288

原创 leetcode 两题

66 plus one用digit这个数组代表数值,要将此数加一,carry=1时代表需要进位,要在数组最左边插入一个1class Solution: def plusOne(self, digits): len_s = len(digits) carry = 1 for i in range(len_s - 1, -1, -...

2018-05-01 12:58:30 105

原创 Leetcode Search Insert Position

    这道题算法很简单,遍历已经排好序的数组返到目标数字的位置,如果找不到目标数字,就返回此数字按序应该插入到数组中的位置。有一个要处理的细节就是如何将输入形如[1,2,3,4], 2的字符串转化为数组。在查找相关字符串处理方法之后,我选择用replace(old,new)来处理字符串,将字符串中的'[',']',',',' '转化为空字符串,这样字符串中就只剩下数组。将数组中最后一个数字pop...

2018-04-24 21:15:01 77

原创 第9章习题

9-1 餐馆class Restaurant(): def __init__(self,restaurant_name,cuisine_type): self.restaurant_name=restaurant_name self.cuisine_type=cuisine_type def describe_restaurant(self): print('The '+se...

2018-04-02 17:48:08 184

原创 第8章习题

8-3 T恤def make_shirt(size,name): print("The size of this shirt is " + size) print("The shirt says "+name) make_shirt('small','python') make_shirt(name='python',size='small')8-5 城市def describe_ci...

2018-04-01 20:35:59 180

原创 第7章习题

7-2 餐馆订位num=input("How many people will have dinner?")if num > str(8): print("No available table.")else: print("There are available tables.")7-5 电影票while True: num=input("Please input your a...

2018-03-26 21:03:40 240

原创 第6章习题

6-2 喜欢的数字num={'Jack':'1','Dan':'2','Mike':'3','Joe':'4','Alice':'5'}for name,value in num.items(): print(name.title()+"'s favorite number is "+num[name])6-5 河流river={'nile':'eygpt','amazon':'brazil...

2018-03-22 22:58:24 221

原创 第5章习题

5-3 外星人颜色#1alien_color='green'if alien_color=='green': print("You win five points")alien_color='red'if alien_color=='green': print("You win five points")5-5 外星人颜色#5alien_color='green'if alien_...

2018-03-19 08:24:40 131

原创 第四章习题

4-2 动物pets=['cat','dog','bunny']for pet in pets: print(pet) for pet in pets: print('a '+pet+' would make a great pet') print("Any of these animals would make a great pet!") 4-3 数到20for num in r...

2018-03-15 11:28:14 132

原创 第三章习题

3-1 姓名names=['Mike','Jack','Dan']for name in names: print(name)3-6 添加嘉宾print("We find a bigger table.")names.insert(0,'Joe')names.insert(2,'Patrik')names.append('Mark')for name in names: print(...

2018-03-12 19:06:22 151

原创 第二章习题

在第二章的习题2-1至2-10中选取了一些进行练习2-1 简单消息message="Hello Python"print(message)2-4 调整名字大小写name="mike"print(name.lower())print(name.upper())print(name.title())2-7 剔除人名中的空白name="\tmike\n"print(name)print(na...

2018-03-08 10:34:05 450

原创 Python入门感想以及目标

    在简单了解了Python语言,大致浏览了官方网站之后,我认为Python的主要特点有简单,明确,方便。它的语法比C,C++简单许多,让我发现了高级编程语言的魅力。此外,Python采用强制缩进的方式使得代码具有极佳的可读性,这使得代码看起来很规整。Python有非常强大丰富的库,这使得它能实现各种各样的功能,可以帮人处理各种工作。Python是一门精彩而强大的语言,它合理地结合了高性能与使...

2018-03-06 10:17:40 156

空空如也

空空如也

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

TA关注的人

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