参考:http://cs231n.github.io/assignment1/Q1: k-Nearest Neighbor classifier (30 points) 1 import numpy as np 2 from matplotlib.cbook import todate 3 ...
分类:
其他好文 时间:
2015-01-13 21:16:36
阅读次数:
323
使用数组的reshape方法,可以创建一个改变了尺寸的新数组,原数组的shape保持不变; 1 >>> a = np.array([1, 2, 3, 4]);b = np.array((5, 6, 7, 8));c = np.array([[1, 2, 3, 4],[4, 5, 6, 7], [7,...
分类:
编程语言 时间:
2015-01-11 21:37:00
阅读次数:
2307
Python中怎样生成一个随机序列?代码例子如下:生成一个0-9的随机序列1 >>> from numpy.random import normal,random,uniform;2 >>> import numpy as np;3 >>> random.permutation(range(10))...
分类:
编程语言 时间:
2015-01-11 20:14:30
阅读次数:
181
Description小R最近遇上了大麻烦,他的程序设计挂科了。于是他只好找程设老师求情。善良的程设老师答应不挂他,但是要求小R帮助他一起解决一个难题。问题是这样的,程设老师最近要进行一项邪恶的实验来证明P=NP,这个实验一共持续n天,第i天需要a[i]个研究生来给他搬砖。研究生毕竟也是人,所以雇佣...
分类:
其他好文 时间:
2015-01-11 10:56:22
阅读次数:
208
import matplotlib.pyplot as plt
import numpy as np x = np.linspace(0, 2*np.pi, 100)
sinX = np.sin(x)
cosX = np.cos(x) plt.plot(x, sinX)
plt.plot(x, co...
分类:
其他好文 时间:
2015-01-10 23:40:33
阅读次数:
193
https://oj.leetcode.com/problems/word-break-ii/http://blog.csdn.net/linhuanmars/article/details/22452163publicclassSolution{
publicList<String>wordBreak(Strings,Set<String>dict)
{
//SolutionA:
//returnwordBreak_NP(s,dict);
//SolutionB:
return..
分类:
其他好文 时间:
2015-01-09 01:52:58
阅读次数:
160
https://oj.leetcode.com/problems/palindrome-partitioning/http://blog.csdn.net/linhuanmars/article/details/22777711publicclassSolution{
publicList<List<String>>partition(Strings){
//NP
List<List<String>>result=newArrayList<>()..
分类:
其他好文 时间:
2015-01-08 15:30:19
阅读次数:
111
这些相当于我的学习笔记,所以并没有很强的结构性和很全的介绍,请见谅。1 读取、写入图像下面是一个简短的载入图像、打印尺寸、转换格式及保存图像为.png的例子:# -*- coding: utf-8 -*-import cv2import numpy as np# 读入图像im = cv2.imrea...
分类:
编程语言 时间:
2015-01-05 21:43:58
阅读次数:
499
https://oj.leetcode.com/problems/combinations/http://blog.csdn.net/linhuanmars/article/details/21260217publicclassSolution{
publicList<List<Integer>>combine(intn,intk)
{
List<List<Integer>>results=newArrayList<>();
help(n,k,0,n..
分类:
其他好文 时间:
2015-01-04 19:34:42
阅读次数:
125
https://oj.leetcode.com/problems/subsets/http://blog.csdn.net/linhuanmars/article/details/24286377publicclassSolution{
publicList<List<Integer>>subsets(int[]S){
Arrays.sort(S);
List<List<Integer>>results=newArrayList<>();
hel..
分类:
其他好文 时间:
2015-01-04 19:34:20
阅读次数:
306