Python

Python

次元圧縮のUMAPでエラー module ‘umap’ has no attribute ‘UMAP’

PythonでUMAPを使おうとしたときに表題のエラー。module 'umap' has no attribute 'UMAP'pip install umapだとダメで、umap-learnをインストールするのが正解pip uninst...
Python

LightGBMでCannot use Dataset instance for prediction, please use raw data instead

LightGBMで2値分類の学習をさせていた際、表題のエラー。import lightgbm as lgblgb_train = lgb.Dataset(X_train, label=y_train)lgb_eval = lgb.Datas...
Python

sklearnのlog_lossでValueError: y_true contains only one label (0).

2値分類タスクでKfold分割してloglossを計算した時にエラー。from sklearn.metrics import log_lossloss = log_loss(y_valdation, oof_prediction)Value...
Python

Macのpyenvでconfigure: error: C compiler cannot create executables

Macでpyenv installしようとしたところ表題のエラー。% pyenv install 3.8.4python-build: use openssl@1.1 from homebrewpython-build: use readl...
Python

Pythonのitertoolsで順列や組合せを重複あり・なしで全列挙する

順列や組合せを求めたいときに、ネストしたループを組むと可読性が低いしネストの回数が変わるとコードの保守も面倒くさい。itertoolsを使えば、読みやすいコードで全列挙を簡単にしてくれる。組合せイテレータは全部で4種類。abcという文字列か...
Python

pip installでpermission deniedが出てsudoや–userでも上手く行かない

pip installした時にpermission deniedが起きた。--userフラグを使うと上手くいくらしい。pip install hogehoge --userが、またpermission denied.安直にsudoを試してみ...
Python

LightGBMでAttributeError: ‘LGBMRegressor’ object has no attribute ‘feature_name_’

LightGBMを使っていると表題のエラー。feature_name_属性がないと怒られる。最新のmasterブランチにこの属性は含まれていないようで、nightlyビルドを使ってみたらエラーは出なくなった。feature_name_ at...
Python

scikit-leranのKerasClassifierでValueError: The estimator KerasClassifier should be a classifier.

scikit-learnのStackingClassifierでKerasClassifierを使った時に表題のエラー。ValueError: The estimator KerasClassifier should be a classi...
Python

MacのLightGBMでエラー image not found

MacOS 10.15.5LightGBMを使いたくなったのでpipでインストールしたら表題のエラー。公式ドキュメントを見てみる。On macOS LightGBM can be installed using Homebrew, or c...
Python

PythonでFunction nameをStringで取り出す

Tensorflowで複数モデルをループさせて色々な学習をさせていた時、今なんのモデルを学習しているのかprintしたくなった。単純にprintしてみたところ、以下のような出力になった。print(EfficientNetB0)> <fun...