示例#1
0
def demo():

    import sys
    sys.path.append('../core')
    from tools import make_XOR_dataset
    from BR import BR
    set_printoptions(precision=3, suppress=True)

    X, Y = make_XOR_dataset()
    N, L = Y.shape

    print("CLASSIFICATION")
    h = linear_model.SGDClassifier(n_iter=100)
    nn = ELM(8, f=tanh, h=BR(-1, h))
    nn.fit(X, Y)
    # test it
    print(nn.predict(X))
    print("vs")
    print(Y)

    print("REGRESSION")
    r = ELM(100, h=linear_model.LinearRegression())
    r.fit(X, Y)
    print(Y)
    print(r.predict(X))

    print("REGRESSION OI")
    r = ELM_OI(100, h=BR(-1, h=linear_model.SGDRegressor()))
    r.fit(X, Y)
    print(Y)
    print(r.predict(X))
示例#2
0
文件: DRBM.py 项目: jmread/molearn
def demo():
    from tools import make_XOR_dataset

    X,Y = make_XOR_dataset()
    N,L = Y.shape

    nn = DRBM(20)
    nn.train(X, Y)

    # test it
    print nn.predict(X)
    print "vs"
    print Y
示例#3
0
def demo():
    from tools import make_XOR_dataset

    X, Y = make_XOR_dataset()
    N, L = Y.shape

    nn = DRBM(20)
    nn.train(X, Y)

    # test it
    print nn.predict(X)
    print "vs"
    print Y
示例#4
0
文件: BR.py 项目: adamu2/m2DK
def demo():
    import sys
    sys.path.append('../core')
    from tools import make_XOR_dataset

    X, Y = make_XOR_dataset()
    N, L = Y.shape

    br = BR(L, linear_model.SGDClassifier(n_iter=100))
    br.fit(X, Y)
    # test it
    print(br.predict(X))
    print("vs")
    print(Y)
示例#5
0
文件: BR.py 项目: jmread/molearn
def demo():
    import sys
    sys.path.append( '../core' )
    from tools import make_XOR_dataset

    X,Y = make_XOR_dataset()
    N,L = Y.shape

    br = BR(L, linear_model.SGDClassifier(n_iter=100))
    br.fit(X, Y)
    # test it
    print br.predict(X)
    print "vs"
    print Y
示例#6
0
文件: CC.py 项目: jmread/molearn
def demo():
    #from molearn.core.tools import make_XOR_dataset
    import sys
    sys.path.append( '../core' )
    from tools import make_XOR_dataset

    X,Y = make_XOR_dataset()
    N,L = Y.shape

    cc = RCC(L, SGDClassifier(n_iter=100))
    cc.fit(X, Y)
    # test it
    print cc.predict(X)
    print "vs"
    print Y
示例#7
0
def demo():
    #from molearn.core.tools import make_XOR_dataset
    import sys
    sys.path.append('../core')
    from tools import make_XOR_dataset

    X, Y = make_XOR_dataset()
    N, L = Y.shape

    cc = RCC(L, SGDClassifier(n_iter=100))
    cc.fit(X, Y)
    # test it
    print(cc.predict(X))
    print("vs")
    print(Y)
示例#8
0
文件: PS.py 项目: adamu2/m2DK
def demo():
    #from molearn.core.tools import make_XOR_dataset
    import sys
    sys.path.append('../core')
    from tools import make_XOR_dataset

    X, Y = make_XOR_dataset()
    N, L = Y.shape

    ps = PS()
    ps.fit(X, Y)
    # test it
    print(ps.predict(X))
    print("vs")
    print(Y)
示例#9
0
文件: ELM.py 项目: jmread/molearn
def demo():

    from tools import make_XOR_dataset
    from BR import BR

    X,Y = make_XOR_dataset()
    N,L = Y.shape

    h = linear_model.SGDClassifier(n_iter=100)
    nn = ELM(8,BR(L,h))
    nn.train(X, Y)
    # test it
    print nn.predict(X)
    print "vs"
    print Y
示例#10
0
文件: LP.py 项目: adamu2/m2DK
def demo():
    #from molearn.core.tools import make_XOR_dataset
    import sys
    sys.path.append('../core')
    from tools import make_XOR_dataset

    X, Y = make_XOR_dataset()
    N, L = Y.shape

    lp = LP()
    lp.fit(X, Y)
    # test it
    print(lp.predict_proba(X))
    print("vs")
    print(Y)
示例#11
0
def demo():
    import sys
    sys.path.append('../core')
    from tools import make_XOR_dataset

    X, Y = make_XOR_dataset()
    N, L = Y.shape

    from sklearn import linear_model
    h = linear_model.LogisticRegression()
    h = linear_model.SGDClassifier(n_iter=100)
    ml = ML(L, h)
    ml.fit(X, Y)

    # Eval
    print(ml.predict(X))
    print("vs")
    print(Y)
def demo():
    import sys
    sys.path.append( '../core' )
    from tools import make_XOR_dataset

    X,Y = make_XOR_dataset()
    N,L = Y.shape

    from sklearn import linear_model
    h_ = linear_model.SGDClassifier(n_iter=100)
    from CC import RCC
    cc = RCC(h=h_)
    e = Ensemble(n_estimators=10,base_estimator=cc)
    e.fit(X, Y)
    # test it
    print(e.predict(X))
    print("vs")
    print(Y)