def test_different_methods():
    mean_reggresion = zeros((5,6))
    pl.figure()
    word = "samochod"
    metods = ["momentum", "tnc", "bfgs", "cg", "rprop"]
    _words=[u"Backpropagation z momentem", u"Alg. BFGS (multicore)", 
        u"Alg. BFGS", u"Gradient sprzezony", "Alg. RProp"]

    colors= ["#FF2800".lower(), "#FFB800".lower(), "#1729B0".lower(),
            "#007929".lower(), "#60016D"]
    w = 3
    p_names = ["Slope", "Intercept", "R-value", "P-value", "Slope Error",
    "Estimation Error"]
    for n, met in zip(range(5), metods):
        fn = "{}_network_{}.net".format(met, voice_sample.timestamp() )
        (network, samples) = learn_net(fn, word, rs=1, re=5, save=False,
                method=met)    
        (inp, target) = get_inputs_and_outputs(samples, word, 6,10,False)
        (output, reggresion) = network.test(inp, target, iprint=0)
        mean_reggresion[n,:] = np.mean(reggresion,0)
        x = np.arange(6)*7 + n
        pl.bar(x, mean_reggresion[n,:], color=colors[n], width=0.9,
                label=_words[n])
    print mean_reggresion
    pl.xticks( np.arange(6)*7+2, p_names )
    pl.xlim( -1, 44 )
    pl.legend()
    pl.show()
    pass
Beispiel #2
0
def test_and_plot():
    mean_reggresion = zeros((4, 6))
    pl.figure()
    _words = [u"Imie", u"Nazwisko", u"Samochód", u"Kot"]

    colors = [
        "#FF2800".lower(), "#FFB800".lower(), "#1729B0".lower(),
        "#007929".lower()
    ]
    w = 3
    p_names = [
        "Slope", "Intercept", "R-value", "P-value", "Slope Error",
        "Estimation Error"
    ]
    for n, word in zip(range(4), voice_sample.WORDS):
        fn = "{}_network_{}.net".format(word, voice_sample.timestamp())
        (network, samples) = learn_net(fn, word, rs=1, re=5, save=False)
        (inp, target) = get_inputs_and_outputs(samples, word, 6, 10, False)
        (output, reggresion) = network.test(inp, target, iprint=0)
        mean_reggresion[n, :] = np.mean(reggresion, 0)
        x = np.arange(6) * 6 + n
        pl.bar(x,
               mean_reggresion[n, :],
               color=colors[n],
               width=0.9,
               label=_words[n])
    print mean_reggresion
    pl.xticks(np.arange(6) * 6 + 2, p_names)
    pl.xlim(-1, 35)
    pl.legend()
    pl.show()
Beispiel #3
0
def test_different_methods():
    mean_reggresion = zeros((5, 6))
    pl.figure()
    word = "samochod"
    metods = ["momentum", "tnc", "bfgs", "cg", "rprop"]
    _words = [
        u"Backpropagation z momentem", u"Alg. BFGS (multicore)", u"Alg. BFGS",
        u"Gradient sprzezony", "Alg. RProp"
    ]

    colors = [
        "#FF2800".lower(), "#FFB800".lower(), "#1729B0".lower(),
        "#007929".lower(), "#60016D"
    ]
    w = 3
    p_names = [
        "Slope", "Intercept", "R-value", "P-value", "Slope Error",
        "Estimation Error"
    ]
    for n, met in zip(range(5), metods):
        fn = "{}_network_{}.net".format(met, voice_sample.timestamp())
        (network, samples) = learn_net(fn,
                                       word,
                                       rs=1,
                                       re=5,
                                       save=False,
                                       method=met)
        (inp, target) = get_inputs_and_outputs(samples, word, 6, 10, False)
        (output, reggresion) = network.test(inp, target, iprint=0)
        mean_reggresion[n, :] = np.mean(reggresion, 0)
        x = np.arange(6) * 7 + n
        pl.bar(x,
               mean_reggresion[n, :],
               color=colors[n],
               width=0.9,
               label=_words[n])
    print mean_reggresion
    pl.xticks(np.arange(6) * 7 + 2, p_names)
    pl.xlim(-1, 44)
    pl.legend()
    pl.show()
    pass
def test_and_plot():
    mean_reggresion = zeros((4,6))
    pl.figure()
    _words=[u"Imie", u"Nazwisko", u"Samochód", u"Kot"]

    colors= ["#FF2800".lower(), "#FFB800".lower(), "#1729B0".lower(),
            "#007929".lower()]
    w = 3
    p_names = ["Slope", "Intercept", "R-value", "P-value", "Slope Error",
    "Estimation Error"]
    for n, word in zip(range(4), voice_sample.WORDS):
        fn = "{}_network_{}.net".format(word, voice_sample.timestamp() )
        (network, samples) = learn_net(fn, word, rs=1, re=5, save=False)    
        (inp, target) = get_inputs_and_outputs(samples, word, 6,10,False)
        (output, reggresion) = network.test(inp, target, iprint=0)
        mean_reggresion[n,:] = np.mean(reggresion,0)
        x = np.arange(6)*6 + n
        pl.bar(x, mean_reggresion[n,:], color=colors[n], width=0.9,
                label=_words[n])
    print mean_reggresion
    pl.xticks( np.arange(6)*6+2, p_names )
    pl.xlim( -1, 35 )
    pl.legend()
    pl.show()