You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
I have been trying to use
F1 = make_scorer(fbeta_score, beta=1, labels = ['1', '2'], average='micro')
and F2
as the scoring parameter for logistic regression but glmnet throws the below error. It runs smoothly with scoring = 'accuracy', though. I tried to study the code but couldn't find a way to work with customized scores. Any help would be appreciated.
TypeError Traceback (most recent call last)
/home/Dados/Redes_Neurais_II/Dissertacao/Teste pdf 201224.py in
4110 n_splits=n_splits, min_lambda_ratio=min_lambda_ratio, tol=tol,
4111 scoring=scoring, n_jobs=-1, random_state=1, verbose=True)
----> 4112 clf_cv = lgnetcv.fit(x_train, y_train)
4113 print(f'\nMelhor lambda = {clf_cv.lambda_best_} para alpha = {alpha}')
4114 # Usa todo o conj de treinamento (inclusive valid) para achar coeficientes finais
~/.local/lib/python3.6/site-packages/glmnet/util.py in _score_lambda_path(est, X, y, groups, sample_weight, relative_penalties, scoring, n_jobs, verbose)
67 delayed(fit_and_score)(est, scorer, X, y, sample_weight, relative_penalties,
68 est.lambda_path, train_idx, test_idx)
---> 69 for (train_idx, test_idx) in cv_split)
70
71 return scores
~/.local/lib/python3.6/site-packages/joblib/parallel.py in call(self, iterable)
1015
1016 with self._backend.retrieval_context():
-> 1017 self.retrieve()
1018 # Make sure that we get a last message telling us we are done
1019 elapsed_time = time.time() - self._start_time
~/.local/lib/python3.6/site-packages/joblib/parallel.py in retrieve(self)
907 try:
908 if getattr(self._backend, 'supports_timeout', False):
--> 909 self._output.extend(job.get(timeout=self.timeout))
910 else:
911 self._output.extend(job.get())
/usr/lib/python3.6/multiprocessing/pool.py in get(self, timeout)
642 return self._value
643 else:
--> 644 raise self._value
645
646 def _set(self, i, obj):
/usr/lib/python3.6/multiprocessing/pool.py in worker(inqueue, outqueue, initializer, initargs, maxtasks, wrap_exception)
117 job, i, func, args, kwds = task
118 try:
--> 119 result = (True, func(*args, **kwds))
120 except Exception as e:
121 if wrap_exception and func is not _helper_reraises_exception:
~/.local/lib/python3.6/site-packages/joblib/_parallel_backends.py in call(self, *args, **kwargs)
606 def call(self, *args, **kwargs):
607 try:
--> 608 return self.func(*args, **kwargs)
609 except KeyboardInterrupt:
610 # We capture the KeyboardInterrupt and reraise it as
~/.local/lib/python3.6/site-packages/joblib/parallel.py in call(self)
254 with parallel_backend(self._backend, n_jobs=self._n_jobs):
255 return [func(*args, **kwargs)
--> 256 for func, args, kwargs in self.items]
257
258 def len(self):
~/.local/lib/python3.6/site-packages/joblib/parallel.py in (.0)
254 with parallel_backend(self._backend, n_jobs=self._n_jobs):
255 return [func(*args, **kwargs)
--> 256 for func, args, kwargs in self.items]
257
258 def len(self):
I have been trying to use
F1 = make_scorer(fbeta_score, beta=1, labels = ['1', '2'], average='micro')
and F2
as the scoring parameter for logistic regression but glmnet throws the below error. It runs smoothly with scoring = 'accuracy', though. I tried to study the code but couldn't find a way to work with customized scores. Any help would be appreciated.
TypeError Traceback (most recent call last)
/home/Dados/Redes_Neurais_II/Dissertacao/Teste pdf 201224.py in
4110 n_splits=n_splits, min_lambda_ratio=min_lambda_ratio, tol=tol,
4111 scoring=scoring, n_jobs=-1, random_state=1, verbose=True)
----> 4112 clf_cv = lgnetcv.fit(x_train, y_train)
4113 print(f'\nMelhor lambda = {clf_cv.lambda_best_} para alpha = {alpha}')
4114 # Usa todo o conj de treinamento (inclusive valid) para achar coeficientes finais
~/.local/lib/python3.6/site-packages/glmnet/logistic.py in fit(self, X, y, sample_weight, relative_penalties, groups)
248 self.scoring,
249 n_jobs=self.n_jobs,
--> 250 verbose=self.verbose)
251
252 self.cv_mean_score_ = np.atleast_1d(np.mean(cv_scores, axis=0))
~/.local/lib/python3.6/site-packages/glmnet/util.py in _score_lambda_path(est, X, y, groups, sample_weight, relative_penalties, scoring, n_jobs, verbose)
67 delayed(fit_and_score)(est, scorer, X, y, sample_weight, relative_penalties,
68 est.lambda_path, train_idx, test_idx)
---> 69 for (train_idx, test_idx) in cv_split)
70
71 return scores
~/.local/lib/python3.6/site-packages/joblib/parallel.py in call(self, iterable)
1015
1016 with self._backend.retrieval_context():
-> 1017 self.retrieve()
1018 # Make sure that we get a last message telling us we are done
1019 elapsed_time = time.time() - self._start_time
~/.local/lib/python3.6/site-packages/joblib/parallel.py in retrieve(self)
907 try:
908 if getattr(self._backend, 'supports_timeout', False):
--> 909 self._output.extend(job.get(timeout=self.timeout))
910 else:
911 self._output.extend(job.get())
/usr/lib/python3.6/multiprocessing/pool.py in get(self, timeout)
642 return self._value
643 else:
--> 644 raise self._value
645
646 def _set(self, i, obj):
/usr/lib/python3.6/multiprocessing/pool.py in worker(inqueue, outqueue, initializer, initargs, maxtasks, wrap_exception)
117 job, i, func, args, kwds = task
118 try:
--> 119 result = (True, func(*args, **kwds))
120 except Exception as e:
121 if wrap_exception and func is not _helper_reraises_exception:
~/.local/lib/python3.6/site-packages/joblib/_parallel_backends.py in call(self, *args, **kwargs)
606 def call(self, *args, **kwargs):
607 try:
--> 608 return self.func(*args, **kwargs)
609 except KeyboardInterrupt:
610 # We capture the KeyboardInterrupt and reraise it as
~/.local/lib/python3.6/site-packages/joblib/parallel.py in call(self)
254 with parallel_backend(self._backend, n_jobs=self._n_jobs):
255 return [func(*args, **kwargs)
--> 256 for func, args, kwargs in self.items]
257
258 def len(self):
~/.local/lib/python3.6/site-packages/joblib/parallel.py in (.0)
254 with parallel_backend(self._backend, n_jobs=self._n_jobs):
255 return [func(*args, **kwargs)
--> 256 for func, args, kwargs in self.items]
257
258 def len(self):
~/.local/lib/python3.6/site-packages/glmnet/util.py in fit_and_score(est, scorer, X, y, sample_weight, relative_penalties, score_lambda_path, train_inx, test_inx)
117
118 lamb = np.clip(score_lambda_path, m.lambda_path[-1], m.lambda_path_[0])
--> 119 return scorer(m, X[test_inx, :], y[test_inx], lamb=lamb)
120
121
TypeError: call() got an unexpected keyword argument 'lamb'
The text was updated successfully, but these errors were encountered: