title: LDA processing failing with "Variables are collinear." error in python
body: <p>I am using Python 3.6.1 | Anaconda 4.4.0</p>
  
  <p>I am novice in ML and practicing while learning. I picked up a kagle dataset to practice LDA for dimensionality reduction. Two confusion arised:</p>
  
  <ol>
  <li>I started getting warning error "Variables are collinear."</li>
  <li>Even though i am using n-components as 2, still the output vector x_train is showing only 1 feature. </li>
  </ol>
  
  <p>code:</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import pandas as pd
  
  datasets = pd.read_csv('mushrooms.csv')
  X_df = datasets.iloc[:, 1:]  # Independent variables
  y_df = datasets.iloc[:, 0]   # Dependent variables
  
  from sklearn.preprocessing import LabelEncoder, OneHotEncoder
  X_df = X_df.apply(LabelEncoder().fit_transform)
  x = OneHotEncoder(sparse=False).fit_transform(X_df.values)
  y = LabelEncoder().fit_transform(y_df.values)
  
  # Splitting dataset in to training set and test set. 
  from sklearn.model_selection import train_test_split
  x_train,x_test,y_train,y_test = 
  train_test_split(x,y,test_size=0.2,random_state=0)
  # Feature scaling
  from sklearn.preprocessing import StandardScaler
  sc_x = StandardScaler()
  x_train = sc_x.fit_transform(x_train)
  x_test = sc_x.transform(x_test)
  
  #---------------------------------------------
  # Applying LDA (Linear Discriminant Analysis)
  #---------------------------------------------
  
  from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
  lda = LDA(n_components = 2)     
  x_train = lda.fit_transform(x_train, y_train) 
  x_test = lda.transform(x_test)
  </code></pre>