dnouri / nolearn

Combines the ease of use of scikit-learn with the power of Theano/Lasagne
http://danielnouri.org/notes/2014/12/17/using-convolutional-neural-nets-to-detect-facial-keypoints-tutorial/
MIT License
949 stars 260 forks source link

Can't install nolearn==0.7, installs nolearn-0.6a0.dev0 instead #237

Closed ChinookPDX closed 8 years ago

ChinookPDX commented 8 years ago

I'm using the following to install nolearn 0.7 -- I'm using Anaconda with win7 64 bit.

pip install -r https://raw.githubusercontent.com/dnouri/nolearn/master/requirements.txt pip install git+https://github.com/dnouri/nolearn.git@master#egg=nolearn==0.7.git

But instead, it installs nolearn-0.6a0.dev0.

I'm trying to run this code (data file attached):

column_3C.txt

import csv
import random
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import StandardScaler
from lasagne import layers
from lasagne.updates import nesterov_momentum
from lasagne.nonlinearities import softmax
from nolearn.lasagne import NeuralNet

train_file = 'C:/Users/Chin/Desktop/ML/stacking/column_3C.txt'

data = [ i for i in csv.reader(file(train_file, 'rb'), delimiter=' ') ]
data = data[1:] 
random.shuffle(data)

X = np.array([ i[:-1] for i in data ], dtype=float)
Y = np.array([ i[-1] for i in data ])

label_encoder = LabelEncoder()
label_encoder.fit(Y)
Y = label_encoder.transform(Y)

nfeatures = int(X.shape[1])
nclass=len(np.unique(Y)) 

dev_cutoff = len(Y) * 4/5
X_dev = X[:dev_cutoff]
Y_dev = Y[:dev_cutoff]
X_test = X[dev_cutoff:]
Y_test = Y[dev_cutoff:]

scaler = StandardScaler().fit(X_dev)
X_dev_scaled=scaler.transform(X_dev)
X_test_scaled=scaler.transform(X_test)

clf_ = NeuralNet(
    layers=[  
        ('input', layers.InputLayer),
        ('hidden', layers.DenseLayer),
        ('output', layers.DenseLayer),
        ],
    input_shape=(None, nfeatures),  
    hidden_num_units=100,  
    output_nonlinearity=softmax,  
    output_num_units=nclass,  
    update=nesterov_momentum,
    update_learning_rate=0.01, 
    update_momentum=0.9, 
    regression=False,  
    max_epochs=400,  
    verbose=1, 
    )

clf_.fit(X_dev_scaled, Y_dev)

And it gives me the following error (part of it here):

runfile('C:/Users/Chin/.spyder2/temp.py', wdir='C:/Users/Chin/.spyder2') C:\Users\Chin\Anaconda2\lib\site-packages\theano\tensor\signal\downsample.py:6: UserWarning: downsample module has been moved to the theano.tensor.signal.pool module. "downsample module has been moved to the theano.tensor.signal.pool module.") WARNING (theano.gof.compilelock): Overriding existing lock by dead process '6388' (I am process '7840') WARNING:theano.gof.compilelock:Overriding existing lock by dead process '6388' (I am process '7840') Traceback (most recent call last):

File "", line 1, in runfile('C:/Users/Chin/.spyder2/temp.py', wdir='C:/Users/Chin/.spyder2')

File "C:\Users\Chin\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 699, in runfile execfile(filename, namespace)

File "C:\Users\Chin\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile exec(compile(scripttext, filename, 'exec'), glob, loc)

File "C:/Users/Chin/.spyder2/temp.py", line 59, in clf_.fit(X_dev_scaled, Y_dev)

File "C:\Users\Chin\Anaconda2\lib\site-packages\nolearn\lasagne\base.py", line 521, in fit self.initialize()

File "C:\Users\Chin\Anaconda2\lib\site-packages\nolearn\lasagne\base.py", line 361, in initialize self.y_tensor_type,

Thanks.

dnouri commented 8 years ago

The first issue with it installing nolearn-0.6a0.dev0: that's fine and expected.

For the second issue with the error you're getting: You forgot to include the last lines of the traceback.

ChinookPDX commented 8 years ago

Thanks. Here is the portion of the Traceback I see in the console. It ended up being too long, I saved it to a file.

Traceback.txt

I have:

theano 0.8.0 lasagne 0.2.dev1 scipy 0.16.1

dnouri commented 8 years ago

This may be an issue with your installation. Have you tried running the Lasagne examples?

ChinookPDX commented 8 years ago

Thanks again. It looks like I can't run that Lasagne example either. I'll try to get Lasagne running first and report back here. Do we meed to have lasagne 0.2.dev1 for nolearn?

ChinookPDX commented 8 years ago

I got it finally, It was a Theano installation issue. In the Anaconda command prompt, I did the following and fixed my issue:

conda install mingw libpython

Thanks.