无法导入名称'downsample'

时间:2018-04-24 16:47:38

标签: python neural-network regression theano lasagne

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import time, math
from sklearn import linear_model, datasets
diabetes = datasets.load_diabetes()
diabetes_x = diabetes.data[:, np.newaxis] 
diabetes_x_temp = diabetes_x[:, :, 2]    
diabetes_x_train = diabetes_x_temp[:-20]
diabetes_x_test = diabetes_x_temp[-20:]
diabetes_y_train = diabetes.target[:-20]
diabetes_y_test = diabetes.target[-20:]


from sknn.mlp import Regressor, Layer
nn0=Regressor(layers=[Layer("Rectifier",units=5),Layer("Linear",units=1)],learning_rate=0.001, weight_decay=0.1,regularize='L2',learning_momentum=0.9,n_iter=20, batch_size=1, loss_type='mse',verbose=True)
x_max=max(diabetes_x_train)
nn0.fit(diabetes_x_train / x_max, diabetes_y_train)
print('Neural Network parameters:')
for param in nn0.get_parameters():
    print(param[2])
    print('\t weights: ',np.round(param[0],2))
    print('\t biases: ',np.round(param[1],2))

我遇到错误cannot import name downsample for line 29。 我也收到关于Theano的错误:

DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory
  warnings.warn("DeprecationWarning: there is no c++ compiler."
WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions

但是我不知道我在这段代码中使用theano?! 我已经尝试将Theano更新为适用于我正在使用的当前Lasagne软件包的版本(目前使用Theano 1.0.1和Lasagne 0.1)。然而,这似乎没有帮助。 我很擅长使用所有这些新软件包,所以任何帮助都会很棒。

0 个答案:

没有答案