Skip to content

Commit

Permalink
rm multitask from MTS
Browse files Browse the repository at this point in the history
  • Loading branch information
thierrymoudiki committed Dec 21, 2024
1 parent 427d51f commit 31f23cd
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 36 deletions.
8 changes: 5 additions & 3 deletions examples/mts_conformal_not_sims.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
print(198*0.8)
# df_train = df.iloc[0:97,]
# df_test = df.iloc[97:123,]
df_train = df.iloc[0:158,]
df_test = df.iloc[158:198,]
df_train = df.iloc[0:158,:]
df_test = df.iloc[158:198,:]

regr = ns.PredictionInterval(obj=Ridge(),
method="splitconformal",
Expand All @@ -33,6 +33,8 @@
obj_MTS = ns.MTS(regr, lags = 25, n_hidden_features=10, verbose = 1)
obj_MTS.fit(df_train)
print("\n")
print(obj_MTS.fit_objs_)
print("\n")
print(obj_MTS.predict(h=10, return_pi=True))


Expand Down Expand Up @@ -98,5 +100,5 @@
lags=25)
regr.fit(df_train)
print(regr.predict(h=10, return_pi=True))
except:
except Exception as e:
pass
25 changes: 25 additions & 0 deletions nnetsauce.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Metadata-Version: 2.1
Name: nnetsauce
Version: 0.29.2
Summary: Quasi-randomized (neural) networks
Home-page: https://techtonique.github.io/nnetsauce/
Download-URL: https://github.com/Techtonique/nnetsauce
Author: T. Moudiki
Author-email: thierry.moudiki@gmail.com
License: BSD Clause Clear
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
License-File: LICENSE
Requires-Dist: joblib
Requires-Dist: matplotlib
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: requests
Requires-Dist: scipy
Requires-Dist: scikit-learn
Requires-Dist: statsmodels
Requires-Dist: threadpoolctl
Requires-Dist: tqdm

Quasi-randomized (neural) networks for regression, classification and time series forecasting
92 changes: 92 additions & 0 deletions nnetsauce.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
LICENSE
README.md
setup.py
nnetsauce/__init__.py
nnetsauce.egg-info/PKG-INFO
nnetsauce.egg-info/SOURCES.txt
nnetsauce.egg-info/dependency_links.txt
nnetsauce.egg-info/requires.txt
nnetsauce.egg-info/top_level.txt
nnetsauce/base/__init__.py
nnetsauce/base/base.py
nnetsauce/base/baseRegressor.py
nnetsauce/boosting/__init__.py
nnetsauce/boosting/adaBoostClassifier.py
nnetsauce/boosting/bst.py
nnetsauce/custom/__init__.py
nnetsauce/custom/custom.py
nnetsauce/custom/customClassifier.py
nnetsauce/custom/customRegressor.py
nnetsauce/datasets/__init__.py
nnetsauce/datasets/dowload.py
nnetsauce/deep/__init__.py
nnetsauce/deep/deepClassifier.py
nnetsauce/deep/deepMTS.py
nnetsauce/deep/deepRegressor.py
nnetsauce/glm/__init__.py
nnetsauce/glm/glm.py
nnetsauce/glm/glmClassifier.py
nnetsauce/glm/glmRegressor.py
nnetsauce/lazypredict/__init__.py
nnetsauce/lazypredict/config.py
nnetsauce/lazypredict/lazydeepClassifier.py
nnetsauce/lazypredict/lazydeepMTS.py
nnetsauce/lazypredict/lazydeepRegressor.py
nnetsauce/mts/__init__.py
nnetsauce/mts/classical.py
nnetsauce/mts/mts.py
nnetsauce/multitask/__init__.py
nnetsauce/multitask/multitaskClassifier.py
nnetsauce/multitask/simplemultitaskClassifier.py
nnetsauce/nonconformist/__init__.py
nnetsauce/nonconformist/acp.py
nnetsauce/nonconformist/base.py
nnetsauce/nonconformist/cp.py
nnetsauce/nonconformist/evaluation.py
nnetsauce/nonconformist/icp.py
nnetsauce/nonconformist/nc.py
nnetsauce/nonconformist/util.py
nnetsauce/optimizers/__init__.py
nnetsauce/optimizers/helpers.py
nnetsauce/optimizers/optimizer.py
nnetsauce/predictioninterval/__init__.py
nnetsauce/predictioninterval/predictioninterval.py
nnetsauce/predictionset/__init__.py
nnetsauce/predictionset/predictionset.py
nnetsauce/randombag/__init__.py
nnetsauce/randombag/bag.py
nnetsauce/randombag/helpers.py
nnetsauce/randombag/randomBagClassifier.py
nnetsauce/randombag/randomBagRegressor.py
nnetsauce/ridge2/__init__.py
nnetsauce/ridge2/ridge2.py
nnetsauce/ridge2/ridge2Classifier.py
nnetsauce/ridge2/ridge2MultitaskClassifier.py
nnetsauce/ridge2/ridge2Regressor.py
nnetsauce/rvfl/__init__.py
nnetsauce/rvfl/bayesianrvfl2Regressor.py
nnetsauce/rvfl/bayesianrvflRegressor.py
nnetsauce/sampling/__init__.py
nnetsauce/sampling/copulas.py
nnetsauce/sampling/helpers.py
nnetsauce/sampling/rowsubsampling.py
nnetsauce/simulation/__init__.py
nnetsauce/simulation/getsims.py
nnetsauce/simulation/nodesimulation.py
nnetsauce/simulation/sobol.py
nnetsauce/updater/__init__.py
nnetsauce/updater/classification_updater.py
nnetsauce/updater/regression_updater.py
nnetsauce/utils/__init__.py
nnetsauce/utils/activations.py
nnetsauce/utils/lmfuncs.py
nnetsauce/utils/matrixops.py
nnetsauce/utils/memoize.py
nnetsauce/utils/misc.py
nnetsauce/utils/model_selection.py
nnetsauce/utils/progress_bar.py
nnetsauce/utils/psdcheck.py
nnetsauce/utils/timeseries.py
nnetsauce/utils/where.py
nnetsauce/votingregressor/__init__.py
nnetsauce/votingregressor/votingregressor.py
1 change: 1 addition & 0 deletions nnetsauce.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

10 changes: 10 additions & 0 deletions nnetsauce.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
joblib
matplotlib
numpy
pandas
requests
scipy
scikit-learn
statsmodels
threadpoolctl
tqdm
1 change: 1 addition & 0 deletions nnetsauce.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nnetsauce
66 changes: 34 additions & 32 deletions nnetsauce/mts/mts.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,33 +444,33 @@ def fit(self, X, xreg=None, **kwargs):
"block-bootstrap",
) or self.type_pi.startswith("vine"):

try: # multioutput regressor

self.y_means_ = np.mean(self.y_, axis=0)
centered_y = self.y_ - self.y_means_
self.obj.fit(X=scaled_Z, y=centered_y)
residuals_ = centered_y - self.obj.predict(scaled_Z)
self.residuals_ = residuals_

except Exception: # single output regressor

if self.show_progress is True:
iterator = tqdm(range(p))
else:
iterator = range(p)

for i in iterator:
y_mean = np.mean(self.y_[:, i])
self.y_means_[i] = y_mean
centered_y_i = self.y_[:, i] - y_mean
self.centered_y_is_.append(centered_y_i)
self.obj.fit(X=scaled_Z, y=centered_y_i)
self.fit_objs_[i] = deepcopy(self.obj)
residuals_.append(
(
centered_y_i - self.fit_objs_[i].predict(scaled_Z)
).tolist()
)
# try: # multioutput regressor

# self.y_means_ = np.mean(self.y_, axis=0)
# centered_y = self.y_ - self.y_means_
# self.obj.fit(X=scaled_Z, y=centered_y)
# residuals_ = centered_y - self.obj.predict(scaled_Z)
# self.residuals_ = residuals_

#except Exception as e: # single output regressor
# print(e)
if self.show_progress is True:
iterator = tqdm(range(p))
else:
iterator = range(p)

for i in iterator:
y_mean = np.mean(self.y_[:, i])
self.y_means_[i] = y_mean
centered_y_i = self.y_[:, i] - y_mean
self.centered_y_is_.append(centered_y_i)
self.obj.fit(X=scaled_Z, y=centered_y_i)
self.fit_objs_[i] = deepcopy(self.obj)
residuals_.append(
(
centered_y_i - self.fit_objs_[i].predict(scaled_Z)
).tolist()
)

if self.type_pi.startswith("scp"):

Expand Down Expand Up @@ -791,23 +791,25 @@ def predict(self, h=5, level=95, **kwargs):
)

if "return_pi" in kwargs:
try:
preds_pi = self.obj.predict(cooked_new_X, return_pi=True)
if self.n_series <= 1:
preds_pi = self.obj.predict(cooked_new_X,
return_pi=True)
mean_pi_.append(preds_pi.mean[0])
lower_pi_.append(preds_pi.lower[0])
upper_pi_.append(preds_pi.upper[0])
except Exception:
else:
for i in range(self.n_series):
preds_pi = self.fit_objs_[i].predict(
cooked_new_X, return_pi=True
cooked_new_X, return_pi=True,
)
mean_pi_.append(preds_pi.mean[0])
lower_pi_.append(preds_pi.lower[0])
upper_pi_.append(preds_pi.upper[0])

try:
predicted_cooked_new_X = self.obj.predict(cooked_new_X)
except Exception:
except Exception as e:
print(e)
predicted_cooked_new_X = np.asarray(
[
np.asarray(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from codecs import open
from os import path

__version__ = '0.29.1'
__version__ = '0.29.2'

# get the dependencies and installs
here = path.abspath(path.dirname(__file__))
Expand Down

0 comments on commit 31f23cd

Please sign in to comment.