样本数量不一致意味着什么？

``````Found input variables with inconsistent numbers of samples: [90000, 5625]
``````

``````import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from scipy import stats
from sklearn import datasets, linear_model
from sklearn.model_selection import train_test_split

dataset = pd.read_csv("/Users/An/Desktop/data/telco.csv", na_values = ' ')
dataset = dataset.dropna(axis = 0)

dataset = dataset.replace({'Yes':1, 'Fiber optic': 1, 'DSL':1, 'No':0, 'No phone service':0, 'No internet service':0})
dataset = dataset.drop('Contract', axis  =1)
dataset = dataset.drop('PaymentMethod',axis  =1)
dataset = dataset.drop('customerID',axis  =1)
dataset = dataset.drop('gender',axis  =1)

for i in list(['tenure', 'MonthlyCharges', 'TotalCharges']):
sd = np.std(dataset[i])
mean = np.mean(dataset[i])
dataset[i] = (dataset[i] - mean) / sd

total = pd.DataFrame(dataset)
data_train, data_test = train_test_split(total, test_size=0.2)
data_train = data_train.values
data_test = data_test.values

from sklearn.linear_model import LogisticRegression

clf = LogisticRegression(C=1e9)
clf = clf.fit(data_train[:,0:16], data_train[:,16])
print clf.intercept_, clf.coef_
``````

原因

`LogisticRegression.fit`期望`x``y`具有相同的`shape[0]`，但是您正在将`x``(n, m)`改成{{1 }}。

``(n*m, 1)``