Getting the following error in the complexity curves section when running the code.
/usr/local/lib/python2.7/site-packages/sklearn/utils/validation.py:395: DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and will raise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample.
DeprecationWarning)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-9-56bd0b56ae45> in <module>()
----> 1 vs.ModelComplexity(X_train, y_train)
/Users/emi862/Workspaces/Projects/Machine-Learning/udacity-machine-learning-projects/boston_housing/visuals.pyc in ModelComplexity(X, y)
80 # Calculate the training and testing scores
81 train_scores, test_scores = curves.validation_curve(DecisionTreeRegressor(), X, y, \
---> 82 param_name = "max_depth", param_range = max_depth, cv = cv, scoring = 'r2')
83
84 # Find the mean and standard deviation for smoothing
/usr/local/lib/python2.7/site-packages/sklearn/learning_curve.pyc in validation_curve(estimator, X, y, param_name, param_range, cv, scoring, n_jobs, pre_dispatch, verbose)
352 estimator, X, y, scorer, train, test, verbose,
353 parameters={param_name: v}, fit_params=None, return_train_score=True)
--> 354 for train, test in cv for v in param_range)
355
356 out = np.asarray(out)[:, :2]
/usr/local/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in __call__(self, iterable)
756 # was dispatched. In particular this covers the edge
757 # case of Parallel used with an exhausted iterator.
--> 758 while self.dispatch_one_batch(iterator):
759 self._iterating = True
760 else:
/usr/local/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in dispatch_one_batch(self, iterator)
606 return False
607 else:
--> 608 self._dispatch(tasks)
609 return True
610
/usr/local/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in _dispatch(self, batch)
569 dispatch_timestamp = time.time()
570 cb = BatchCompletionCallBack(dispatch_timestamp, len(batch), self)
--> 571 job = self._backend.apply_async(batch, callback=cb)
572 self._jobs.append(job)
573
/usr/local/lib/python2.7/site-packages/sklearn/externals/joblib/_parallel_backends.pyc in apply_async(self, func, callback)
107 def apply_async(self, func, callback=None):
108 """Schedule a func to be run"""
--> 109 result = ImmediateResult(func)
110 if callback:
111 callback(result)
/usr/local/lib/python2.7/site-packages/sklearn/externals/joblib/_parallel_backends.pyc in __init__(self, batch)
324 # Don't delay the application, to avoid keeping the input
325 # arguments in memory
--> 326 self.results = batch()
327
328 def get(self):
/usr/local/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in __call__(self)
129
130 def __call__(self):
--> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
132
133 def __len__(self):
/usr/local/lib/python2.7/site-packages/sklearn/cross_validation.pyc in _fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters, fit_params, return_train_score, return_parameters, error_score)
1663 estimator.fit(X_train, **fit_params)
1664 else:
-> 1665 estimator.fit(X_train, y_train, **fit_params)
1666
1667 except Exception as e:
/usr/local/lib/python2.7/site-packages/sklearn/tree/tree.pyc in fit(self, X, y, sample_weight, check_input, X_idx_sorted)
1027 sample_weight=sample_weight,
1028 check_input=check_input,
-> 1029 X_idx_sorted=X_idx_sorted)
1030 return self
1031
/usr/local/lib/python2.7/site-packages/sklearn/tree/tree.pyc in fit(self, X, y, sample_weight, check_input, X_idx_sorted)
238 if len(y) != n_samples:
239 raise ValueError("Number of labels=%d does not match "
--> 240 "number of samples=%d" % (len(y), n_samples))
241 if not 0 <= self.min_weight_fraction_leaf <= 0.5:
242 raise ValueError("min_weight_fraction_leaf must in [0, 0.5]")
ValueError: Number of labels=312 does not match number of samples=1