I get an error about scikit-learn and others, "Some libraries imported but unused", when I want to run my code.

conda version : 4.6.14
python version : 3.7.3.final.0

Error output:

math imported but unused

sklearn.metrics..... imported but unused

random imported but unused

Same warning all below up this libraries.

import random
import numpy as np
import math
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
from sklearn.cross_validation import train_test_split
from sklearn.svm import SVC
from sklearn.model_selection import LeaveOneOut
from sklearn.model_selection import LeaveOneGroupOut
from sklearn.metrics import accuracy_score
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix

1 Answers

sentence On

First of all, a warning is NOT an error. A warning is a warning.

Your IDE, by doing Static Code Analysis is just warning you that you are importing libraries that you are not using in your code. Considered as bad practices, your IDE is implicitly suggesting to remove those lines of code.