归档 2016

[LeetCode]Wiggle Subsequence

题目描述:

LeetCode 376. Wiggle Subsequence

A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or negative. A sequence ...

继续阅读

利用matplotlib绘制Logistic曲线

标准Logistic函数为:

f(x) = 1 / ( 1 + exp(-x) )

其导函数为:

f'(x) = f(x) * ( 1 - f(x) )

下面使用matplotlib绘制逻辑斯蒂函数及其导函数的曲线。

Python代码:

import numpy as np
import matplotlib.pyplot as plt

a = np.linspace(-10, 10, 1000)
b = 1.0 / (1.0  + np.exp(-a ...

继续阅读

每月存档

去年

明年