これまで不通に動作して動させていたのですが、急にImportError: DLL load failed: ファイルにアクセスできません。
というエラーが起こりました。
from sklearn.metrics import confusion_matrix #0,1で表される二値分類の真の値と予測値 y_ture = [1,0,1,1,0,1,1,0] y_pred = [0,0,1,1,0,0,1,1] tp = np.sum((np.array(y_ture) == 1) & (np.array(y_pred) == 1)) tn = np.sum((np.array(y_ture) == 0) & (np.array(y_pred) == 0)) fp = np.sum((np.array(y_ture) == 0) & (np.array(y_pred) == 1)) fp = np.sum((np.array(y_ture) == 1) & (np.array(y_pred) == 0)) confusion_matrix1 = np.array([[tp,fp],[fn,tn]]) print(confusion_matrix1) #array([[3,1],[2,2]]) confusion_matrix2 = confusion_matrix(y_ture,y_pred)
ImportError Traceback (most recent call last) <ipython-input-1-8396db82e664> in <module> ----> 1 from sklearn.metrics import confusion_matrix 2 3 #0,1で表される二値分類の真の値と予測値 4 y_ture = [1,0,1,1,0,1,1,0] 5 y_pred = [0,0,1,1,0,0,1,1] ~\anaconda3\envs\nn\lib\site-packages\sklearn\__init__.py in <module> 78 from . import _distributor_init # noqa: F401 79 from . import __check_build # noqa: F401 ---> 80 from .base import clone 81 from .utils._show_versions import show_versions 82 ~\anaconda3\envs\nn\lib\site-packages\sklearn\base.py in <module> 19 from . import __version__ 20 from ._config import get_config ---> 21 from .utils import _IS_32BIT 22 from .utils.validation import check_X_y 23 from .utils.validation import check_array ~\anaconda3\envs\nn\lib\site-packages\sklearn\utils\__init__.py in <module> 21 22 from .murmurhash import murmurhash3_32 ---> 23 from .class_weight import compute_class_weight, compute_sample_weight 24 from . import _joblib 25 from ..exceptions import DataConversionWarning ~\anaconda3\envs\nn\lib\site-packages\sklearn\utils\class_weight.py in <module> 5 import numpy as np 6 ----> 7 from .validation import _deprecate_positional_args 8 9 ~\anaconda3\envs\nn\lib\site-packages\sklearn\utils\validation.py in <module> 24 from contextlib import suppress 25 ---> 26 from .fixes import _object_dtype_isnan 27 from .. import get_config as _get_config 28 from ..exceptions import NonBLASDotWarning, PositiveSpectrumWarning ~\anaconda3\envs\nn\lib\site-packages\sklearn\utils\fixes.py in <module> 16 import scipy.sparse as sp 17 import scipy ---> 18 import scipy.stats 19 from scipy.sparse.linalg import lsqr as sparse_lsqr # noqa 20 from numpy.ma import MaskedArray as _MaskedArray # TODO: remove in 0.25 ~\anaconda3\envs\nn\lib\site-packages\scipy\stats\__init__.py in <module> 382 from __future__ import division, print_function, absolute_import 383 --> 384 from .stats import * 385 from .distributions import * 386 from .morestats import * ~\anaconda3\envs\nn\lib\site-packages\scipy\stats\stats.py in <module> 177 178 from scipy._lib.six import callable, string_types --> 179 from scipy.spatial.distance import cdist 180 from scipy.ndimage import measurements 181 from scipy._lib._version import NumpyVersion ~\anaconda3\envs\nn\lib\site-packages\scipy\spatial\__init__.py in <module> 100 from ._spherical_voronoi import SphericalVoronoi 101 from ._plotutils import * --> 102 from ._procrustes import procrustes 103 104 __all__ = [s for s in dir() if not s.startswith('_')] ~\anaconda3\envs\nn\lib\site-packages\scipy\spatial\_procrustes.py in <module> 9 10 import numpy as np ---> 11 from scipy.linalg import orthogonal_procrustes 12 13 ~\anaconda3\envs\nn\lib\site-packages\scipy\linalg\__init__.py in <module> 193 from .linalg_version import linalg_version as __version__ 194 --> 195 from .misc import * 196 from .basic import * 197 from .decomp import * ~\anaconda3\envs\nn\lib\site-packages\scipy\linalg\misc.py in <module> 3 import numpy as np 4 from numpy.linalg import LinAlgError ----> 5 from .blas import get_blas_funcs 6 from .lapack import get_lapack_funcs 7 ~\anaconda3\envs\nn\lib\site-packages\scipy\linalg\blas.py in <module> 213 import functools 214 --> 215 from scipy.linalg import _fblas 216 try: 217 from scipy.linalg import _cblas ImportError: DLL load failed: ファイルにアクセスできません。
ほかのライブラリを試しに書いてみても同じエラーが起きました。
どうやったら直るのかがわからないため、解決方法がなにかあれば教えてもらいたいです。
実行環境
windows10
anaconda
jupiter lab
python
回答1件
あなたの回答
tips
プレビュー