奶品质监测模拟

2019-10-13  本文已影响0人  ww4u
def fx(x):
    return x + x*x + x*x*x

def genGpData():
    Xs = [ random.randint(1,10) for i in range(100) ]
    Ys = []
    last = None
    for x in Xs:
        if last:
            last = last + fx(x)
        else:
            last = fx(x)
        Ys.append( last )
    return Xs, np.array(Ys).reshape( 100,1 )
image.png
from sklearn.svm import LinearSVR

regr = LinearSVR( random_state = 0 )
regr.fit( xds[0::1,:], Ys[0::1] )
print( regr.score( xds, Ys ) )

结论

上一篇下一篇

猜你喜欢

热点阅读