def exponentielle():
    debut = -1
    fin = 4
    pas = 0.1
    x = np.arange(debut, fin, pas)
    f = np.exp(x)
    plt.plot(x, f)
    lx = 'e = ' + str(np.exp(1))
    plt.xlabel(lx)
    plt.ylabel('f(x) = exp(x)')
    plt.tile('Fct exponentielle')
    plt.show()
Beispiel #2
0
def nxmx3(m):
    sh = m.shape
    m2 = m.copy()  # working copy, might chance
    assert (len(sh) == 2 or len(sh) == 3)
    if len(sh) == 3:
        if sh[2] == 3:
            # matrix is already mxnx3
            return m2
        else:
            # matrix is MxNxD with D!=3, best we can do:
            m2 = pylab.mean(m2, 2)
    # here, m2 is MxN...
    return pylab.tile(m2.reshape(sh[0], sh[1], 1), (1, 1, 3))
Beispiel #3
0
def feature_scale(M, normalize=False, dbscale=False, norm=False, bels=False):
    """
    ::

        Perform mutually-orthogonal scaling operations, otherwise return identity:
          normalize [False]
          dbscale  [False]
          norm      [False]
    """
    if not (normalize or dbscale or norm or bels):
        return M
    else:
        X = M.copy()  # don't alter the original
        if norm:
            X = X / P.tile(P.sqrt((X * X).sum(0)), (X.shape[0], 1))
        if normalize:
            X = _normalize(X)
        if dbscale or bels:
            X = P.log10(P.clip(X, 0.0001, X.max()))
            if dbscale:
                X = 20 * X
    return X
plt.ylabel("Runs Scored")
plt.show(),

plt.scatter(W, DOUB)
plt.xlabel("Wins")
plt.ylabel("Doubles hit")
plt.show()

obs = range(30)
plt.scatter(Ypred, Wt)
plt.xlabel("Predicted Wins")
plt.ylabel("Observed Wins")
plt.show()

plt.hist(Residuals)
plt.tile("Residuals Distribution", 16)
plt.show()



def average(my_list):
    sumall = sum(my_list)
    average = sumall / len(my_list)
    return average
    
average = average(Residuals)
print "Residuals mean = ",average

variance = np.var(Residuals)
print "Residuals Variance =",variance
Beispiel #5
0
plt.ylabel("Runs Scored")
plt.show(),

plt.scatter(W, DOUB)
plt.xlabel("Wins")
plt.ylabel("Doubles hit")
plt.show()

obs = range(30)
plt.scatter(Ypred, Wt)
plt.xlabel("Predicted Wins")
plt.ylabel("Observed Wins")
plt.show()

plt.hist(Residuals)
plt.tile("Residuals Distribution", 16)
plt.show()


def average(my_list):
    sumall = sum(my_list)
    average = sumall / len(my_list)
    return average


average = average(Residuals)
print "Residuals mean = ", average

variance = np.var(Residuals)
print "Residuals Variance =", variance
Beispiel #6
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# @Date    : 2017-10-16 17:04:57
# @Author  : Bob Liao
# @Email   : [email protected]
# @Link    : https://github.com/coderchaser
# @Path : E:\Code\Python\sublimeText\hipython_cousera\matplotlib_.py


import numpy as np
from matplotlib import pyplot as plt
from matplotlib import pylab as pb

x=np.linspace(0,1)
pb.tile('ss')
pb.plot(np.sin(4*np.pi*x)*np.exp(-5*x),'bo')
pb.show()