自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 15周作业-sklearn

题目:题目大意是这样的:生成一个数据集合,并且使用三种机器学习算法进行训练,并且根据训练结果使用三种方法评估三种算法的性能步骤1:生成数据集合使用make_classification函数生成一个数据集步骤2.使用10-fold cross validdation对数据集合进行划分步骤3:使用三种方法对数据集合进行训练1.高斯NB2.向量机3.随机森林步骤4:对性能进行评价...

2018-07-06 23:43:42 222

原创 十四周作业 Anscombe's quartet

首先参照教程安装并学习使用了jupyter1.Anscombe’s quartet comprises of four datasets, and is rather famous. Why? You’ll find out in this exercise.输出part1for each of the four datasets compute the mean and variance of ...

2018-07-06 18:38:45 217

原创 scipy

10.1 Least squares使用lstsq进行线性回归import numpy as np from scipy.linalg import *m = 20n = 15A = np.random.random((m, n))b = np.random.random((m,))cc, re, rank, sigma = lstsq(A, b)b1 = A.dot(cc)delta = b -...

2018-07-06 00:52:51 412

原创 Matplotlib

11.1 plotting a function要绘制这样的函数图像,选择给定区间比较密集的点,x在该区域等距选取,y用函数给出,使用plot绘制import numpy as npimport matplotlib.pyplot as plotimport mathx = np.arange(0,5,0.01); y = ((np.sin(x-2))**2)*np.power(math.e, -...

2018-07-05 20:35:37 284

原创 numpy练习

先生成A,B矩阵,令n,m分别为200,500import numpyfrom scipy.linalg import toeplitzA = numpy.random.normal(size=(200, 500))B = toeplitz(range(1, 501))Exercise 9.1: Matrix operations Calculate A + A, A·AT, AT·A an...

2018-06-06 21:02:46 316

原创 leetcode #2

# Definition for singly-linked list.# class ListNode:# def __init__(self, x):# self.val = x# self.next = Noneclass Solution: def addTwoNumbers(self, l1, l2): l3=L...

2018-06-06 20:33:54 217

原创 #leetcode 657

class Solution: def judgeCircle(self, moves): """ :type moves: str :rtype: bool """ a=0 b=0 c=0 d=0 for i in moves: ...

2018-06-06 20:32:17 173

原创 leetcode作业2

题目为罗马数字转整数,题目本身比较简单,主要就是当前字符和队名的大小进行匹配,如果是特殊字符则按照规则加减,在本题目中遇到的一个问题就是python中与c++中对数组的访问形式是不同的,最初想返回下标的时候用的是i.index(m)后来在提交之后发现错误,回头查找发现index()方法返回的是在该列表中出现的最早的目标元素,于是为了使用这个下标判断是否到了最后一个字节就不得不再定义一个新的inde...

2018-05-05 12:46:37 153

原创 Leetcode作业1

    26题,删除排序数组中的重复项最初没有注意到要求不使用额外的储存空间导致错误,随后又发现使用for循环嵌套del会导致re,就十分尴尬,后来了解到del操作是o(n)的,因此整个算法是on方的,重新审题后注意到是排序的数组,就决定先把不重复的放前面,然后把剩余的pop掉,因为pop比较快所以就没有超时class Solution:    def removeDuplicates(self,...

2018-05-05 11:48:11 155

原创 十一章作业

11-111-2

2018-05-05 11:04:06 196

原创 第十章作业

2018-04-23 00:37:32 387

原创 第七章作业

上一星期只点了保存忘记点击发布造成忘记更新,现在补出#7-4print('please input immigrades of pizza: ')while(1): msg=input() if(msg=='quit'): break print('we will add '+msg+' into pizza')#7-5print("input y...

2018-04-08 23:46:32 202

原创 第九章作业

#9-1class Restaurant(): def __init__(self, restaurant_name, cuisine_type): self.restaurant_name=restaurant_name self.cuisine_type=cuisine_type def discribe(self): prin...

2018-04-08 23:36:24 278

原创 第八章作业

#8-1def display_message(): print('I learned functions in this chapter')display_message()#8-2def favorate_book(title): print('one of my favorite books is '+title.title())favorate_boo...

2018-04-08 23:35:10 324

原创 第六章作业

#6-4Dictionary={ '编译器':'把代码翻译成机器码的程序' , '元组':'不能修改的列表', '列表':'可以储存一组数据的结构,', '汇编器':'将高级语言翻译成汇编码的程序', '字典':'由一系列key和value组成的容器'}for a, b in Dictionary.items(): print(a+'is '...

2018-03-26 00:41:26 216

原创 第五章作业

5-3到5-5#5-3alien_color='green'if alien_color=='green': print('you got five points!')alien_color='red'if alien_color=='green': print('you got five points!')#5-4alien_color='red'if ali...

2018-03-26 00:08:03 205

原创 第二周作业

习题3-4,3-5,3-6,3-7打印嘉宾名单并使用insert,pop,append函数多次修改该名单guest_list=['john','mike','duke','firefly']print(guest_list)print (guest_list[1]+' can not arrive the party!')guest_list[1]='king'for sub in gue...

2018-03-17 11:26:31 251

原创 homework1 test

 

2018-03-08 11:15:42 400

原创 Homework 1

    浏览了Python主页以后,我对Python的历史以及它强大的功能有了一定的了解,Python自从被发明以来功能以及能力被不断地强化以及升级,正在发挥越来越重要的作用。在网站上我看到了Python在各个方向都有重要的应用,python在网站开发,图形界面开发,游戏开发以及科研工作等方面中都是非常强大的工具。同时Python网站上面会提供最新的程序版本和对该版本的介绍,方便程序员们获取到最新...

2018-03-08 10:33:57 394

空空如也

空空如也

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

TA关注的人

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