1
我试图培养使用sknn一些神经网络的麻烦。我通过熊猫数据框预处理了我的数据。预处理工作正常,当我在标准sklearn分类使用配合(x_train,y_train),但它抛出属性错误Scikit-neural_network与输入数据
anaconda/envs/py3k/lib/python3.4/site-packages/pandas/core/generic.py", line 2360, in __getattr__
(type(self).__name__, name))
AttributeError: 'DataFrame' object has no attribute 'todense'
或此错误:
/anaconda/envs/py3k/lib/python3.4/site-packages/pandas/core/indexing.py", line 1750, in maybe_convert_indices
raise IndexError("indices are out-of-bounds")
IndexError: indices are out-of-bounds
看似随意(不同的运行,没有改变任何东西)。
相关的代码看起来是这样的:
x_train, x_test, y_train, y_test = cross_validation.train_test_split(X_data, Y_data, test_size=1/kfold)
regr = linear_model.LinearRegression(copy_X=True,fit_intercept=True)
abr = AdaBoostRegressor(base_estimator=tree.DecisionTreeRegressor(max_depth=max_depth_gridsearch_values[max_depth_counter]), n_estimators = n_estimators_gridsearch_values[n_estimators_counter])
nn=nn_simple_regressor
x_train_numeric = x_train.iloc[:,2:]
x_test_numeric = x_test.iloc[:,2:]
regr.fit(x_train_numeric, y_train)
abr.fit(x_train_numeric, y_train)
nn.fit(x_train_numeric,y_train)
而且回归被定义为
nn_simple_regressor = Regressor(
layers=[
Layer("Rectifier", units=100),
Layer("Linear")],
learning_rate=0.02,
n_iter=10)
我不明白为什么发生这种情况,并且似乎是sknn的支持是相当小。我怀疑这个问题实际上是与预处理,但我不明白为什么它适用于前两种分类,但不是我的NN。有任何想法吗?