Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 18th, 2013, 07:38 AM
REvans REvans is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 1 REvans User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 49 sec
Reputation Power: 0
Using MLPY on a mac

Hi people, I hope someone can help me with this.

I'm trying to use MLPY on a mac, I've installed it (though maybe not properly), but when I type "import mlpy" in Python I get this error:

Code:
import mlpy
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/Users/revans/Programming/Python/<ipython-input-22-f4eb31cdba5b> in <module>()
----> 1 import mlpy

/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/mlpy/__init__.py in <module>()
     16     from .lcs import *
     17 else:
---> 18     import gsl
     19     from libsvm import *
     20     from liblinear import *

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/mlpy/gsl.so, 2): Symbol not found: _gsl_sf_fact
  Referenced from: /Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/mlpy/gsl.so
  Expected in: dynamic lookup


So it seems like there is some kind of problem with GSL. I installed GSL with macports, and from the website, but python can't seem to find it. If I type "import gsl" in Python I get:

Code:
import gsl
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/Users/robertevans/Programming/Python/<ipython-input-23-426c2d498189> in <module>()
----> 1 import gsl

ImportError: No module named gsl


I think perhaps I need to set a path or something like that. Anyone know?

Failing that, anybody know any other good Python libraries that come with Dynamic Time Warping?

Thanks.

Reply With Quote
  #2  
Old March 11th, 2013, 01:47 AM
JavertKurtz JavertKurtz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2013
Posts: 2 JavertKurtz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 24 sec
Reputation Power: 0
Having the same problem - did you ever figure it out?

Reply With Quote
  #3  
Old March 11th, 2013, 06:35 AM
RLEvans RLEvans is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2013
Posts: 1 RLEvans User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 39 sec
Reputation Power: 0
Quote:
Originally Posted by JavertKurtz
Having the same problem - did you ever figure it out?


I never got MLPY installed, but I did find a good workaround. I used the RPY2 library to access R from Python. R has a Dynamic Time Warping module. It meant I had to install R, install the dtw module, install RPY2, plus figure out how to use it all, but it did work.

R: (http : // www . r-project . org)
RPY2: (http : // rpy . sourceforge .net / rpy2 . html)
dtw package for R: (http : // dtw . r-forge . r-project . org)

(the links have spaces in because new users aren't allowed to post links, even if they are helpful, stupid rule)

Here's some Python code that should work once you have RPY2, R, and the dtw module installed (install dtw from within R once you have R).

Code:
import pylab
from rpy2.robjects.packages import importr
from rpy2 import robjects
from rpy2 import rinterface
import rpy2.robjects.numpy2ri
rpy2.robjects.numpy2ri.activate()
R = rpy2.robjects.r
DTW = importr('dtw')

# Calculate the alignment and DTW distance
alignment = R.dtw(query, reference, keep=True)
distance = alignment.rx('distance')[0][0]

# Plot the warped curve
warpIndexes=R.warp(alignment,True)
pylab.plot(warpIndexes,query)

# Some plotting stuff inside R:
# Show the alignment
R.X11()
R.dtwPlotTwoWay(alignment)

# Show the warping function
R.X11()
R.dtwPlotThreeWay(alignment,main="")

 # You can call this to refresh the R windows if you resize them
rinterface.process_revents()


I hope that helps!

(By the way I had to register a new account because this forum's password reset doesn't work)

Reply With Quote
  #4  
Old March 11th, 2013, 12:31 PM
JavertKurtz JavertKurtz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2013
Posts: 2 JavertKurtz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 24 sec
Reputation Power: 0
Good to know - thanks!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Using MLPY on a mac

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap