Skip to content
Snippets Groups Projects
Commit 68905cf9 authored by maimouni.mouhcine's avatar maimouni.mouhcine
Browse files

Model regression correction des paramètres

parent 75da33af
No related branches found
No related tags found
No related merge requests found
......@@ -98,6 +98,7 @@ class Plsr(Regmodel):
### parameters in common
def objective(self, params):
params['n_components'] = int(params['n_components'])
x0 = [self._xc, self._xt]
x1 = [eval(str(params['normalization'])+"(x0[i])") for i in range(2)]
......@@ -130,6 +131,10 @@ class Plsr(Regmodel):
self._yc = Model.predict(x2[0])
self._yt = Model.predict(x2[1])
self._model = Model
for key,value in params.items():
try: params[key] = int(value)
except (TypeError, ValueError): params[key] = value
self._best = params
self.pretreated = pd.DataFrame(x2[0])
self._sel_ratio = sel_ratio(Model, x2[0])
......@@ -197,7 +202,11 @@ class TpeIpls(Regmodel):
self._yc = Model.predict(x2[0][:,id])
self._yt = Model.predict(x2[1][:,id])
self._model = Model
for key,value in params.items():
try: params[key] = int(value)
except (TypeError, ValueError): params[key] = value
self._best = params
self.pretreated = pd.DataFrame(x2[0])
self.segments = arrays
......
File added
;from;to
band1;353;409
band2;501;882
band3;1727;2020
{"deriv": 0, "n_components": 18, "normalization": "No_transformation", "polyorder": 0, "v1": 752, "v2": 735, "v3": 125, "v4": 1198, "v5": 461, "v6": 522, "window_length": 1}
\ No newline at end of file
......@@ -293,9 +293,11 @@ if not spectra.empty and not y.empty:
M1.write(Reg.best_hyperparams_print)
a_Test=Reg.best_hyperparams_print
with open("data/params/Preprocessing.json", "w") as outfile:
json.dump(Reg.best_hyperparams_, outfile)
with open("data/params/Preprocessing.json", "w") as outfile:
json.dump(Reg.best_hyperparams_, outfile)
##########
M1.write("-- Model performance --")
M1.dataframe(metrics(c = [y_train, yc], t = [y_test, yt], method='regression').scores_)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment