#encoding:utf-8
#1.绘制曲线:
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 1000)
y = np.sin(x)
plt.figure(figsize=(8,4)) plt.plot(x,y,label="$sin(x)$",color="red",linewidth=2)...
分类:
编程语言 时间:
2015-01-04 17:13:34
阅读次数:
616
#绘制条形图
import numpy as np
import matplotlib.pyplot as plt
y=[]
plt.figure(1)
width=1
for i in range(len(y)):
plt.figure(1)
plt.bar(i*width,y[i],width)
plt.xlabel("X")
plt.ylabel("Y")
plt.show(...
分类:
其他好文 时间:
2015-01-04 17:13:16
阅读次数:
169
4.绘制散列图
import matplotlib.pyplot as plt
import numpy as np
import random
plt.figure(figsize=(8,4))
x=np.random.random(100)
y=np.random.random(100)
plt.scatter(x,y,s=x*1000,c=y,marker=(5,1),alpha=0.8,l...
分类:
其他好文 时间:
2015-01-04 17:11:18
阅读次数:
253
#绘制三维图
import numpy as np
import mpl_toolkits.mplot3d
import matplotlib.pyplot as plt
x,y=np.mgrid[-2:2:20j,-2:2:20j]
z=x*np.exp(-x**2-y**2)
ax=plt.subplot(111,projection='3d')
ax.plot_surface(x,y,z,r...
分类:
其他好文 时间:
2015-01-04 17:10:27
阅读次数:
258
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu...
分类:
其他好文 时间:
2015-01-04 15:10:14
阅读次数:
132
1、静态属性、静态方法在面向对象编程中,我们不仅可以通过对象访问方法和属性,还可以通过类来访问它们。这样的方法和属性就是“静态的”(static),必须用static关键字来声明。[php] view plaincopyprint?classstaticExample{staticpublic$nu...
分类:
其他好文 时间:
2015-01-04 01:09:24
阅读次数:
272
refrence :http://cloga.info/python/2014/02/07/classify_use_Sklearn/加载数据集这里我使用pandas来加载数据集,数据集采用kaggle的titanic的数据集,下载train.csv。import pandas as pddf = ...
分类:
其他好文 时间:
2015-01-03 15:50:22
阅读次数:
483
scikit-learn是一个用于机器学习的 Python 模块,建立在SciPy基础之上.主要特点:操作简单、高效的数据挖掘和数据分析无访问限制,在任何情况下可重新使用建立在NumPy、SciPy 和 matplotlib基础上使用商业开源协议——BSD许可证重要链接:官方源代码报告:https:...
分类:
其他好文 时间:
2015-01-03 14:31:43
阅读次数:
157
reference :http://www.cnblogs.com/chaosimple/p/4153158.html关于缺失值(missing value)的处理在sklearn的preprocessing包中包含了对数据集中缺失值的处理,主要是应用Imputer类进行处理。首先需要说明的是,nu...
分类:
其他好文 时间:
2015-01-03 14:31:39
阅读次数:
221
https://oj.leetcode.com/problems/implement-strstr/http://fisherlei.blogspot.com/2012/12/leetcode-implement-strstr.htmlpublicclassSolution{
publicintstrStr(Stringhaystack,Stringneedle){
//遍历haystack,对每一个字符,匹配needle
if(haystack==null||needle==nu..
分类:
其他好文 时间:
2015-01-02 16:12:25
阅读次数:
149