Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita6ad2f2

Browse files
committed
ts
1 parent28f4e22 commita6ad2f2

File tree

14 files changed

+145
-3
lines changed

14 files changed

+145
-3
lines changed

‎python_algorithms/algorithms/ml/nnets/deep_learn/layer.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self) -> None:
1818

1919
defforward(self,inputs:Tensor)->Tensor:
2020
"""
21-
Product the outputs corresponding to these inputs
21+
Produce the outputs corresponding to these inputs
2222
"""
2323
raiseNotImplementedError
2424

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Autoregressive Inegrated Moving Average
2+
fromstatsmodels.tsa.arima_modelimportARIMA
3+
fromrandomimportrandom
4+
# contrived dataset
5+
data= [x+random()forxinrange(1,100)]
6+
# fit model
7+
model=ARIMA(data,order=(1,1,1))
8+
model_fit=model.fit(disp=False)
9+
# make prediction
10+
yhat=model_fit.predict(len(data),len(data),typ='levels')
11+
print(yhat)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Autoregressive Moving Average
2+
fromstatsmodels.tsa.arima_modelimportARMA
3+
fromrandomimportrandom
4+
# contrived dataset
5+
data= [random()forxinrange(1,100)]
6+
# fit model
7+
model=ARMA(data,order=(2,1))
8+
model_fit=model.fit(disp=False)
9+
# make prediction
10+
yhat=model_fit.predict(len(data),len(data))
11+
print(yhat)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# AR example
2+
fromstatsmodels.tsa.ar_modelimportAR
3+
fromrandomimportrandom
4+
# contrived dataset
5+
data= [x+random()forxinrange(1,100)]
6+
# fit model
7+
model=AR(data)
8+
model_fit=model.fit()
9+
# make prediction
10+
yhat=model_fit.predict(len(data),len(data))
11+
print(yhat)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Holt Winters Exponential Smoothing
2+
fromstatsmodels.tsa.holtwintersimportExponentialSmoothing
3+
fromrandomimportrandom
4+
# contrived dataset
5+
data= [x+random()forxinrange(1,100)]
6+
# fit model
7+
model=ExponentialSmoothing(data)
8+
model_fit=model.fit()
9+
# make prediction
10+
yhat=model_fit.predict(len(data),len(data))
11+
print(yhat)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Moving Average Model
2+
fromstatsmodels.tsa.arima_modelimportARMA
3+
fromrandomimportrandom
4+
# contrived dataset
5+
data= [x+random()forxinrange(1,100)]
6+
# fit model
7+
model=ARMA(data,order=(0,1))
8+
model_fit=model.fit(disp=False)
9+
# make prediction
10+
yhat=model_fit.predict(len(data),len(data))
11+
print(yhat)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Seasonal Autoregressive Integrated Moving Average
2+
fromstatsmodels.tsa.statespace.sarimaximportSARIMAX
3+
fromrandomimportrandom
4+
# contrived dataset
5+
data= [x+random()forxinrange(1,100)]
6+
# fit model
7+
model=SARIMAX(data,order=(1,1,1),seasonal_order=(1,1,1,1))
8+
model_fit=model.fit(disp=False)
9+
# make prediction
10+
yhat=model_fit.predict(len(data),len(data))
11+
print(yhat)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Seasonal Autoregressive Integrated Moving Average with Exogenous Regressors
2+
fromstatsmodels.tsa.statespace.sarimaximportSARIMAX
3+
fromrandomimportrandom
4+
# contrived dataset
5+
data1= [x+random()forxinrange(1,100)]
6+
data2= [x+random()forxinrange(101,200)]
7+
# fit model
8+
model=SARIMAX(data1,exog=data2,order=(1,1,1),seasonal_order=(0,0,0,0))
9+
model_fit=model.fit(disp=False)
10+
# make prediction
11+
exog2= [200+random()]
12+
yhat=model_fit.predict(len(data1),len(data1),exog=[exog2])
13+
print(yhat)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Simple Exponential Smoothing
2+
fromstatsmodels.tsa.holtwintersimportSimpleExpSmoothing
3+
fromrandomimportrandom
4+
# contrived dataset
5+
data= [x+random()forxinrange(1,100)]
6+
# fit model
7+
model=SimpleExpSmoothing(data)
8+
model_fit=model.fit()
9+
# make prediction
10+
yhat=model_fit.predict(len(data),len(data))
11+
print(yhat)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Vector Autoregression
2+
fromstatsmodels.tsa.vector_ar.var_modelimportVAR
3+
fromrandomimportrandom
4+
# contrived dataset with dependency
5+
data=list()
6+
foriinrange(100):
7+
v1=i+random()
8+
v2=v1+random()
9+
row= [v1,v2]
10+
data.append(row)
11+
# fit model
12+
model=VAR(data)
13+
model_fit=model.fit()
14+
# make prediction
15+
yhat=model_fit.forecast(model_fit.y,steps=1)
16+
print(yhat)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp