Моя конечная цель - предсказать, какой дисковый ресурс данного сервера использует% диска.
(как в Использовать% от df -h:
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 39G 31G 6.9G 82% /
)
будет в будущем с использованием машинного обучения. Я использую модель ARIMA из библиотеки python statsmodels для прогнозирования временных рядов.
У меня есть массив, содержащий ежедневные записи, которые я записывал в течение многих дней, в формате (epoch_timestamp, used_pct):
results = [(1545346993, 80), (1545433403, 79), (1545519793, 80), (1545606202, 82), (1545692596, 80), (1545779002, 83), (1545865397, 77), (1545951799, 76), (1546038202, 75), (1546124601, 73), (1546210994, 73), (1546297394, 73), (1546383797, 73), (1546470197, 74), (1546556595, 74)]
Если вы видите пример минимального кода ниже, он ошибается с
«LinAlgError: SVD не сходится».
Интересно, если вы измените этот конкретный кортеж - результаты [6]
от:
(1545865397, 77)
до:
(1545865397, 80)
Затем код работает, как и ожидалось, с таким выводом:
predicted=77.635415, expected=73.000000
predicted=69.932872, expected=73.000000
predicted=76.074475, expected=73.000000
predicted=73.698213, expected=73.000000
predicted=72.721116, expected=74.000000
predicted=73.054932, expected=74.000000
Test MSE: 7.227
Так что это говорит мне о том, что это связано с данными. Изучая другие вопросы, я убедился, что нет никаких значений нп. В любом случае, вот полный пример с использованием «плохого» кортежа:
import pandas as pd
import numpy as np
from sklearn.metrics import mean_squared_error
from statsmodels.tsa.arima_model import ARIMA
time_list = []
used_pct_list = []
results = [(1545346993, 80), (1545433403, 79), (1545519793, 80), (1545606202, 82), (1545692596, 80), (1545779002, 83), (1545865397, 77), (1545951799, 76), (1546038202, 75), (1546124601, 73), (1546210994, 73), (1546297394, 73), (1546383797, 73), (1546470197, 74), (1546556595, 74)]
for time, used_pct in results:
time_list.append(time)
used_pct_list.append(used_pct)
data = np.array(used_pct_list)
series = pd.Series(data,index=time_list)
X = series.values
size = int(len(X) * 0.66)
train, test = X[0:size], X[size:len(X)]
history = [x for x in train]
predictions = list()
for t in range(len(test)):
model = ARIMA(history, order=(5,1,0))
model_fit = model.fit(disp=0)
output = model_fit.forecast()
yhat = output[0]
predictions.append(yhat)
obs = test[t]
history.append(obs)
print('predicted=%f, expected=%f' % (yhat, obs))
error = mean_squared_error(test, predictions)
print('Test MSE: %.3f' % error)
и выдает ошибку:
runfile('C:/Users/user/.spyder-py3/blarg_bad.py', wdir='C:/Users/user/.spyder-py3')
C:\Users\user\Anaconda3\lib\site-packages\scipy\signal\signaltools.py:1341: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
out_full[ind] += zi
C:\Users\user\Anaconda3\lib\site-packages\scipy\signal\signaltools.py:1344: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
out = out_full[ind]
C:\Users\user\Anaconda3\lib\site-packages\scipy\signal\signaltools.py:1350: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
zf = out_full[ind]
C:\Users\user\Anaconda3\lib\site-packages\statsmodels\tsa\tsatools.py:607: RuntimeWarning: invalid value encountered in true_divide
....
File "C:\Users\user\Anaconda3\lib\site-packages\numpy\linalg\linalg.py", line 1562, in svd
u, s, vh = gufunc(a, signature=signature, extobj=extobj)
File "C:\Users\user\Anaconda3\lib\site-packages\numpy\linalg\linalg.py", line 98, in _raise_linalgerror_svd_nonconvergence
raise LinAlgError("SVD did not converge")
LinAlgError: SVD did not converge
Я новичок в машинном обучении и использую этот сайт в качестве руководства по моделям арима: https://machinelearningmastery.com/arima-for-time-series-forecasting-with-python/